%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\Lib\Parser; use Codeception\Test\Descriptor; use Codeception\Test\Unit as UnitFormat; use Codeception\Util\Annotation; class Unit implements LoaderInterface { protected $tests = []; public function getPattern() { return '~Test\.php$~'; } public function loadTests($path) { Parser::load($path); $testClasses = Parser::getClassesFromFile($path); foreach ($testClasses as $testClass) { $reflected = new \ReflectionClass($testClass); if (!$reflected->isInstantiable()) { continue; } foreach ($reflected->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { $test = $this->createTestFromPhpUnitMethod($reflected, $method); if (!$test) { continue; } $this->tests[] = $test; } } } public function getTests() { return $this->tests; } protected function createTestFromPhpUnitMethod(\ReflectionClass $class, \ReflectionMethod $method) { if (method_exists(\PHPUnit\Framework\TestSuite::class, 'isTestMethod')) { //PHPUnit <8.2 if (!\PHPUnit\Framework\TestSuite::isTestMethod($method)) { return; } $test = \PHPUnit\Framework\TestSuite::createTest($class, $method->name); } elseif (method_exists(\PHPUnit\Util\Test::class, 'isTestMethod')) { //PHPUnit >=8.2 if (!\PHPUnit\Util\Test::isTestMethod($method)) { return; } $test = (new \PHPUnit\Framework\TestBuilder)->build($class, $method->name); } else { throw new \Exception('Unsupported version of PHPUnit, where is isTestMethod method?'); } if ($test instanceof \PHPUnit\Framework\DataProviderTestSuite) { foreach ($test->tests() as $t) { $this->enhancePhpunitTest($t); } return $test; } $this->enhancePhpunitTest($test); return $test; } protected function enhancePhpunitTest(\PHPUnit\Framework\Test $test) { $className = get_class($test); $methodName = $test->getName(false); $dependencies = \PHPUnit\Util\Test::getDependencies($className, $methodName); $test->setDependencies($dependencies); if ($test instanceof UnitFormat) { $test->getMetadata()->setParamsFromAnnotations(Annotation::forMethod($test, $methodName)->raw()); $test->getMetadata()->setFilename(Descriptor::getTestFileName($test)); } } }