PHP 클래스 Psecio\Parse\Rule\RuleTestCase

상속: extends PHPUnit_Framework_TestCase
파일 보기 프로젝트 열기: psecio/parse

보호된 프로퍼티들

프로퍼티 타입 설명
$parser The parser to use to parse samples

공개 메소드들

메소드 설명
assertParseTest ( mixed $expected, string $code, string $message = '' ) Assert that running $test against $code results in $expected
assertParseTestFalse ( string $code, string $message = '' ) Assert that parsing $code with buildTest()'s Test returns false
assertParseTestTrue ( string $code, string $message = '' ) Assert that parsing $code with buildTest()'s Test returns true
parseSampleProvider ( ) : array PHPUnit provider to provide samples and results
setUp ( ) Set up the parser the same way the Scanner does
testDescription ( )
testLongDescription ( )
testParseSample ( ) Run the tests supplied by {@see parseSampleProvider()}

보호된 메소드들

메소드 설명
buildTest ( ) : Psecio\Parse\RuleInterface Method to create the test to evaluate
formatCodeForMessage ( string $code ) : string Format a code string so it displays nicely in an assertion message
scan ( string $code ) : boolean Scan PHP code and return the result

메소드 상세

assertParseTest() 공개 메소드

Note taht $message does not replace the message from the assertion, only augments it.
public assertParseTest ( mixed $expected, string $code, string $message = '' )
$expected mixed The expected result of the $test
$code string The PHP code to parse and evaulate
$message string Message to be displayed on failure

assertParseTestFalse() 공개 메소드

Assert that parsing $code with buildTest()'s Test returns false
public assertParseTestFalse ( string $code, string $message = '' )
$code string Code to test
$message string Message to display on failure

assertParseTestTrue() 공개 메소드

Assert that parsing $code with buildTest()'s Test returns true
public assertParseTestTrue ( string $code, string $message = '' )
$code string Code to test
$message string Message to display on failure

buildTest() 추상적인 보호된 메소드

This should return an instantiated object of the class that is being evaluated
abstract protected buildTest ( ) : Psecio\Parse\RuleInterface
리턴 Psecio\Parse\RuleInterface An object of the type being tested

formatCodeForMessage() 보호된 메소드

Prefixes each line of the code with " > ".
protected formatCodeForMessage ( string $code ) : string
$code string The code to format
리턴 string The formatted code

parseSampleProvider() 공개 메소드

This method provides a list of samples and expected results that this unit test should test against. The structure should be: [ ['valid php code', ], [ ... ], ... ] Note that the actual test method prefixes the sample code with '
public parseSampleProvider ( ) : array
리턴 array Lists of samples to test against

scan() 보호된 메소드

Scan PHP code and return the result
protected scan ( string $code ) : boolean
$code string The code to scan
리턴 boolean The results visiting all the nodes from the parsed $code

setUp() 공개 메소드

Set up the parser the same way the Scanner does
public setUp ( )

testDescription() 공개 메소드

public testDescription ( )

testLongDescription() 공개 메소드

public testLongDescription ( )

testParseSample() 공개 메소드

Run the tests supplied by {@see parseSampleProvider()}
public testParseSample ( )

프로퍼티 상세

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

The parser to use to parse samples
protected $parser