PHP Class SimpleFileLoader, simpletest

显示文件 Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
createSuiteFromClasses ( string $title, array $classes ) : TestSuite Builds a test suite from a class list.
load ( string $test_file ) : TestSuite Builds a test suite from a library of test cases.
selectRunnableTests ( array $candidates ) : array Calculates the incoming test cases. Skips abstract and ignored classes.

Protected Methods

Method Description
makeFileVariablesGlobal ( hash $existing, hash $new ) Imports new variables into the global namespace.
scrapeClassesFromFile ( string $file ) : string Lookup classnames from file contents, in case the file may have been included before.

Method Details

createSuiteFromClasses() public method

Builds a test suite from a class list.
public createSuiteFromClasses ( string $title, array $classes ) : TestSuite
$title string Title of new group.
$classes array Test classes.
return TestSuite Group loaded with the new test cases.

load() public method

The new suite is composed into this one.
public load ( string $test_file ) : TestSuite
$test_file string File name of library with test case classes.
return TestSuite The new test suite.

makeFileVariablesGlobal() protected method

Imports new variables into the global namespace.
protected makeFileVariablesGlobal ( hash $existing, hash $new )
$existing hash Variables before the file was loaded.
$new hash Variables after the file was loaded.

scrapeClassesFromFile() protected method

Note: This is probably too clever by half. Figuring this out after a failed test case is going to be tricky for us, never mind the user. A test case should not be included twice anyway.
protected scrapeClassesFromFile ( string $file ) : string
$file string Test File name with classes.
return string classnames

selectRunnableTests() public method

Calculates the incoming test cases. Skips abstract and ignored classes.
public selectRunnableTests ( array $candidates ) : array
$candidates array Candidate classes.
return array New classes which are test cases that shouldn't be ignored.