UnitTestCase Class Reference

Inheritance diagram for UnitTestCase:
[legend]
Collaboration diagram for UnitTestCase:
[legend]

List of all members.


Public Member Functions

 UnitTestCase ($label=false)
 assertTrue ($result, $message=FALSE, $group= 'Other')
 assertFalse ($result, $message= '%s', $group= 'Other')
 assertNull ($value, $message= '%s', $group= 'Other')
 assertNotNull ($value, $message= '%s', $group= 'Other')
 assertEqual ($first, $second, $message= '%s', $group= 'Other')
 assertNotEqual ($first, $second, $message= '%s', $group= 'Other')
 assertIdentical ($first, $second, $message= '%s', $group= 'Other')
 assertNotIdentical ($first, $second, $message= '%s', $group= 'Other')
 assertPattern ($pattern, $subject, $message= '%s', $group= 'Other')
 assertNoPattern ($pattern, $subject, $message= '%s', $group= 'Other')


Detailed Description

Standard unit test class for day to day testing of PHP code XP style. Adds some useful standard assertions.

Definition at line 9 of file unit_tester.php.


Member Function Documentation

UnitTestCase::UnitTestCase ( label = false  ) 

Creates an empty test case. Should be subclassed with test methods for a functional test case.

Parameters:
string $label Name of test case. Will use the class name if none specified. public

Definition at line 18 of file unit_tester.php.

References SimpleTestCase::SimpleTestCase().

Here is the call graph for this function:

UnitTestCase::assertTrue ( result,
message = FALSE,
group = 'Other' 
)

UnitTestCase::assertFalse ( result,
message = '%s',
group = 'Other' 
)

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.

Parameters:
boolean $result Pass on false.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 48 of file unit_tester.php.

References $result, and assertTrue().

Referenced by DrupalWebTestCase::assertNoFieldByXPath(), assertNoPattern(), DrupalWebTestCase::assertNoPattern(), and DrupalWebTestCase::assertRaw().

Here is the call graph for this function:

UnitTestCase::assertNull ( value,
message = '%s',
group = 'Other' 
)

Will be true if the value is null.

Parameters:
null $value Supposedly null value.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 61 of file unit_tester.php.

References $value, and assertTrue().

Here is the call graph for this function:

UnitTestCase::assertNotNull ( value,
message = '%s',
group = 'Other' 
)

Will be true if the value is set.

Parameters:
mixed $value Supposedly set value.
string $message Message to display.
Returns:
boolean True on pass. public

Definition at line 74 of file unit_tester.php.

References $value, and assertTrue().

Here is the call graph for this function:

UnitTestCase::assertEqual ( first,
second,
message = '%s',
group = 'Other' 
)

Will trigger a pass if the two parameters have the same value only. Otherwise a fail.

Parameters:
mixed $first Value to compare.
mixed $second Value to compare.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 89 of file unit_tester.php.

References assertTrue().

Here is the call graph for this function:

UnitTestCase::assertNotEqual ( first,
second,
message = '%s',
group = 'Other' 
)

Will trigger a pass if the two parameters have a different value. Otherwise a fail.

Parameters:
mixed $first Value to compare.
mixed $second Value to compare.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 104 of file unit_tester.php.

References assertTrue().

Here is the call graph for this function:

UnitTestCase::assertIdentical ( first,
second,
message = '%s',
group = 'Other' 
)

Will trigger a pass if the two parameters have the same value and same type. Otherwise a fail.

Parameters:
mixed $first Value to compare.
mixed $second Value to compare.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 119 of file unit_tester.php.

References assertTrue().

Here is the call graph for this function:

UnitTestCase::assertNotIdentical ( first,
second,
message = '%s',
group = 'Other' 
)

Will trigger a pass if the two parameters have the different value or different type.

Parameters:
mixed $first Value to compare.
mixed $second Value to compare.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 134 of file unit_tester.php.

References assertTrue().

Here is the call graph for this function:

UnitTestCase::assertPattern ( pattern,
subject,
message = '%s',
group = 'Other' 
)

Will trigger a pass if the Perl regex pattern is found in the subject. Fail otherwise.

Parameters:
string $pattern Perl regex to look for including the regex delimiters.
string $subject String to search in.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 150 of file unit_tester.php.

References assertTrue().

Here is the call graph for this function:

UnitTestCase::assertNoPattern ( pattern,
subject,
message = '%s',
group = 'Other' 
)

Will trigger a pass if the perl regex pattern is not present in subject. Fail if found.

Parameters:
string $pattern Perl regex to look for including the regex delimiters.
string $subject String to search in.
string $message Message to display.
Returns:
boolean True on pass public

Definition at line 172 of file unit_tester.php.

References assertFalse().

Here is the call graph for this function:


The documentation for this class was generated from the following file:

Generated on Mon Jun 2 15:09:17 2008 for SimpleTest by  1.5.5