2011年11月15日星期二

PHPMaster.com: Getting Started with PHPUnit


On PHPMaster.com today, there's a new tutorial helping you get started with on of the most popular unit testing frameworks for PHP, PHPUnit. In this new article they help you write your first tests, run them and figure out what to do when they fail.



Most people know that testing your websites is a good idea, but after some time testing can become tedious. What if a lot of this testing process could be automated so you don't have to go trough every function manually, time after time, to ensure that it still works after updating your code? This is where unit testing comes in, to automate the testing process.


She starts with a simple, self-contained test - setting and getting a "name" value from a User class. The tests include an example of a setup/tear down and check that the result of the "talk()" method is correct with an assertEquals.

没有评论:

发表评论