PHP 클래스 Tester\Assert

파일 보기 프로젝트 열기: nette/tester 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$counter the count of assertions
$onFailure function (AssertException $exception)
$patterns used by match(); in values, each $ followed by number is backreference

공개 메소드들

메소드 설명
contains ( $needle, $actual, $description = NULL ) : void Checks assertion. Values must contains expected needle.
count ( $count, $value, $description = NULL ) : void Checks if subject has expected count.
equal ( $expected, $actual, $description = NULL ) : void Checks assertion. The identity of objects and the order of keys in the arrays are ignored.
error ( callable $function, $expectedType, $expectedMessage = NULL ) : null | Exception Checks if the function generates PHP error or throws exception.
exception ( callable $function, $class, $message = NULL, $code = NULL ) : Exception Checks if the function throws exception.
expandMatchingPatterns ( $pattern, $actual ) : array
fail ( $message, $actual = NULL, $expected = NULL ) : void Failed assertion
false ( $actual, $description = NULL ) : void Checks FALSE assertion.
falsey ( $actual, $description = NULL ) : void Checks falsey (empty) assertion.
isMatching ( $pattern, $actual, $strict = FALSE ) : boolean Compares using mask.
match ( $pattern, $actual, $description = NULL ) : void Compares result using regular expression or mask: %a% one or more of anything except the end of line characters %a?% zero or more of anything except the end of line characters %A% one or more of anything including the end of line characters %A?% zero or more of anything including the end of line characters %s% one or more white space characters except the end of line characters %s?% zero or more white space characters except the end of line characters %S% one or more of characters except the white space %S?% zero or more of characters except the white space %c% a single character of any sort (except the end of line) %d% one or more digits %d?% zero or more digits %i% signed integer value %f% floating point number %h% one or more HEX digits
matchFile ( $file, $actual, $description = NULL ) : void Compares results using mask sorted in file.
nan ( $actual, $description = NULL ) : void Checks Not a Number assertion.
noError ( $function ) : void Checks that the function does not generate PHP error and does not throw exception.
notContains ( $needle, $actual, $description = NULL ) : void Checks assertion. Values must not contains expected needle.
notEqual ( $expected, $actual, $description = NULL ) : void Checks assertion. The identity of objects and the order of keys in the arrays are ignored.
notSame ( $expected, $actual, $description = NULL ) : void Checks assertion. Values must not be exactly the same.
null ( $actual, $description = NULL ) : void Checks NULL assertion.
same ( $expected, $actual, $description = NULL ) : void Checks assertion. Values must be exactly the same.
throws ( callable $function, $class, $message = NULL, $code = NULL ) : Exception Checks if the function throws exception, alias for exception().
true ( $actual, $description = NULL ) : void Checks TRUE assertion.
truthy ( $actual, $description = NULL ) : void Checks truthy assertion.
type ( $type, $value, $description = NULL ) : void Checks assertion.
with ( $obj, Closure $closure )

비공개 메소드들

메소드 설명
describe ( $reason, $description )
isEqual ( $expected, $actual, $level, $objects = NULL ) : boolean Compares two structures. Ignores the identity of objects and the order of keys in the arrays.
isPcre ( $pattern ) : boolean

메소드 상세

contains() 공개 정적인 메소드

Checks assertion. Values must contains expected needle.
public static contains ( $needle, $actual, $description = NULL ) : void
리턴 void

count() 공개 정적인 메소드

Checks if subject has expected count.
public static count ( $count, $value, $description = NULL ) : void
리턴 void

equal() 공개 정적인 메소드

Checks assertion. The identity of objects and the order of keys in the arrays are ignored.
public static equal ( $expected, $actual, $description = NULL ) : void
리턴 void

error() 공개 정적인 메소드

Checks if the function generates PHP error or throws exception.
public static error ( callable $function, $expectedType, $expectedMessage = NULL ) : null | Exception
$function callable
리턴 null | Exception

exception() 공개 정적인 메소드

Checks if the function throws exception.
public static exception ( callable $function, $class, $message = NULL, $code = NULL ) : Exception
$function callable
리턴 Exception

expandMatchingPatterns() 공개 정적인 메소드

public static expandMatchingPatterns ( $pattern, $actual ) : array
리턴 array

fail() 공개 정적인 메소드

Failed assertion
public static fail ( $message, $actual = NULL, $expected = NULL ) : void
리턴 void

false() 공개 정적인 메소드

Checks FALSE assertion.
public static false ( $actual, $description = NULL ) : void
리턴 void

falsey() 공개 정적인 메소드

Checks falsey (empty) assertion.
public static falsey ( $actual, $description = NULL ) : void
리턴 void

isMatching() 공개 정적인 메소드

Compares using mask.
public static isMatching ( $pattern, $actual, $strict = FALSE ) : boolean
리턴 boolean

match() 공개 정적인 메소드

Compares result using regular expression or mask: %a% one or more of anything except the end of line characters %a?% zero or more of anything except the end of line characters %A% one or more of anything including the end of line characters %A?% zero or more of anything including the end of line characters %s% one or more white space characters except the end of line characters %s?% zero or more white space characters except the end of line characters %S% one or more of characters except the white space %S?% zero or more of characters except the white space %c% a single character of any sort (except the end of line) %d% one or more digits %d?% zero or more digits %i% signed integer value %f% floating point number %h% one or more HEX digits
public static match ( $pattern, $actual, $description = NULL ) : void
리턴 void

matchFile() 공개 정적인 메소드

Compares results using mask sorted in file.
public static matchFile ( $file, $actual, $description = NULL ) : void
리턴 void

nan() 공개 정적인 메소드

Checks Not a Number assertion.
public static nan ( $actual, $description = NULL ) : void
리턴 void

noError() 공개 정적인 메소드

Checks that the function does not generate PHP error and does not throw exception.
public static noError ( $function ) : void
리턴 void

notContains() 공개 정적인 메소드

Checks assertion. Values must not contains expected needle.
public static notContains ( $needle, $actual, $description = NULL ) : void
리턴 void

notEqual() 공개 정적인 메소드

Checks assertion. The identity of objects and the order of keys in the arrays are ignored.
public static notEqual ( $expected, $actual, $description = NULL ) : void
리턴 void

notSame() 공개 정적인 메소드

Checks assertion. Values must not be exactly the same.
public static notSame ( $expected, $actual, $description = NULL ) : void
리턴 void

null() 공개 정적인 메소드

Checks NULL assertion.
public static null ( $actual, $description = NULL ) : void
리턴 void

same() 공개 정적인 메소드

Checks assertion. Values must be exactly the same.
public static same ( $expected, $actual, $description = NULL ) : void
리턴 void

throws() 공개 정적인 메소드

Checks if the function throws exception, alias for exception().
public static throws ( callable $function, $class, $message = NULL, $code = NULL ) : Exception
$function callable
리턴 Exception

true() 공개 정적인 메소드

Checks TRUE assertion.
public static true ( $actual, $description = NULL ) : void
리턴 void

truthy() 공개 정적인 메소드

Checks truthy assertion.
public static truthy ( $actual, $description = NULL ) : void
리턴 void

type() 공개 정적인 메소드

Checks assertion.
public static type ( $type, $value, $description = NULL ) : void
리턴 void

with() 공개 정적인 메소드

public static with ( $obj, Closure $closure )
$closure Closure

프로퍼티 상세

$counter 공개적으로 정적으로 프로퍼티

the count of assertions
public static $counter

$onFailure 공개적으로 정적으로 프로퍼티

function (AssertException $exception)
public static $onFailure

$patterns 공개적으로 정적으로 프로퍼티

used by match(); in values, each $ followed by number is backreference
public static $patterns