Tutorial by Examples

PHPUnit provides the following function to assert whether an object is an instance of a class: assertInstanceOf($expected, $actual[, $message = '']) The first parameter $expected is the name of a class (string). The second parameter $actual is the object to be tested. $message is an optional ...
PHPUnit provides the following functions to watch for thrown exceptions, which were released with 5.2.0: expectException($exception) expectExceptionMessage($message) expectExceptionCode($code) expectExceptionMessageRegExp($messageRegExp) These are used to watch for an exception to be thrown...
PHPUnit has two assertions to check values of class properties: assertAttributeSame($expected, $actualAttributeName, $actualClassOrObject, $message = '') assertAttributeNotSame($expected, $actualAttributeName, $actualClassOrObject, $message = '') These methods will check the value of a object p...

Page 1 of 1