PEAR Handbuch | ||
---|---|---|
Zurück | Nach vorne |
You should never get in contact with this class. PHPUnit_Assert is inherited by PHPUnit_TestCase and you can call the assert*()-functions in your test class through $this
If you go through the assert*() documentation you will note, that sometimes an assertation can expressed with more then one assert-function, ie:
... $expected = "abc"; $result = myFunction(...); // returns "abc" // [1] $this->assertEquals($expected,$result); // or [2] $this->assertTrue($expected == $result); |
$expected - the expected value
$result - the expected value
$message - this string is stored in the test suite result set, if the assertion fails
$delta - if the given values are numbers, you can define a delta value.
With the delta value you can compare two values which are only nearly equal, ie.: 5 is equal 5.04 depending on the situation. This is a tribute to Java background of the test framework, which is also used in scientific enviroments. For a physicist a difference of 10% between the expected and result value must not be a difference, such values are 'equal' for them. ;-)
Zurück | Zum Anfang | Nach vorne |
PHPUnit_TestCase | Nach oben | PHPUnit_TestResult |