mageekguy\atoum\runner::run PHP Метод

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

public run ( array $namespaces = [], array $tags = [], array $runTestClasses = [], array $runTestMethods = [], $testBaseClass = null )
$namespaces array
$tags array
$runTestClasses array
$runTestMethods array
    public function run(array $namespaces = array(), array $tags = array(), array $runTestClasses = array(), array $runTestMethods = array(), $testBaseClass = null)
    {
        $this->includeTestPaths();
        $this->testNumber = 0;
        $this->testMethodNumber = 0;
        $this->score->reset();
        $this->setPathAndVersionInScore();
        if ($this->defaultReportTitle !== null) {
            foreach ($this->reports as $report) {
                if ($report->getTitle() === null) {
                    $report->setTitle($this->defaultReportTitle);
                }
            }
        }
        $declaredTestClasses = $this->getDeclaredTestClasses($testBaseClass);
        if (sizeof($runTestClasses) <= 0) {
            $runTestClasses = $declaredTestClasses;
        } else {
            $runTestClasses = array_intersect($runTestClasses, $declaredTestClasses);
        }
        natsort($runTestClasses);
        $tests = array();
        foreach ($runTestClasses as $runTestClass) {
            $test = call_user_func($this->testFactory, $runTestClass);
            if ($test->isIgnored($namespaces, $tags) === false) {
                $testMethodNumber = sizeof($test->runTestMethods($runTestMethods, $tags));
                if ($testMethodNumber > 0) {
                    $tests[] = $test;
                    $test->addExtensions($this->extensions);
                    $this->testNumber++;
                    $this->testMethodNumber += $testMethodNumber;
                    $test->setPhpPath($this->php->getBinaryPath())->setAdapter($this->adapter)->setLocale($this->locale)->setBootstrapFile($this->bootstrapFile)->setAutoloaderFile($this->autoloaderFile);
                    if ($this->debugMode === true) {
                        $test->enableDebugMode();
                    }
                    $test->setXdebugConfig($this->xdebugConfig);
                    if ($this->maxChildrenNumber !== null) {
                        $test->setMaxChildrenNumber($this->maxChildrenNumber);
                    }
                    if ($this->codeCoverageIsEnabled() === false) {
                        $test->disableCodeCoverage();
                    } else {
                        if ($this->branchesAndPathsCoverageIsEnabled()) {
                            $test->enableBranchesAndPathsCoverage();
                        }
                        $test->getScore()->setCoverage($this->getCoverage());
                    }
                    foreach ($this->observers as $observer) {
                        $test->addObserver($observer);
                    }
                }
            }
        }
        $this->start = $this->adapter->microtime(true);
        $this->callObservers(self::runStart);
        foreach ($tests as $test) {
            $this->score->merge($test->run()->getScore());
        }
        $this->stop = $this->adapter->microtime(true);
        $this->callObservers(self::runStop);
        return $this->score;
    }

Usage Example

Пример #1
0
 public function testGetTestMethodNumber()
 {
     $this->if($adapter = new atoum\test\adapter())->and($adapter->get_declared_classes = array())->and($runner = new testedClass())->and($runner->setAdapter($adapter))->then->integer($runner->getTestMethodNumber())->isZero()->if($runner->run())->then->integer($runner->getTestMethodNumber())->isZero();
 }
All Usage Examples Of mageekguy\atoum\runner::run
runner