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


PHP PHPUnit_Framework_TestSuite::isPublicTestMethod方法代码示例

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


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

示例1: makeSuite

 protected static function makeSuite($className, $group = null)
 {
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->setName($className);
     $class = new ReflectionClass($className);
     $parser = new Parser();
     $parser->startExternalParse(Title::newMainPage(), new ParserOptions(), Parser::OT_HTML, true);
     foreach (self::$engineConfigurations as $engineName => $opts) {
         if ($group !== null && $group !== $engineName) {
             continue;
         }
         try {
             $engineClass = "Scribunto_{$engineName}Engine";
             $engine = new $engineClass(self::$engineConfigurations[$engineName] + array('parser' => $parser));
             $engine->setTitle($parser->getTitle());
             $engine->getInterpreter();
         } catch (Scribunto_LuaInterpreterNotFoundError $e) {
             $suite->addTest(new $className('skipUnavailable', array(), '', $engineName), 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::isPublicTestMethod($method)) {
                 $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:Tjorriemorrie,项目名称:app,代码行数:56,代码来源:LuaEngineTestBase.php

示例2: suite

 /**
  * @param  string $className
  * @return PHPUnit_Framework_TestSuite
  */
 public static function suite($className)
 {
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->setName($className);
     $class = new ReflectionClass($className);
     $classGroups = PHPUnit_Util_Test::getGroups($className);
     $staticProperties = $class->getStaticProperties();
     // Create tests from Selenese/HTML files.
     if (isset($staticProperties['seleneseDirectory']) && is_dir($staticProperties['seleneseDirectory'])) {
         $files = array_merge(self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.htm'), self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.html'));
         // Create tests from Selenese/HTML files for multiple browsers.
         if (!empty($staticProperties['browsers'])) {
             foreach ($staticProperties['browsers'] as $browser) {
                 $browserSuite = new PHPUnit_Framework_TestSuite();
                 $browserSuite->setName($className . ': ' . $browser['name']);
                 foreach ($files as $file) {
                     $browserSuite->addTest(new $className($file, array(), '', $browser), $classGroups);
                 }
                 $suite->addTest($browserSuite);
             }
         } else {
             foreach ($files as $file) {
                 $suite->addTest(new $className($file), $classGroups);
             }
         }
     }
     // Create tests from test methods for multiple browsers.
     if (!empty($staticProperties['browsers'])) {
         foreach ($staticProperties['browsers'] as $browser) {
             $browserSuite = new PHPUnit_Framework_TestSuite();
             $browserSuite->setName($className . ': ' . $browser['name']);
             foreach ($class->getMethods() as $method) {
                 if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                     $name = $method->getName();
                     $data = PHPUnit_Util_Test::getProvidedData($className, $name);
                     $groups = PHPUnit_Util_Test::getGroups($className, $name);
                     // Test method with @dataProvider.
                     if (is_array($data) || $data instanceof Iterator) {
                         $dataSuite = new PHPUnit_Framework_TestSuite_DataProvider($className . '::' . $name);
                         foreach ($data as $_dataName => $_data) {
                             $dataSuite->addTest(new $className($name, $_data, $_dataName, $browser), $groups);
                         }
                         $browserSuite->addTest($dataSuite);
                     } else {
                         if ($data === FALSE) {
                             $browserSuite->addTest(new PHPUnit_Framework_Warning(sprintf('The data provider specified for %s::%s is invalid.', $className, $name)));
                         } else {
                             $browserSuite->addTest(new $className($name, array(), '', $browser), $groups);
                         }
                     }
                 }
             }
             $suite->addTest($browserSuite);
         }
     } else {
         foreach ($class->getMethods() as $method) {
             if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                 $name = $method->getName();
                 $data = PHPUnit_Util_Test::getProvidedData($className, $name);
                 $groups = PHPUnit_Util_Test::getGroups($className, $name);
                 // Test method with @dataProvider.
                 if (is_array($data) || $data instanceof Iterator) {
                     $dataSuite = new PHPUnit_Framework_TestSuite_DataProvider($className . '::' . $name);
                     foreach ($data as $_dataName => $_data) {
                         $dataSuite->addTest(new $className($name, $_data, $_dataName), $groups);
                     }
                     $suite->addTest($dataSuite);
                 } else {
                     if ($data === FALSE) {
                         $suite->addTest(new PHPUnit_Framework_Warning(sprintf('The data provider specified for %s::%s is invalid.', $className, $name)));
                     } else {
                         $suite->addTest(new $className($name), $groups);
                     }
                 }
             }
         }
     }
     return $suite;
 }
开发者ID:ninodafonte,项目名称:SIFO,代码行数:83,代码来源:SeleniumTestCase.php

示例3: suite

 /**
  * @param  string $className
  * @return PHPUnit_Framework_TestSuite
  * @access public
  */
 public static function suite($className)
 {
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->setName($className);
     $class = new ReflectionClass($className);
     $classGroups = PHPUnit_Util_Test::getGroups($class);
     $staticProperties = $class->getStaticProperties();
     // Create tests from Selenese/HTML files.
     if (isset($staticProperties['seleneseDirectory']) && is_dir($staticProperties['seleneseDirectory'])) {
         $files = new PHPUnit_Util_FilterIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($staticProperties['seleneseDirectory'])), '.htm');
         // Create tests from Selenese/HTML files for multiple browsers.
         if (isset($staticProperties['browsers'])) {
             foreach ($staticProperties['browsers'] as $browser) {
                 $browserSuite = new PHPUnit_Framework_TestSuite();
                 $browserSuite->setName($className . ': ' . $browser['name']);
                 foreach ($files as $file) {
                     $browserSuite->addTest(new $className((string) $file, array(), $browser));
                 }
                 $suite->addTest($browserSuite, $classGroups);
             }
         } else {
             foreach ($files as $file) {
                 $suite->addTest(new $className((string) $file), $classGroups);
             }
         }
     }
     // Create tests from test methods for multiple browsers.
     if (isset($staticProperties['browsers'])) {
         foreach ($staticProperties['browsers'] as $browser) {
             $browserSuite = new PHPUnit_Framework_TestSuite();
             $browserSuite->setName($className . ': ' . $browser['name']);
             foreach ($class->getMethods() as $method) {
                 if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                     $name = $method->getName();
                     $data = PHPUnit_Util_Test::getProvidedData($className, $name);
                     $groups = PHPUnit_Util_Test::getGroups($method, $classGroups);
                     // Test method with @dataProvider.
                     if (is_array($data) || $data instanceof Iterator) {
                         $dataSuite = new PHPUnit_Framework_TestSuite($className . '::' . $name);
                         foreach ($data as $_data) {
                             $dataSuite->addTest(new $className($name, $_data, $browser), $groups);
                         }
                         $browserSuite->addTest($dataSuite);
                     } else {
                         $browserSuite->addTest(new $className($name, array(), $browser), $groups);
                     }
                 }
             }
             $suite->addTest($browserSuite);
         }
     } else {
         foreach ($class->getMethods() as $method) {
             if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                 $name = $method->getName();
                 $data = PHPUnit_Util_Test::getProvidedData($className, $name);
                 $groups = PHPUnit_Util_Test::getGroups($method, $classGroups);
                 // Test method with @dataProvider.
                 if (is_array($data) || $data instanceof Iterator) {
                     $dataSuite = new PHPUnit_Framework_TestSuite($className . '::' . $name);
                     foreach ($data as $_data) {
                         $dataSuite->addTest(new $className($name, $_data), $groups);
                     }
                     $suite->addTest($dataSuite);
                 } else {
                     $suite->addTest(new $className($name), $groups);
                 }
             }
         }
     }
     return $suite;
 }
开发者ID:humansky,项目名称:qframe,代码行数:76,代码来源:SeleniumTestCase.php

示例4: setLastTestNameInClass

 /**
  * Define name of last testcase in test class
  */
 private function setLastTestNameInClass()
 {
     $testMethods = array();
     $class = new ReflectionClass(self::$_testClass);
     foreach ($class->getMethods() as $method) {
         if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
             $testMethods[] = $method->getName();
         }
     }
     $testName = end($testMethods);
     $data = PHPUnit_Util_Test::getProvidedData(self::$_testClass, $testName);
     if ($data) {
         $testName .= sprintf(' with data set #%d', count($data) - 1);
     }
     self::$_lastTestNameInClass = $testName;
 }
开发者ID:venkateshcontus,项目名称:taf,代码行数:19,代码来源:TestCase.php

示例5: suite

 /**
  * @param  string $className
  * @return PHPUnit_Framework_TestSuite
  */
 public static function suite($className)
 {
     $suite = new PHPUnit_Extensions_SeleniumTestSuite();
     $suite->setName($className);
     $class = new ReflectionClass($className);
     $classGroups = PHPUnit_Util_Test::getGroups($className);
     $staticProperties = $class->getStaticProperties();
     // Create tests from Selenese/HTML files.
     if (isset($staticProperties['seleneseDirectory']) && is_dir($staticProperties['seleneseDirectory'])) {
         $files = array_merge(self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.htm'), self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.html'));
         // Create tests from Selenese/HTML files for multiple browsers.
         if (!empty($staticProperties['browsers'])) {
             foreach ($staticProperties['browsers'] as $browser) {
                 $browserSuite = new PHPUnit_Framework_TestSuite();
                 $browserSuite->setName($className . ': ' . $browser['name']);
                 foreach ($files as $file) {
                     self::addConfiguredTestTo($browserSuite, new $className($file, array(), '', $browser), $classGroups);
                 }
                 $suite->addTest($browserSuite);
             }
         } else {
             foreach ($files as $file) {
                 self::addConfiguredTestTo($suite, new $className($file), $classGroups);
             }
         }
     }
     // Create tests from test methods for multiple browsers.
     if (!empty($staticProperties['browsers'])) {
         foreach ($staticProperties['browsers'] as $browser) {
             $browserSuite = new PHPUnit_Framework_TestSuite();
             $browserSuite->setName($className . ': ' . $browser['name']);
             foreach ($class->getMethods() as $method) {
                 if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                     $name = $method->getName();
                     $test = PHPUnit_Framework_TestSuite::createTest($class, $name);
                     if ($test instanceof PHPUnit_Framework_TestCase) {
                         $test->setupSpecificBrowser($browser);
                         $groups = PHPUnit_Util_Test::getGroups($className, $name);
                         self::addConfiguredTestTo($browserSuite, $test, $groups);
                     } else {
                         $browserSuite->addTest($test);
                     }
                 }
             }
             $suite->addTest($browserSuite);
         }
     } else {
         foreach ($class->getMethods() as $method) {
             if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                 $name = $method->getName();
                 $test = PHPUnit_Framework_TestSuite::createTest($class, $name);
                 if ($test instanceof PHPUnit_Framework_TestCase) {
                     $groups = PHPUnit_Util_Test::getGroups($className, $name);
                     self::addConfiguredTestTo($suite, $test, $groups);
                 } else {
                     $suite->addTest($test);
                 }
             }
         }
     }
     return $suite;
 }
开发者ID:robinhood-zz,项目名称:phpunit-selenium,代码行数:66,代码来源:SeleniumTestCase.php

示例6: suite

 /**
  * @param  string $className
  * @return PHPUnit_Framework_TestSuite
  */
 public static function suite($className)
 {
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->setName($className);
     $class = new ReflectionClass($className);
     $classGroups = PHPUnit_Util_Test::getGroups($className);
     $staticProperties = $class->getStaticProperties();
     if (defined('XLITE_TEST_BROWSERS_LIST')) {
         $staticProperties['browsers'] = unserialize(XLITE_TEST_BROWSERS_LIST);
     }
     // Leave only one browser in deployment mode
     if (defined('DEPLOYMENT_TEST') && !empty($staticProperties['browsers'])) {
         $_browsers = array();
         foreach ($staticProperties['browsers'] as $key => $value) {
             $_browsers[$key] = $value;
             break;
         }
         $staticProperties['browsers'] = $_browsers;
     }
     // Create tests from Selenese/HTML files.
     if (isset($staticProperties['seleneseDirectory']) && is_dir($staticProperties['seleneseDirectory'])) {
         $files = array_merge(self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.htm'), self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.html'));
         // Create tests from Selenese/HTML files for multiple browsers.
         if (!empty($staticProperties['browsers'])) {
             foreach ($staticProperties['browsers'] as $browser) {
                 $browserSuite = new PHPUnit_Framework_TestSuite();
                 $browserSuite->setName($className . ': ' . $browser['name']);
                 foreach ($files as $file) {
                     $browserSuite->addTest(new $className($file, array(), '', $browser), $classGroups);
                 }
                 $suite->addTest($browserSuite);
             }
         } else {
             foreach ($files as $file) {
                 $suite->addTest(new $className($file), $classGroups);
             }
         }
     }
     // Create tests from test methods for multiple browsers.
     if (!empty($staticProperties['browsers'])) {
         foreach ($staticProperties['browsers'] as $browser) {
             if (defined('NO_RESTORE')) {
                 $browserSuite = new PHPUnit_Framework_TestSuite();
             } else {
                 $browserSuite = new XLite_Tests_TestSuite();
             }
             $browserSuite->setName($className . ': ' . $browser['name']);
             foreach ($class->getMethods() as $method) {
                 if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                     $name = $method->getName();
                     $data = PHPUnit_Util_Test::getProvidedData($className, $name);
                     $groups = PHPUnit_Util_Test::getGroups($className, $name);
                     // Test method with @dataProvider.
                     if (is_array($data) || $data instanceof Iterator) {
                         $dataSuite = new PHPUnit_Framework_TestSuite_DataProvider($className . '::' . $name);
                         foreach ($data as $_dataName => $_data) {
                             $dataSuite->addTest(new $className($name, $_data, $_dataName, $browser), $groups);
                         }
                         $browserSuite->addTest($dataSuite);
                     } else {
                         if ($data === FALSE) {
                             $browserSuite->addTest(new PHPUnit_Framework_Warning(sprintf('The data provider specified for %s::%s is invalid.', $className, $name)));
                         } else {
                             $browserSuite->addTest(new $className($name, array(), '', $browser), $groups);
                         }
                     }
                 }
             }
             $suite->addTest($browserSuite);
         }
     } else {
         foreach ($class->getMethods() as $method) {
             if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
                 $name = $method->getName();
                 $data = PHPUnit_Util_Test::getProvidedData($className, $name);
                 $groups = PHPUnit_Util_Test::getGroups($className, $name);
                 // Test method with @dataProvider.
                 if (is_array($data) || $data instanceof Iterator) {
                     $dataSuite = new PHPUnit_Framework_TestSuite_DataProvider($className . '::' . $name);
                     foreach ($data as $_dataName => $_data) {
                         $dataSuite->addTest(new $className($name, $_data, $_dataName), $groups);
                     }
                     $suite->addTest($dataSuite);
                 } else {
                     if ($data === FALSE) {
                         $suite->addTest(new PHPUnit_Framework_Warning(sprintf('The data provider specified for %s::%s is invalid.', $className, $name)));
                     } else {
                         $suite->addTest(new $className($name), $groups);
                     }
                 }
             }
         }
     }
     return $suite;
 }
开发者ID:kingsj,项目名称:core,代码行数:99,代码来源:SeleniumTestCase.php


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