当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_Test::getGroups方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_Test::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Test::getGroups方法的具体用法?PHP PHPUnit_Framework_Test::getGroups怎么用?PHP PHPUnit_Framework_Test::getGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_Test的用法示例。


在下文中一共展示了PHPUnit_Framework_Test::getGroups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addTest

 /**
  * Adds a test to the suite.
  *
  * @param PHPUnit_Framework_Test $test
  * @param array                  $groups
  */
 public function addTest(PHPUnit_Framework_Test $test, $groups = [])
 {
     $class = new ReflectionClass($test);
     if (!$class->isAbstract()) {
         $this->tests[] = $test;
         $this->numTests = -1;
         if ($test instanceof self && empty($groups)) {
             $groups = $test->getGroups();
         }
         if (empty($groups)) {
             $groups = ['default'];
         }
         foreach ($groups as $group) {
             if (!isset($this->groups[$group])) {
                 $this->groups[$group] = [$test];
             } else {
                 $this->groups[$group][] = $test;
             }
         }
     }
 }
开发者ID:441420776,项目名称:phpunit,代码行数:27,代码来源:TestSuite.php

示例2: isOfInterest

 /**
  * @param PHPUnit_Framework_Test $test
  *
  * @return bool
  */
 private function isOfInterest(PHPUnit_Framework_Test $test)
 {
     if (!$test instanceof PHPUnit_Framework_TestCase) {
         return false;
     }
     if ($test instanceof PHPUnit_Framework_WarningTestCase) {
         return false;
     }
     if (!empty($this->groups)) {
         foreach ($test->getGroups() as $group) {
             if (in_array($group, $this->groups)) {
                 return true;
             }
         }
         return false;
     }
     if (!empty($this->excludeGroups)) {
         foreach ($test->getGroups() as $group) {
             if (in_array($group, $this->excludeGroups)) {
                 return false;
             }
         }
         return true;
     }
     return true;
 }
开发者ID:thanghexp,项目名称:project,代码行数:31,代码来源:ResultPrinter.php

示例3: addTest

 /**
  * Adds a test to the suite.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  array                  $groups
  */
 public function addTest(PHPUnit_Framework_Test $test, $groups = array())
 {
     $class = new ReflectionClass($test);
     if (!$class->isAbstract()) {
         $this->tests[] = $test;
         $this->numTests = -1;
         if ($test instanceof PHPUnit_Framework_TestSuite && empty($groups)) {
             $groups = $test->getGroups();
         }
         if (empty($groups)) {
             $groups = array('__nogroup__');
         }
         foreach ($groups as $group) {
             if (!isset($this->groups[$group])) {
                 $this->groups[$group] = array($test);
             } else {
                 $this->groups[$group][] = $test;
             }
         }
     }
 }
开发者ID:reflectivedevelopment,项目名称:jfh-lib,代码行数:27,代码来源:TestSuite.php

示例4: endTest

 /**
  * A test ended.
  *
  * @param PHPUnit_Framework_Test $test
  * @param float                  $time
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     if (!$test instanceof PHPUnit_Framework_TestCase) {
         return;
     }
     /* @var PHPUnit_Framework_TestCase $test */
     $groups = array_filter($test->getGroups(), function ($group) {
         if ($group == 'small' || $group == 'medium' || $group == 'large') {
             return false;
         }
         return true;
     });
     $node = $this->document->createElement('test');
     $node->setAttribute('className', get_class($test));
     $node->setAttribute('methodName', $test->getName());
     $node->setAttribute('prettifiedClassName', $this->prettifier->prettifyTestClass(get_class($test)));
     $node->setAttribute('prettifiedMethodName', $this->prettifier->prettifyTestMethod($test->getName()));
     $node->setAttribute('status', $test->getStatus());
     $node->setAttribute('time', $time);
     $node->setAttribute('size', $test->getSize());
     $node->setAttribute('groups', implode(',', $groups));
     $inlineAnnotations = PHPUnit_Util_Test::getInlineAnnotations(get_class($test), $test->getName());
     if (isset($inlineAnnotations['given']) && isset($inlineAnnotations['when']) && isset($inlineAnnotations['then'])) {
         $node->setAttribute('given', $inlineAnnotations['given']['value']);
         $node->setAttribute('givenStartLine', $inlineAnnotations['given']['line']);
         $node->setAttribute('when', $inlineAnnotations['when']['value']);
         $node->setAttribute('whenStartLine', $inlineAnnotations['when']['line']);
         $node->setAttribute('then', $inlineAnnotations['then']['value']);
         $node->setAttribute('thenStartLine', $inlineAnnotations['then']['line']);
     }
     if ($this->exception !== null) {
         if ($this->exception instanceof PHPUnit_Framework_Exception) {
             $steps = $this->exception->getSerializableTrace();
         } else {
             $steps = $this->exception->getTrace();
         }
         $class = new ReflectionClass($test);
         $file = $class->getFileName();
         foreach ($steps as $step) {
             if (isset($step['file']) && $step['file'] == $file) {
                 $node->setAttribute('exceptionLine', $step['line']);
                 break;
             }
         }
         $node->setAttribute('exceptionMessage', $this->exception->getMessage());
     }
     $this->root->appendChild($node);
 }
开发者ID:thanghexp,项目名称:project,代码行数:54,代码来源:XML.php


注:本文中的PHPUnit_Framework_Test::getGroups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。