PHP 클래스 SimpleTestCase, simpletest

@package SimpleTest
파일 보기 프로젝트 열기: simpletest/simpletest 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$reporter

공개 메소드들

메소드 설명
__construct ( string $label = false ) Sets up the test with no display.
after ( string $method ) Announces the end of the test. Includes private clean up.
assert ( SimpleExpectation $expectation, mixed $compare, string $message = '%s' ) : boolean Runs an expectation directly, for extending the tests with new expectation classes.
before ( string $method ) Announces the start of the test.
createInvoker ( ) : SimpleInvoker Used to invoke the single tests.
dump ( mixed $variable, string $message = false ) : mixed Sends a formatted dump of a variable to the test suite for those emergency debugging situations.
error ( integer $severity, string $message, string $file, integer $line ) Formats a PHP error and dispatches it to the reporter.
exception ( Exception $exception ) Formats an exception and dispatches it to the reporter.
fail ( string $message = 'Fail' ) Sends a fail event with a message.
getAssertionLine ( ) : string Uses a stack trace to find the line of an assertion.
getLabel ( ) : string Accessor for the test name for subclasses.
getSize ( ) : integer Accessor for the number of subtests including myelf.
getTests ( ) : array 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.
pass ( $message = 'Pass' )
run ( SimpleReporter $reporter ) : boolean Uses reflection to run every method within itself starting with the string "test" unless a method is specified.
setUp ( ) Sets up unit test wide variables at the start of each test method.
shouldSkip ( ) Accessor for the private variable $_shoud_skip
signal ( string $type, mixed $payload ) For user defined expansion of the available messages.
skip ( ) This is a placeholder for skipping tests.
skipIf ( string $should_skip, string $message = '%s' ) Will issue a message to the reporter and tell the test case to skip if the incoming flag is true.
skipUnless ( string $shouldnt_skip, string $message = false ) Will issue a message to the reporter and tell the test case to skip if the incoming flag is false.
tearDown ( ) Clears the data set in the setUp() method call.
tell ( object $observer ) Sets up an observer for the test end.

보호된 메소드들

메소드 설명
escapePercentageSignsExceptFirst ( string $string ) : string Escapes all percentage signs, except the first.
isTest ( string $method ) : boolean Tests to see if the method is a test that should be run.

메소드 상세

__construct() 공개 메소드

Sets up the test with no display.
public __construct ( string $label = false )
$label string If no test name is given then the class name is used.

after() 공개 메소드

Announces the end of the test. Includes private clean up.
public after ( string $method )
$method string Test method just finished.

assert() 공개 메소드

Runs an expectation directly, for extending the tests with new expectation classes.
public assert ( SimpleExpectation $expectation, mixed $compare, string $message = '%s' ) : boolean
$expectation SimpleExpectation Expectation subclass.
$compare mixed Value to compare.
$message string Message to display.
리턴 boolean True on pass

before() 공개 메소드

Announces the start of the test.
public before ( string $method )
$method string Test method just started.

createInvoker() 공개 메소드

Used to invoke the single tests.
public createInvoker ( ) : SimpleInvoker
리턴 SimpleInvoker Individual test runner.

dump() 공개 메소드

Sends a formatted dump of a variable to the test suite for those emergency debugging situations.
public dump ( mixed $variable, string $message = false ) : mixed
$variable mixed Variable to display.
$message string Message to display. *
리턴 mixed The original variable.

error() 공개 메소드

Formats a PHP error and dispatches it to the reporter.
public error ( integer $severity, string $message, string $file, integer $line )
$severity integer PHP error code.
$message string Text of error.
$file string File error occoured in.
$line integer Line number of error.

escapePercentageSignsExceptFirst() 보호된 메소드

Get the position of the first percentage sign. Skip over escaping, if none is found. Else escape part of string after first percentage sign. Then concat unescaped first part and escaped part.
protected escapePercentageSignsExceptFirst ( string $string ) : string
$string string
리턴 string

exception() 공개 메소드

Formats an exception and dispatches it to the reporter.
public exception ( Exception $exception )
$exception Exception Object thrown.

fail() 공개 메소드

Sends a fail event with a message.
public fail ( string $message = 'Fail' )
$message string Message to send.

getAssertionLine() 공개 메소드

Uses a stack trace to find the line of an assertion.
public getAssertionLine ( ) : string
리턴 string Line number of first assert method embedded in format string.

getLabel() 공개 메소드

Accessor for the test name for subclasses.
public getLabel ( ) : string
리턴 string Name of the test.

getSize() 공개 메소드

Accessor for the number of subtests including myelf.
public getSize ( ) : integer
리턴 integer Number of test cases.

getTests() 공개 메소드

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.
public getTests ( ) : array
리턴 array List of test names.

isTest() 보호된 메소드

Currently any method that starts with 'test' is a candidate unless it is the constructor.
protected isTest ( string $method ) : boolean
$method string Method name to try.
리턴 boolean True if test method.

pass() 공개 메소드

사용 중단:
public pass ( $message = 'Pass' )

run() 공개 메소드

Uses reflection to run every method within itself starting with the string "test" unless a method is specified.
public run ( SimpleReporter $reporter ) : boolean
$reporter SimpleReporter Current test reporter.
리턴 boolean True if all tests passed.

setUp() 공개 메소드

To be overridden in actual user test cases.
public setUp ( )

shouldSkip() 공개 메소드

Accessor for the private variable $_shoud_skip
public shouldSkip ( )

signal() 공개 메소드

For user defined expansion of the available messages.
public signal ( string $type, mixed $payload )
$type string Tag for sorting the signals.
$payload mixed Extra user specific information.

skip() 공개 메소드

In this method you place skipIf() and skipUnless() calls to set the skipping state.
public skip ( )

skipIf() 공개 메소드

Will issue a message to the reporter and tell the test case to skip if the incoming flag is true.
public skipIf ( string $should_skip, string $message = '%s' )
$should_skip string Condition causing the tests to be skipped.
$message string Text of skip condition.

skipUnless() 공개 메소드

Will issue a message to the reporter and tell the test case to skip if the incoming flag is false.
public skipUnless ( string $shouldnt_skip, string $message = false )
$shouldnt_skip string Condition causing the tests to be run.
$message string Text of skip condition.

tearDown() 공개 메소드

To be overridden by the user in actual user test cases.
public tearDown ( )

tell() 공개 메소드

Sets up an observer for the test end.
public tell ( object $observer )
$observer object Must have atTestEnd() method.

프로퍼티 상세

$reporter 보호되어 있는 프로퍼티

protected $reporter