Creates an empty test case. Should be subclassed with test methods for a functional test case.
UnitTestCase
__construct
([string $label = false])
-
string
$label: Name of test case. Will use the class name if none specified.
Redefinition of:
- SimpleTestCase::__construct()
- Sets up the test with no display.
Redefined in descendants as:
Will trigger a pass if both parameters refer to different objects. Fail otherwise. The objects have to be identical though.
boolean
assertClone
(mixed $first, mixed $second, [string $message = '%s'])
-
mixed
$first: Object reference to check.
-
mixed
$second: Hopefully not the same object.
-
string
$message: Message to display.
Will trigger a pass if both parameters refer to different variables. Fail otherwise. The objects have to be identical references though.
This will fail under E_STRICT with objects. Use assertClone() for this.
boolean
assertCopy
( &$first, &$second, [string $message = "%s"], mixed $first, mixed $second)
-
mixed
$first: Object reference to check.
-
mixed
$second: Hopefully not the same object.
-
string
$message: Message to display.
-
&$first
-
&$second
Will trigger a pass if the two parameters have the same value only. Otherwise a fail.
boolean
assertEqual
(mixed $first, mixed $second, [string $message = '%s'])
-
mixed
$first: Value to compare.
-
mixed
$second: Value to compare.
-
string
$message: Message to display.
Will be true on false and vice versa. False is the PHP definition of false, so that null, empty strings, zero and an empty array all count as false.
boolean
assertFalse
(boolean $result, [string $message = '%s'])
-
boolean
$result: Pass on false.
-
string
$message: Message to display.
Will trigger a pass if the two parameters have the same value and same type. Otherwise a fail.
boolean
assertIdentical
(mixed $first, mixed $second, [string $message = '%s'])
-
mixed
$first: Value to compare.
-
mixed
$second: Value to compare.
-
string
$message: Message to display.
Type and class test. Will pass if class matches the type name or is a subclass or if not an object, but the type is correct.
boolean
assertIsA
(mixed $object, string $type, [string $message = '%s'])
-
mixed
$object: Object to test.
-
string
$type: Type name as string.
-
string
$message: Message to display.
Will trigger a pass if the perl regex pattern is not present in subject. Fail if found.
boolean
assertNoPattern
(string $pattern, string $subject, [string $message = '%s'])
-
string
$pattern: Perl regex to look for including the regex delimiters.
-
string
$subject: String to search in.
-
string
$message: Message to display.
Type and class mismatch test. Will pass if class name or underling type does not match the one specified.
boolean
assertNotA
(mixed $object, string $type, [string $message = '%s'])
-
mixed
$object: Object to test.
-
string
$type: Type name as string.
-
string
$message: Message to display.
Will trigger a pass if the two parameters have a different value. Otherwise a fail.
boolean
assertNotEqual
(mixed $first, mixed $second, [string $message = '%s'])
-
mixed
$first: Value to compare.
-
mixed
$second: Value to compare.
-
string
$message: Message to display.
Will trigger a pass if the two parameters have the different value or different type.
boolean
assertNotIdentical
(mixed $first, mixed $second, [string $message = '%s'])
-
mixed
$first: Value to compare.
-
mixed
$second: Value to compare.
-
string
$message: Message to display.
Will be true if the value is set.
boolean
assertNotNull
(mixed $value, [string $message = '%s'])
-
mixed
$value: Supposedly set value.
-
string
$message: Message to display.
Will be true if the value is null.
boolean
assertNull
(null $value, [string $message = '%s'])
-
null
$value: Supposedly null value.
-
string
$message: Message to display.
Will trigger a pass if the two parameters differ by more than the margin.
boolean
assertOutsideMargin
(mixed $first, mixed $second, mixed $margin, [string $message = '%s'])
-
mixed
$first: Value to compare.
-
mixed
$second: Value to compare.
-
mixed
$margin: Fuzziness of match.
-
string
$message: Message to display.
Will trigger a pass if the Perl regex pattern is found in the subject. Fail otherwise.
boolean
assertPattern
(string $pattern, string $subject, [string $message = '%s'])
-
string
$pattern: Perl regex to look for including the regex delimiters.
-
string
$subject: String to search in.
-
string
$message: Message to display.
Will trigger a pass if both parameters refer to the same object or value. Fail otherwise.
This will cause problems testing objects under E_STRICT. TODO: Replace with expectation.
boolean
assertReference
( &$first, &$second, [string $message = '%s'], mixed $first, mixed $second)
-
mixed
$first: Reference to check.
-
mixed
$second: Hopefully the same variable.
-
string
$message: Message to display.
-
&$first
-
&$second
Will trigger a pass if both parameters refer to the same object. Fail otherwise. This has the same semantics at the PHPUnit assertSame.
That is, if values are passed in it has roughly the same affect as assertIdentical. TODO: Replace with expectation.
boolean
assertSame
(mixed $first, mixed $second, [string $message = '%s'])
-
mixed
$first: Object reference to check.
-
mixed
$second: Hopefully the same object.
-
string
$message: Message to display.
Called from within the test methods to register passes and failures.
boolean
assertTrue
(boolean $result, [string $message = '%s'])
-
boolean
$result: Pass on true.
-
string
$message: Message to display describing the test state.
Will trigger a pass if the if the first parameter is near enough to the second by the margin.
boolean
assertWithinMargin
(mixed $first, mixed $second, mixed $margin, [string $message = '%s'])
-
mixed
$first: Value to compare.
-
mixed
$second: Value to compare.
-
mixed
$margin: Fuzziness of match.
-
string
$message: Message to display.
Creates an equality expectation if the object/value is not already some type of expectation.
-
mixed
$expected: Expected value.
Prepares for an error. If the error mismatches it passes through, otherwise it is swallowed. Any left over errors trigger failures.
void
expectError
([SimpleExpectation/string $expected = false], [string $message = '%s'])
-
SimpleExpectation/string
$expected: The error to match.
-
string
$message: Message on failure.
Prepares for an exception. If the error mismatches it passes through, otherwise it is swallowed. Any left over errors trigger failures.
void
expectException
([SimpleExpectation/Exception $expected = false], [string $message = '%s'])
-
SimpleExpectation/Exception
$expected: The error to match.
-
string
$message: Message on failure.
Tells SimpleTest to ignore an upcoming exception as not relevant to the current test. It doesn't affect the test, whether thrown or not.
void
ignoreException
([SimpleExpectation/Exception $ignored = false])
-
SimpleExpectation/Exception
$ignored: The error to ignore.
Inherited Methods
Inherited From SimpleTestCase
SimpleTestCase::__construct()
SimpleTestCase::after()
SimpleTestCase::assert()
SimpleTestCase::before()
SimpleTestCase::createInvoker()
SimpleTestCase::dump()
SimpleTestCase::error()
SimpleTestCase::exception()
SimpleTestCase::fail()
SimpleTestCase::getAssertionLine()
SimpleTestCase::getLabel()
SimpleTestCase::getSize()
SimpleTestCase::getTests()
SimpleTestCase::isTest()
SimpleTestCase::pass()
SimpleTestCase::run()
SimpleTestCase::setUp()
SimpleTestCase::shouldSkip()
SimpleTestCase::signal()
SimpleTestCase::skip()
SimpleTestCase::skipIf()
SimpleTestCase::skipUnless()
SimpleTestCase::tearDown()
SimpleTestCase::tell()