PHP 클래스 ShellTestCase, simpletest

상속: extends SimpleTestCase
파일 보기 프로젝트 열기: simpletest/simpletest 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $label = false ) Creates an empty test case.
assertEqual ( mixed $first, mixed $second, string $message = '%s' ) : boolean Will trigger a pass if the two parameters have the same value only.
assertExitCode ( integer $status, string $message = '%s' ) : boolean Tests the last status code from the shell.
assertFalse ( boolean $result, string $message = '%s' ) : boolean Will be true on false and vice versa.
assertFileExists ( string $path, string $message = '%s' ) : boolean File existence check.
assertFileNotExists ( string $path, string $message = '%s' ) : boolean File non-existence check.
assertFilePattern ( string $pattern, string $path, string $message = '%s' ) : boolean Scans a file for a Perl regex. If found anywhere it passes, else it fails.
assertNoFilePattern ( string $pattern, string $path, string $message = '%s' ) : boolean If a Perl regex is found anywhere in the named file then a failure is generated, else a pass.
assertNoOutputPattern ( string $pattern, $message = '%s' ) : boolean If a Perl regex is found anywhere in the current output then a failure is generated, else a pass.
assertNotEqual ( mixed $first, mixed $second, string $message = '%s' ) : boolean Will trigger a pass if the two parameters have a different value.
assertOutput ( string $expected, string $message = '%s' ) : boolean Attempt to exactly match the combined STDERR and STDOUT output.
assertOutputPattern ( string $pattern, string $message = '%s' ) : boolean Scans the output for a Perl regex. If found anywhere it passes, else it fails.
assertTrue ( boolean $result, string $message = false ) : boolean Called from within the test methods to register passes and failures.
dumpOutput ( ) Dumps the output of the last command.
execute ( string $command ) : boolean Executes a command and buffers the results.
getOutput ( ) : string Accessor for the last output.
getOutputAsList ( ) : array Accessor for the last output.

보호된 메소드들

메소드 설명
createShell ( ) : SimpleShell Factory for the shell to run the command on.
getShell ( ) : SimpleShell Accessor for current shell. Used for testing the the tester itself.

메소드 상세

__construct() 공개 메소드

Should be subclassed with test methods for a functional test case.
public __construct ( string $label = false )
$label string Name of test case. Will use the class name if none specified.

assertEqual() 공개 메소드

This is for testing hand extracted text, etc.
public assertEqual ( mixed $first, mixed $second, string $message = '%s' ) : boolean
$first mixed Value to compare.
$second mixed Value to compare.
$message string Message to display.
리턴 boolean True on pass, Otherwise a fail.

assertExitCode() 공개 메소드

Tests the last status code from the shell.
public assertExitCode ( integer $status, string $message = '%s' ) : boolean
$status integer Expected status of last command.
$message string Message to display.
리턴 boolean True if pass.

assertFalse() 공개 메소드

False is the PHP definition of false, so that null, empty strings, zero and an empty array all count as false.
public assertFalse ( boolean $result, string $message = '%s' ) : boolean
$result boolean Pass on false.
$message string Message to display.
리턴 boolean True on pass

assertFileExists() 공개 메소드

File existence check.
public assertFileExists ( string $path, string $message = '%s' ) : boolean
$path string Full filename and path.
$message string Message to display.
리턴 boolean True if pass.

assertFileNotExists() 공개 메소드

File non-existence check.
public assertFileNotExists ( string $path, string $message = '%s' ) : boolean
$path string Full filename and path.
$message string Message to display.
리턴 boolean True if pass.

assertFilePattern() 공개 메소드

Scans a file for a Perl regex. If found anywhere it passes, else it fails.
public assertFilePattern ( string $pattern, string $path, string $message = '%s' ) : boolean
$pattern string Regex to search for.
$path string Full filename and path.
$message string Message to display.
리턴 boolean True if pass.

assertNoFilePattern() 공개 메소드

If a Perl regex is found anywhere in the named file then a failure is generated, else a pass.
public assertNoFilePattern ( string $pattern, string $path, string $message = '%s' ) : boolean
$pattern string Regex to search for.
$path string Full filename and path.
$message string Message to display.
리턴 boolean True if pass.

assertNoOutputPattern() 공개 메소드

If a Perl regex is found anywhere in the current output then a failure is generated, else a pass.
public assertNoOutputPattern ( string $pattern, $message = '%s' ) : boolean
$pattern string Regex to search for.
$message Message to display.
리턴 boolean True if pass.

assertNotEqual() 공개 메소드

This is for testing hand extracted text, etc.
public assertNotEqual ( mixed $first, mixed $second, string $message = '%s' ) : boolean
$first mixed Value to compare.
$second mixed Value to compare.
$message string Message to display.
리턴 boolean True on pass, Otherwise a fail.

assertOutput() 공개 메소드

Attempt to exactly match the combined STDERR and STDOUT output.
public assertOutput ( string $expected, string $message = '%s' ) : boolean
$expected string Expected output.
$message string Message to display.
리턴 boolean True if pass.

assertOutputPattern() 공개 메소드

Scans the output for a Perl regex. If found anywhere it passes, else it fails.
public assertOutputPattern ( string $pattern, string $message = '%s' ) : boolean
$pattern string Regex to search for.
$message string Message to display.
리턴 boolean True if pass.

assertTrue() 공개 메소드

Called from within the test methods to register passes and failures.
public assertTrue ( boolean $result, string $message = false ) : boolean
$result boolean Pass on true.
$message string Message to display describing the test state.
리턴 boolean True on pass

createShell() 보호된 메소드

Factory for the shell to run the command on.
protected createShell ( ) : SimpleShell
리턴 SimpleShell New shell object.

dumpOutput() 공개 메소드

Dumps the output of the last command.
public dumpOutput ( )

execute() 공개 메소드

Executes a command and buffers the results.
public execute ( string $command ) : boolean
$command string Command to run.
리턴 boolean True if zero exit code.

getOutput() 공개 메소드

Accessor for the last output.
public getOutput ( ) : string
리턴 string Output as text.

getOutputAsList() 공개 메소드

Accessor for the last output.
public getOutputAsList ( ) : array
리턴 array Output as array of lines.

getShell() 보호된 메소드

Accessor for current shell. Used for testing the the tester itself.
protected getShell ( ) : SimpleShell
리턴 SimpleShell Current shell.