1, markTestSkipped and markTestIncomplete

  In the above program, is a connecting database, judge whether the data of test method, but if consider database connection exception, when you should throw an exception, use markTestSkipped pointed out that the test method should be ignored, because the exception, and pay attention to, at this time could you write the code is correct, just appeared abnormal, such phpunit output in the output is not simply fail.

  2, a deeper understanding of phpunit assertion

  We write the unit test code of the preliminary framework is as follows:

  In the previous article, has been setUp and tearDown methods are introduced, and the setUp method, established the Testable () instance and stored in the variable $_testable, while in the tearDown approach, destroy the object.

you might be interested in the article:

  • the pear package to install phpunit method
  • phpunit PHP test framework installation method
  • PHP unit test tool phpunit in-depth usage (3)
  • PHP unit test tool phpunit asain
  • Windows to install the pear and phpunit (note configured PHP command line environment)


This concludes the body part