コード例 #1
0
 public function testGroupsByDifferentPattern()
 {
     $this->manager = new GroupManager(['g_*' => 'tests/data/group_*']);
     $test1 = $this->makeTestCase('tests/UserTest.php');
     $test2 = $this->makeTestCase('tests/PostTest.php');
     $this->assertContains('g_1', $this->manager->groupsForTest($test1));
     $this->assertContains('g_2', $this->manager->groupsForTest($test2));
 }
コード例 #2
0
 public function testGroupsFileHandlesWhitespace()
 {
     $this->manager = new GroupManager(['whitespace_group_test' => 'tests/data/whitespace_group_test']);
     $goodTest = $this->makeTestCase('tests/WhitespaceTest.php');
     $badTest = $this->makeTestCase('');
     $this->assertContains('whitespace_group_test', $this->manager->groupsForTest($goodTest));
     $this->assertEmpty($this->manager->groupsForTest($badTest));
 }
コード例 #3
0
 protected function addToSuite($test)
 {
     if ($test instanceof TestCase\Interfaces\Configurable) {
         $test->configDispatcher($this->dispatcher);
         $test->configActor($this->getActor());
         $test->configEnv($this->env);
     }
     if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
         foreach ($test->tests() as $t) {
             if (!$t instanceof TestCase\Interfaces\Configurable) {
                 continue;
             }
             $t->configDispatcher($this->dispatcher);
             $t->configActor($this->getActor());
             $t->configEnv($this->env);
         }
     }
     if ($test instanceof TestCase\Interfaces\ScenarioDriven) {
         if (!$this->isCurrentEnvironment($test->getScenario()->getEnv())) {
             return;
         }
         $test->preload();
     }
     $groups = $this->groupManager->groupsForTest($test);
     $this->suite->addTest($test, $groups);
     if (!empty($groups) && $test instanceof TestCase\Interfaces\ScenarioDriven && null !== $test->getScenario()) {
         $test->getScenario()->group($groups);
     }
 }
コード例 #4
0
 protected function addToSuite($test)
 {
     $this->configureTest($test);
     if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
         foreach ($test->tests() as $t) {
             $this->configureTest($t);
         }
     }
     if ($test instanceof TestInterface) {
         $this->checkEnvironmentExists($test);
         if (!$this->isExecutedInCurrentEnvironment($test)) {
             return;
             // skip tests from other environments
         }
     }
     $groups = $this->groupManager->groupsForTest($test);
     // registering group for data providers
     if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
         $groupDetails = [];
         foreach ($groups as $group) {
             $groupDetails[$group] = $test->getGroupDetails()['default'];
         }
         $test->setGroupDetails($groupDetails);
     }
     $this->suite->addTest($test, $groups);
     if (!empty($groups) && $test instanceof TestInterface) {
         $test->getMetadata()->setGroups($groups);
     }
 }
コード例 #5
0
ファイル: SuiteManager.php プロジェクト: Dossar/boltbse
 protected function addToSuite($test)
 {
     $this->configureTest($test);
     if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
         foreach ($test->tests() as $t) {
             $this->configureTest($t);
         }
     }
     if ($test instanceof TestCase) {
         if (!$this->isCurrentEnvironment($test->getEnvironment())) {
             return;
             // skip tests from other environments
         }
     }
     if ($test instanceof ScenarioDriven) {
         $test->preload();
     }
     $groups = $this->groupManager->groupsForTest($test);
     $this->suite->addTest($test, $groups);
     if (!empty($groups) && $test instanceof TestCase\Interfaces\ScenarioDriven && null !== $test->getScenario()) {
         $test->getScenario()->group($groups);
     }
 }
コード例 #6
0
 protected function addToSuite($test)
 {
     $this->configureTest($test);
     if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
         foreach ($test->tests() as $t) {
             $this->configureTest($t);
         }
     }
     if ($test instanceof ScenarioDriven) {
         $test->preload();
     }
     if ($test instanceof TestInterface) {
         $this->checkEnvironmentExists($test);
         if (!$this->isExecutedInCurrentEnvironment($test)) {
             return;
             // skip tests from other environments
         }
     }
     $groups = $this->groupManager->groupsForTest($test);
     $this->suite->addTest($test, $groups);
     if (!empty($groups) && $test instanceof TestInterface) {
         $test->getMetadata()->setGroups($groups);
     }
 }