Exemple #1
0
 protected function createTestFromCestMethod($cestInstance, $methodName, $file)
 {
     if (strpos($methodName, '_') === 0 or $methodName == '__construct') {
         return null;
     }
     $testClass = get_class($cestInstance);
     $cest = new Cest();
     $cest->configName($methodName)->configFile($file)->config('testClassInstance', $cestInstance)->config('testMethod', $methodName)->initConfig();
     $cest->getScenario()->env(Annotation::forMethod($testClass, $methodName)->fetchAll('env'));
     $cest->setDependencies(\PHPUnit_Util_Test::getDependencies($testClass, $methodName));
     return $cest;
 }
 protected function createTestFromCestMethod($cestInstance, $methodName, $file, $guy)
 {
     $testClass = get_class($cestInstance);
     if (strpos($methodName, '_') === 0) {
         return;
     }
     $overriddenGuy = Annotation::forMethod($testClass, $methodName)->fetch('guy');
     if (!$overriddenGuy) {
         $overriddenGuy = Annotation::forClass($testClass)->fetch('guy');
     }
     if ($overriddenGuy) {
         $guy = $overriddenGuy;
     }
     $cest = new TestCase\Cest($this->dispatcher, array('name' => $methodName, 'instance' => $cestInstance, 'method' => $methodName, 'file' => $file, 'bootstrap' => $this->settings['bootstrap'], 'guy' => $guy));
     $cest->getScenario()->env(Annotation::forMethod($testClass, $methodName)->fetchAll('env'));
     $cest->getScenario()->groups(\PHPUnit_Util_Test::getGroups($testClass, $methodName));
     $cest->setDependencies(\PHPUnit_Util_Test::getDependencies($testClass, $methodName));
     $cest->preload();
     return $cest;
 }