Extending PHPUnit
Extending PHPUnit
PHPUnit can be extended in various ways to make the writing of tests easier and customize the feedback you get from running tests. Here are common starting points to extend PHPUnit.
Subclass PHPUnit_Framework_TestCase
Write custom assertions and utility methods in an abstract subclass of PHPUnit_Framework_TestCase
and derive your test case classes from that class. This is one of the easiest ways to extend PHPUnit.
Write custom assertions
When writing custom assertions it is the best practice to follow how PHPUnit's own assertions are implemented. As you can see in 登录查看完整内容