A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearPHPUnit for command line integration tests - page 1
User InfoPosts
PHPUnit for command line integration tests#1
Recently, I(ve started to working on Email2SMS feature in our product. When I joined the project this component had zero code coverage by unit-tests. Legacy code.

Since I started to working on it, I was using test-first approach. But code quality was very low. It was very hard to split it and tests small chunks by unit-tests, so I decided to write integration test.

There is php script, which accepts some message info, search for user in DB and save some info if everything is OK.

$last_line = system((php emailtosms.php -file=unicode_message.txt (, $retval);

$this->assertStringExistsInLogFile((Email to SMS message was not sent();

Is it bad or not? How would you solve this problem?

posted date: 2009-04-14 10:15:00

Re: PHPUnit for command line integration tests#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-14 10:15:01

Re: PHPUnit for command line integration tests#3
Not so good.Test at a lower level, by having the emailtosms.php script as a simple wrapper that processes the command line args, and then pass off to more testable class. Depending on the final step, you could write unit tests to do almost every but the final send (maybe mock the final step that actually sends it, and just store it to a variable, then check you(ve got something valid there).The final integration, runs the full class end-to-end, and check its output, looking at the final log - or a little higher-level, what would be put into to log.

posted date: 2009-04-14 10:37:00

select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.