[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/lib/simpletest/ -> test_case.php (summary)

Base include file for SimpleTest

Version: $Id: test_case.php 5999 2007-06-18 13:13:08Z pachanga $
File Size: 669 lines (24 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 6 classes

SimpleTestCase:: (25 methods):
  SimpleTestCase()
  getLabel()
  skip()
  skipIf()
  skipUnless()
  createInvoker()
  run()
  getTests()
  _isTest()
  before()
  setUp()
  tearDown()
  after()
  tell()
  pass()
  fail()
  error()
  exception()
  signal()
  assert()
  assertExpectation()
  getAssertionLine()
  dump()
  sendMessage()
  getSize()

SimpleFileLoader:: (3 methods):
  load()
  selectRunnableTests()
  createSuiteFromClasses()

TestSuite:: (11 methods):
  TestSuite()
  getLabel()
  addTestCase()
  addTestClass()
  add()
  addTestFile()
  addFile()
  collect()
  run()
  getSize()
  getBaseTestCase()

GroupTest:: (0 methods):

BadTestSuite:: (4 methods):
  BadTestSuite()
  getLabel()
  run()
  getSize()

BadGroupTest:: (0 methods):


Class: SimpleTestCase  - X-Ref

Basic test case. This is the smallest unit of a test
suite. It searches for
all methods that start with the the string "test" and
runs them. Working test cases extend this class.

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.

skip()   X-Ref
This is a placeholder for skipping tests. In this
method you place skipIf() and skipUnless() calls to
set the skipping state.


skipIf($should_skip, $message = '%s')   X-Ref
Will issue a message to the reporter and tell the test
case to skip if the incoming flag is true.

param: string $should_skip    Condition causing the tests to be skipped.
param: string $message        Text of skip condition.

skipUnless($shouldnt_skip, $message = false)   X-Ref
Will issue a message to the reporter and tell the test
case to skip if the incoming flag is false.

param: string $shouldnt_skip  Condition causing the tests to be run.
param: string $message        Text of skip condition.

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.
return: boolean                    True if all tests passed.

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


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


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


getAssertionLine()   X-Ref
Uses a stack trace to find the line of an assertion.

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


getSize()   X-Ref
Accessor for the number of subtests.

return: integer           Number of test cases.

Class: SimpleFileLoader  - X-Ref

Helps to extract test cases automatically from a file.

load($test_file)   X-Ref
Builds a test suite from a library of test cases.
The new suite is composed into this one.

param: string $test_file        File name of library with
return: TestSuite               The new test suite.

selectRunnableTests($candidates)   X-Ref
Calculates the incoming test cases. Skips abstract
and ignored classes.

param: array $candidates   Candidate classes.
return: array              New classes which are test

createSuiteFromClasses($title, $classes)   X-Ref
Builds a test suite from a class list.

param: string $title       Title of new group.
param: array $classes      Test classes.
return: TestSuite          Group loaded with the new

Class: TestSuite  - X-Ref

This is a composite test class for combining
test cases and other RunnableTest classes into
a group test.

TestSuite($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. If the suite
wraps a single test case the label defaults to the name of that test.

return: string           Name of the test.

addTestCase(&$test_case)   X-Ref


addTestClass($class)   X-Ref


add(&$test_case)   X-Ref
Adds a test into the suite by instance or class. The class will
be instantiated if it's a test suite.

param: SimpleTestCase $test_case  Suite or individual test

addTestFile($test_file)   X-Ref


addFile($test_file)   X-Ref
Builds a test suite from a library of test cases.
The new suite is composed into this one.

param: string $test_file        File name of library with

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.

getBaseTestCase($class)   X-Ref
Test to see if a class is derived from the
SimpleTestCase class.

param: string $class     Class name.

Class: GroupTest  - X-Ref


Class: BadTestSuite  - X-Ref

This is a failing group test for when a test suite hasn't
loaded properly.

BadTestSuite($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.

Class: BadGroupTest  - X-Ref




Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7