| [ Index ] |
|
Code source de PRADO 3.0.6 |
[Code source] [Imprimer] [Statistiques]
Base include file for SimpleTest
| Version: | $Id: test_case.php 1526 2006-11-28 23:34:00Z wei $ |
| Poids: | 689 lignes (25 kb) |
| Inclus ou requis: | 0 fois |
| Référencé: | 0 fois |
| Nécessite: | 0 fichiers |
SimpleTestCase:: (25 méthodes):
SimpleTestCase()
getLabel()
createInvoker()
run()
getTests()
_isTest()
before()
setUp()
tearDown()
after()
tell()
pass()
fail()
error()
exception()
signal()
swallowErrors()
assert()
assertExpectation()
assertTrue()
assertFalse()
getAssertionLine()
dump()
sendMessage()
getSize()
GroupTest:: (15 méthodes):
GroupTest()
getLabel()
setLabel()
addTestCase()
addTestClass()
addTestFile()
_requireWithError()
_enableErrorReporting()
_disableErrorReporting()
_selectRunnableTests()
_createGroupFromClasses()
_getBaseTestCase()
collect()
run()
getSize()
BadGroupTest:: (4 méthodes):
BadGroupTest()
getLabel()
run()
getSize()
Classe: SimpleTestCase - X-Ref
Basic test case. This is the smallest unit of a test| SimpleTestCase($label = false) X-Ref |
| Sets up the test with no display. param: string $label If no test name is given then |
| getLabel() X-Ref |
| Accessor for the test name for subclasses. return: string Name of the test. |
| createInvoker() X-Ref |
| Used to invoke the single tests. return: SimpleInvoker Individual test runner. |
| run($reporter) X-Ref |
| Uses reflection to run every method within itself starting with the string "test" unless a method is specified. param: SimpleReporter $reporter Current test reporter. |
| getTests() X-Ref |
| Gets a list of test names. Normally that will be all internal methods that start with the name "test". This method should be overridden if you want a different rule. return: array List of test names. |
| _isTest($method) X-Ref |
| Tests to see if the method is a test that should be run. Currently any method that starts with 'test' is a candidate unless it is the constructor. param: string $method Method name to try. return: boolean True if test method. |
| before($method) X-Ref |
| Announces the start of the test. param: string $method Test method just started. |
| setUp() X-Ref |
| Sets up unit test wide variables at the start of each test method. To be overridden in actual user test cases. |
| tearDown() X-Ref |
| Clears the data set in the setUp() method call. To be overridden by the user in actual user test cases. |
| after($method) X-Ref |
| Announces the end of the test. Includes private clean up. param: string $method Test method just finished. |
| tell($observer) X-Ref |
| Sets up an observer for the test end. param: object $observer Must have atTestEnd() |
| pass($message = "Pass") X-Ref |
| Sends a pass event with a message. param: string $message Message to send. |
| fail($message = "Fail") X-Ref |
| Sends a fail event with a message. param: string $message Message to send. |
| error($severity, $message, $file, $line) X-Ref |
| Formats a PHP error and dispatches it to the reporter. param: integer $severity PHP error code. param: string $message Text of error. param: string $file File error occoured in. param: integer $line Line number of error. |
| exception($exception) X-Ref |
| Formats an exception and dispatches it to the reporter. param: Exception $exception Object thrown. |
| signal($type, $payload) X-Ref |
| Sends a user defined event to the test reporter. This is for small scale extension where both the test case and either the reporter or display are subclassed. param: string $type Type of event. param: mixed $payload Object or message to deliver. |
| swallowErrors() X-Ref |
| Cancels any outstanding errors. |
| assert($expectation, $compare, $message = '%s') X-Ref |
| Runs an expectation directly, for extending the tests with new expectation classes. param: SimpleExpectation $expectation Expectation subclass. param: mixed $compare Value to compare. param: string $message Message to display. return: boolean True on pass |
| assertExpectation($expectation, $compare, $message = '%s') X-Ref |
| assertTrue($result, $message = false) X-Ref |
| Called from within the test methods to register passes and failures. param: boolean $result Pass on true. param: string $message Message to display describing return: boolean True on pass |
| assertFalse($result, $message = false) X-Ref |
| 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. param: boolean $result Pass on false. param: string $message Message to display. return: boolean True on pass |
| getAssertionLine($stack = false) X-Ref |
| Uses a stack trace to find the line of an assertion. param: string $format String formatting. param: array $stack Stack frames top most first. Only return: string Line number of first assert* |
| dump($variable, $message = false) X-Ref |
| Sends a formatted dump of a variable to the test suite for those emergency debugging situations. param: mixed $variable Variable to display. param: string $message Message to display. return: mixed The original variable. |
| sendMessage($message) X-Ref |
| Dispatches a text message straight to the test suite. Useful for status bar displays. param: string $message Message to show. |
| getSize() X-Ref |
| Accessor for the number of subtests. return: integer Number of test cases. |
| GroupTest($label = false) X-Ref |
| Sets the name of the test suite. param: string $label Name sent at the start and end |
| getLabel() X-Ref |
| Accessor for the test name for subclasses. return: string Name of the test. |
| setLabel($value) X-Ref |
| Pas de description |
| addTestCase($test_case) X-Ref |
| Adds a test into the suite. Can be either a group test or some other unit test. param: SimpleTestCase $test_case Suite or individual test |
| addTestClass($class) X-Ref |
| Adds a test into the suite by class name. The class will be instantiated as needed. param: SimpleTestCase $test_case Suite or individual test |
| addTestFile($test_file) X-Ref |
| Builds a group test from a library of test cases. The new group is composed into this one. param: string $test_file File name of library with |
| _requireWithError($file) X-Ref |
| Requires a source file recording any syntax errors. param: string $file File name to require in. return: string/boolean An error message on failure or false |
| _enableErrorReporting() X-Ref |
| Sets up detection of parse errors. Note that XDebug interferes with this and has to be disabled. This is to make sure the correct error code is returned from unattended scripts. |
| _disableErrorReporting() X-Ref |
| Resets detection of parse errors to their old values. This is to make sure the correct error code is returned from unattended scripts. |
| _selectRunnableTests($existing_classes, $new_classes) X-Ref |
| Calculates the incoming test cases from a before and after list of loaded classes. Skips abstract classes. param: array $existing_classes Classes before require(). param: array $new_classes Classes after require(). return: array New classes which are test |
| _createGroupFromClasses($title, $classes) X-Ref |
| Builds a group test from a class list. param: string $title Title of new group. param: array $classes Test classes. return: GroupTest Group loaded with the new |
| _getBaseTestCase($class) X-Ref |
| Test to see if a class is derived from the SimpleTestCase class. param: string $class Class name. |
| collect($path, $collector) X-Ref |
| Delegates to a visiting collector to add test files. param: string $path Path to scan from. param: SimpleCollector $collector Directory scanner. |
| run($reporter) X-Ref |
| Invokes run() on all of the held test cases, instantiating them if necessary. param: SimpleReporter $reporter Current test reporter. |
| getSize() X-Ref |
| Number of contained test cases. return: integer Total count of cases in the group. |
Classe: BadGroupTest - X-Ref
This is a failing group test for when a test suite hasn't| BadGroupTest($label, $error) X-Ref |
| Sets the name of the test suite and error message. param: string $label Name sent at the start and end |
| getLabel() X-Ref |
| Accessor for the test name for subclasses. return: string Name of the test. |
| run($reporter) X-Ref |
| Sends a single error to the reporter. param: SimpleReporter $reporter Current test reporter. |
| getSize() X-Ref |
| Number of contained test cases. Always zero. return: integer Total count of cases in the group. |
| Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |