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


PHP PHPUnit_Framework_TestSuite::isTestMethod方法代码示例

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


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

示例1: makeSuite

 protected static function makeSuite($className, $group = null)
 {
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->setName($className);
     $class = new ReflectionClass($className);
     foreach (self::$engineConfigurations as $engineName => $opts) {
         if ($group !== null && $group !== $engineName) {
             continue;
         }
         try {
             $parser = new Parser();
             $parser->startExternalParse(Title::newMainPage(), new ParserOptions(), Parser::OT_HTML, true);
             $engineClass = "Scribunto_{$engineName}Engine";
             $engine = new $engineClass(self::$engineConfigurations[$engineName] + array('parser' => $parser));
             $parser->scribunto_engine = $engine;
             $engine->setTitle($parser->getTitle());
             $engine->getInterpreter();
         } catch (Scribunto_LuaInterpreterNotFoundError $e) {
             $suite->addTest(new Scribunto_LuaEngineTestSkip($className, "interpreter for {$engineName} is not available"), array('Lua', $engineName));
             continue;
         }
         // Work around PHPUnit breakage: the only straightforward way to
         // get the data provider is to call
         // PHPUnit_Util_Test::getProvidedData, but that instantiates the
         // class without passing any parameters to the constructor. But we
         // *need* that engine name.
         self::$staticEngineName = $engineName;
         $engineSuite = new PHPUnit_Framework_TestSuite();
         $engineSuite->setName("{$engineName}: {$className}");
         foreach ($class->getMethods() as $method) {
             if (PHPUnit_Framework_TestSuite::isTestMethod($method) && $method->isPublic()) {
                 $name = $method->getName();
                 $groups = PHPUnit_Util_Test::getGroups($className, $name);
                 $groups[] = 'Lua';
                 $groups[] = $engineName;
                 $groups = array_unique($groups);
                 $data = PHPUnit_Util_Test::getProvidedData($className, $name);
                 if (is_array($data) || $data instanceof Iterator) {
                     // with @dataProvider
                     $dataSuite = new PHPUnit_Framework_TestSuite_DataProvider($className . '::' . $name);
                     foreach ($data as $k => $v) {
                         $dataSuite->addTest(new $className($name, $v, $k, $engineName), $groups);
                     }
                     $engineSuite->addTest($dataSuite);
                 } elseif ($data === false) {
                     // invalid @dataProvider
                     $engineSuite->addTest(new PHPUnit_Framework_Warning("The data provider specified for {$className}::{$name} is invalid."));
                 } else {
                     // no @dataProvider
                     $engineSuite->addTest(new $className($name, array(), '', $engineName), $groups);
                 }
             }
         }
         $suite->addTest($engineSuite);
     }
     return $suite;
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:57,代码来源:LuaEngineTestBase.php

示例2: createTestFromPhpUnitMethod

 protected function createTestFromPhpUnitMethod(\ReflectionClass $class, \ReflectionMethod $method)
 {
     if (!\PHPUnit_Framework_TestSuite::isTestMethod($method)) {
         return;
     }
     $test = \PHPUnit_Framework_TestSuite::createTest($class, $method->name);
     if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
         foreach ($test->tests() as $t) {
             $this->enhancePhpunitTest($t);
         }
         return $test;
     }
     $this->enhancePhpunitTest($test);
     return $test;
 }
开发者ID:neronmoon,项目名称:Codeception,代码行数:15,代码来源:Unit.php

示例3: suite

 public static function suite($className)
 {
     /** @var KmsCi_PHPUnit_TestCase_PhpWebdriverBrowsers $className */
     $suite = new PHPUnit_Framework_TestSuite();
     foreach ($className::$browsers as $browser) {
         $bsuite = new PHPUnit_Framework_TestSuite();
         $class = new ReflectionClass($className);
         $bsuite->setName($class->getName() . '_' . $className::getBrowserTestName($browser));
         foreach ($class->getMethods() as $method) {
             if (strpos($method->getDeclaringClass()->getName(), 'PHPUnit_') !== 0) {
                 if ($method->isPublic() && $bsuite->isTestMethod($method)) {
                     $name = $method->getName();
                     $test = new $className($name);
                     $test->browser = $browser;
                     $bsuite->addTest($test);
                 }
             }
         }
         $suite->addTest($bsuite);
     }
     return $suite;
 }
开发者ID:kaltura,项目名称:kms-ci-framework,代码行数:22,代码来源:PhpWebdriverBrowsers.php

示例4: createTestFromPhpUnitMethod

 protected function createTestFromPhpUnitMethod(\ReflectionClass $class, \ReflectionMethod $method)
 {
     if (!\PHPUnit_Framework_TestSuite::isTestMethod($method) and strpos($method->name, 'should') !== 0) {
         return;
     }
     $test = \PHPUnit_Framework_TestSuite::createTest($class, $method->name);
     if ($test instanceof TestCase\Test) {
         $test->setBootstrap($this->settings['bootstrap']);
         $test->setDispatcher($this->dispatcher);
         $test->setGuyClass($this->settings['class_name']);
         $groups = \PHPUnit_Util_Test::getGroups($class->name, $method->name);
         $test->getScenario()->groups($groups);
     } else {
         if ($this->settings['bootstrap']) {
             require_once $this->settings['bootstrap'];
         }
     }
     return $test;
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:19,代码来源:SuiteManager.php

示例5: createTestFromPhpUnitMethod

 /**
  * Creates test from PHPUnit method.
  *
  * @since 1.0.0
  *
  * @access protected
  * @param \ReflectionClass $class The class object.
  * @param \ReflectionMethod $method The method object.
  * @return \PHPUnit_Framework_Test The test object.
  */
 protected function createTestFromPhpUnitMethod(\ReflectionClass $class, \ReflectionMethod $method)
 {
     if (!\PHPUnit_Framework_TestSuite::isTestMethod($method)) {
         return;
     }
     $test = \PHPUnit_Framework_TestSuite::createTest($class, $method->name);
     if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
         foreach ($test->tests() as $t) {
             $this->enhancePhpunitTest($t);
         }
     } else {
         $this->enhancePhpunitTest($test);
     }
     $test->setBackupGlobals(false);
     $test->setBackupStaticAttributes(false);
     $test->setRunTestInSeparateProcess(false);
     $test->setInIsolation(false);
     $test->setPreserveGlobalState(false);
     return $test;
 }
开发者ID:gedex,项目名称:wp-codeception,代码行数:30,代码来源:TestLoader.php


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