SimpleFileLoader::load PHP Метод

load() публичный Метод

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.
Результат TestSuite The new test suite.
    public function load($test_file)
    {
        $existing_classes = get_declared_classes();
        $existing_globals = get_defined_vars();
        include_once $test_file;
        $new_globals = get_defined_vars();
        $this->makeFileVariablesGlobal($existing_globals, $new_globals);
        $new_classes = array_diff(get_declared_classes(), $existing_classes);
        if (empty($new_classes)) {
            $new_classes = $this->scrapeClassesFromFile($test_file);
        }
        $classes = $this->selectRunnableTests($new_classes);
        return $this->createSuiteFromClasses($test_file, $classes);
    }

Usage Example

Пример #1
0
 /**
  *    Builds a test suite from a library of test cases.
  *    The new suite is composed into this one.
  *    @param string $test_file        File name of library with
  *                                    test case classes.
  *    @access public
  */
 function addFile($test_file) {
     $extractor = new SimpleFileLoader();
     $this->add($extractor->load($test_file));
 }