%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11585/cwd/html/water/vendor/codeception/codeception/src/Codeception/Test/Loader/ |
Upload File : |
<?php namespace Codeception\Test\Loader; use Codeception\Exception\TestParseException; use Codeception\Lib\Parser; use Codeception\Test\Cest as CestFormat; use Codeception\Util\Annotation; use Codeception\Util\ReflectionHelper; class Cest implements LoaderInterface { protected $tests = []; public function getTests() { return $this->tests; } public function getPattern() { return '~Cest\.php$~'; } public function loadTests($file) { Parser::load($file); $testClasses = Parser::getClassesFromFile($file); foreach ($testClasses as $testClass) { if (substr($testClass, -strlen('Cest')) !== 'Cest') { continue; } if (!(new \ReflectionClass($testClass))->isInstantiable()) { continue; } $unit = new $testClass; $methods = get_class_methods($testClass); foreach ($methods as $method) { if (strpos($method, '_') === 0) { continue; } $examples = []; // example Annotation $rawExamples = Annotation::forMethod($unit, $method)->fetchAll('example'); if (count($rawExamples)) { $examples = array_map( function ($v) { return Annotation::arrayValue($v); }, $rawExamples ); } // dataProvider Annotation $dataMethod = Annotation::forMethod($testClass, $method)->fetch('dataProvider'); // lowercase for back compatible if (empty($dataMethod)) { $dataMethod = Annotation::forMethod($testClass, $method)->fetch('dataprovider'); } if (!empty($dataMethod)) { try { $data = ReflectionHelper::invokePrivateMethod($unit, $dataMethod); foreach ($data as $example) { $examples[] = $example; } } catch (\ReflectionException $e) { throw new TestParseException( $file, "DataProvider '$dataMethod' for $testClass->$method is invalid or not callable.\n" . "Make sure that the dataprovider exist within the test class." ); } } if (count($examples)) { $dataProvider = new \PHPUnit\Framework\DataProviderTestSuite(); $index = 0; foreach ($examples as $k => $example) { if ($example === null) { throw new TestParseException( $file, "Example for $testClass->$method contains invalid data:\n" . $rawExamples[$k] . "\n" . "Make sure this is a valid JSON (Hint: \"-char for strings) or a single-line annotation in Doctrine-style" ); } $test = new CestFormat($unit, $method, $file); $test->getMetadata()->setCurrent(['example' => $example]); $test->getMetadata()->setIndex($index); $dataProvider->addTest($test); $index++; } $this->tests[] = $dataProvider; continue; } $this->tests[] = new CestFormat($unit, $method, $file); } } } }