Monday, January 26, 2015

Basic TDD in Your New PHP Package

In part 1, we set up our development environment, baked in some rules as inherited from The League, and created two sample but useless classes - Diffbot and DiffbotException. In this part, we’ll get started with Test Driven Development.



If you’d like to follow along, please read Part 1 or clone the part 1 branch of this tutorial’s code.


PHPUnit


We’ve covered PHPUnit to some degree before (1, 2, 3, 4, 5, 6), but it’s time we put it into real practice now. First, let’s check if it’s installed.



php vendor/phpunit/phpunit/phpunit

Running this command should produce a report that says one test passed. This is the test included in the League Skeleton by default and it asserts that true is, in fact, true. A coverage report will also be generated and placed into the build folder.


Continue reading %Basic TDD in Your New PHP Package%




by Bruno Skvorc via SitePoint

No comments:

Post a Comment