PHPUnit_Framework_TestSuite PHP Class Code Examples

This page contains top rated real world PHP examples of class PHPUnit_Framework_TestSuite extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: BaseTestRunner.php Project: febryantosulistyo/ClassicSocial
0
 /**
  * Returns the Test corresponding to the given suite.
  * This is a template method, subclasses override
  * the runFailed() and clearStatus() methods.
  *
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @param  boolean $syntaxCheck
  * @return PHPUnit_Framework_Test
  */
 public function getTest($suiteClassName, $suiteClassFile = '', $syntaxCheck = FALSE)
 {
     if (is_dir($suiteClassName) && !is_file($suiteClassName . '.php') && empty($suiteClassFile)) {
         $testCollector = new PHPUnit_Runner_IncludePathTestCollector(array($suiteClassName));
         $suite = new PHPUnit_Framework_TestSuite($suiteClassName);
         $suite->addTestFiles($testCollector->collectTests(), $syntaxCheck);
         return $suite;
     }
     try {
         $testClass = $this->loadSuiteClass($suiteClassName, $suiteClassFile, $syntaxCheck);
     } catch (Exception $e) {
         $this->runFailed($e->getMessage());
         return NULL;
     }
     try {
         $suiteMethod = $testClass->getMethod(self::SUITE_METHODNAME);
         if (!$suiteMethod->isStatic()) {
             $this->runFailed('suite() method must be static.');
             return NULL;
         }
         try {
             $test = $suiteMethod->invoke(NULL, $testClass->getName());
         } catch (ReflectionException $e) {
             $this->runFailed(sprintf("Failed to invoke suite() method.\n%s", $e->getMessage()));
             return NULL;
         }
     } catch (ReflectionException $e) {
         $test = new PHPUnit_Framework_TestSuite($testClass);
     }
     $this->clearStatus();
     return $test;
 }
Example #2
Show file File: CakeHtmlReporter.php Project: dudasc/site-fescjj
0
 /**
  * A test suite started.
  *
  * @param PHPUnit_Framework_TestSuite $suite
  * @return void
  */
 public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
 {
     if (!$this->_headerSent) {
         echo $this->paintHeader();
     }
     echo '<h2>' . __d('cake_dev', 'Running  %s', $suite->getName()) . '</h2>';
 }
Example #3
Show file File: BaseTestRunner.php Project: dalinhuang/shopexts
0
 /**
  * Returns the Test corresponding to the given suite.
  * This is a template method, subclasses override
  * the runFailed() and clearStatus() methods.
  *
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @param  boolean $syntaxCheck
  * @return PHPUnit_Framework_Test
  * @access public
  */
 public function getTest($suiteClassName, $suiteClassFile = '', $syntaxCheck = TRUE)
 {
     if ($suiteClassFile == $suiteClassName . '.php') {
         $suiteClassFile = '';
     }
     try {
         $testClass = $this->loadSuiteClass($suiteClassName, $suiteClassFile, $syntaxCheck);
     } catch (Exception $e) {
         $this->runFailed($e->getMessage());
         return NULL;
     }
     try {
         $suiteMethod = $testClass->getMethod(self::SUITE_METHODNAME);
         if (!$suiteMethod->isStatic()) {
             $this->runFailed('suite() method must be static.');
             return NULL;
         }
         try {
             $test = $suiteMethod->invoke(NULL);
         } catch (ReflectionException $e) {
             $this->runFailed(sprintf("Failed to invoke suite() method.\n%s", $e->getMessage()));
             return NULL;
         }
     } catch (ReflectionException $e) {
         $test = new PHPUnit_Framework_TestSuite($testClass);
     }
     $this->clearStatus();
     return $test;
 }
Example #4
Show file File: AllTests.php Project: dalinhuang/shopexts
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('PHPUnit_Extensions_Database_Operation');
     $suite->addTestSuite('Extensions_Database_Operation_OperationsTest');
     $suite->addTestSuite('Extensions_Database_Operation_RowBasedTest');
     return $suite;
 }
Example #5
Show file File: TAP.php Project: SebFav/ApplicationInternet2
0
 /**
  * A testsuite ended.
  *
  * @param  PHPUnit_Framework_TestSuite $suite
  */
 public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
 {
     $this->testSuiteLevel--;
     if ($this->testSuiteLevel == 0) {
         $this->write(sprintf("1..%d\n", $this->testNumber));
     }
 }
Example #6
Show file File: AllTests.php Project: ingoratsdorf/Tine-2.0-Open-Source-Groupware-and-CRM
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('Tine 2.0 Voipmanager All Snom Backend Tests');
     $suite->addTestSuite('Voipmanager_Backend_Snom_PhoneTest');
     $suite->addTestSuite('Voipmanager_Backend_Snom_XmlTest');
     return $suite;
 }
Example #7
Show file File: AllTests.php Project: ingoratsdorf/Tine-2.0-Open-Source-Groupware-and-CRM
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('Tine 2.0 Addressbook All Import Tests');
     $suite->addTestSuite('Addressbook_Import_CsvTest');
     $suite->addTestSuite('Addressbook_Import_VCardTest');
     return $suite;
 }
Example #8
Show file File: AllTests.php Project: ingoratsdorf/Tine-2.0-Open-Source-Groupware-and-CRM
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('All tasks webdav frontend tests');
     $suite->addTestSuite('Tasks_Frontend_WebDAV_TaskTest');
     $suite->addTestSuite('Tasks_Frontend_WebDAV_ContainerTest');
     return $suite;
 }
Example #9
Show file File: AllTests.php Project: maximseshuk/lz77-kit
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('PHPUnit_Extensions_Database');
     $suite->addTest(Extensions_Database_Operation_AllTests::suite());
     $suite->addTest(Extensions_Database_DataSet_AllTests::suite());
     return $suite;
 }
Example #10
Show file File: Configuration.php Project: cjmi/miniblog
0
 /**
  * Returns the test suite configuration.
  *
  * @return PHPUnit_Framework_TestSuite
  * @since  Method available since Release 3.2.1
  */
 public function getTestSuiteConfiguration()
 {
     $testSuiteNode = $this->xpath->query('testsuite');
     if ($testSuiteNode->length > 0) {
         $testSuiteNode = $testSuiteNode->item(0);
         if ($testSuiteNode->hasAttribute('name')) {
             $suite = new PHPUnit_Framework_TestSuite((string) $testSuiteNode->getAttribute('name'));
         } else {
             $suite = new PHPUnit_Framework_TestSuite();
         }
         foreach ($this->xpath->query('testsuite/directory') as $directoryNode) {
             if ($directoryNode->hasAttribute('suffix')) {
                 $suffix = (string) $directoryNode->getAttribute('suffix');
             } else {
                 $suffix = 'Test.php';
             }
             $testCollector = new PHPUnit_Runner_IncludePathTestCollector(array((string) $directoryNode->nodeValue), $suffix);
             $suite->addTestFiles($testCollector->collectTests());
         }
         foreach ($this->xpath->query('testsuite/file') as $fileNode) {
             $suite->addTestFile((string) $fileNode->nodeValue);
         }
         return $suite;
     }
 }
Example #11
Show file File: AllTests.php Project: dalinhuang/shopexts
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('PHPUnit_Util');
     $suite->addTest(Util_TestDox_AllTests::suite());
     $suite->addTestSuite('Util_TimerTest');
     return $suite;
 }
Example #12
Show file File: TestSuite.php Project: RamaKavanan/InitialVersion
0
 public static function buildAndAddSuiteFromDirectory2($parentSuite, $name, $directoryName, $whatToTest)
 {
     assert('is_string($directoryName) && $directoryName != ""');
     if (is_dir($directoryName)) {
         $suite = new PHPUnit_Framework_TestSuite();
         $suite->setName(ucfirst($name) . ' Tests');
         $fileNames = scandir($directoryName);
         foreach ($fileNames as $fileName) {
             if (substr($fileName, strlen($fileName) - strlen('Test.php')) == 'Test.php') {
                 require_once "{$directoryName}/{$fileName}";
                 $className = substr($fileName, 0, strlen($fileName) - 4);
                 if (substr($className, strlen($className) - 8) != 'BaseTest') {
                     if ($whatToTest == 'All' || $whatToTest == 'Framework' && $name == 'Framework' || $whatToTest == 'Misc' && $name == 'Misc' || $whatToTest == 'BadDependencies' && $name == 'BadDependencies' || $whatToTest == $name || $whatToTest == $className) {
                         if (@class_exists($className, false)) {
                             $suite->addTestSuite(new PHPUnit_Framework_TestSuite($className));
                             static::resolveDependentTestModelClassNamesForClass($className, $directoryName);
                         }
                     }
                 }
             }
         }
         if ($suite->count() > 0) {
             $parentSuite->addTestSuite($suite);
         }
     }
 }
Example #13
Show file File: AllTestsTest.php Project: mrbadao/api-official
0
 /**
  * Suite define the tests for this suite
  *
  * @return void
  */
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('All Tests');
     $path = CORE_TEST_CASES . DS;
     $suite->addTestFile($path . 'BasicsTest.php');
     $suite->addTestFile($path . 'AllConsoleTest.php');
     $suite->addTestFile($path . 'AllBehaviorsTest.php');
     $suite->addTestFile($path . 'AllCacheTest.php');
     $suite->addTestFile($path . 'AllComponentsTest.php');
     $suite->addTestFile($path . 'AllConfigureTest.php');
     $suite->addTestFile($path . 'AllCoreTest.php');
     $suite->addTestFile($path . 'AllControllerTest.php');
     $suite->addTestFile($path . 'AllDatabaseTest.php');
     $suite->addTestFile($path . 'AllErrorTest.php');
     $suite->addTestFile($path . 'AllEventTest.php');
     $suite->addTestFile($path . 'AllHelpersTest.php');
     $suite->addTestFile($path . 'AllLogTest.php');
     $suite->addTestFile($path . 'Model' . DS . 'ModelTest.php');
     $suite->addTestFile($path . 'AllRoutingTest.php');
     $suite->addTestFile($path . 'AllNetworkTest.php');
     $suite->addTestFile($path . 'AllTestSuiteTest.php');
     $suite->addTestFile($path . 'AllUtilityTest.php');
     $suite->addTestFile($path . 'AllViewTest.php');
     $suite->addTestFile($path . 'AllI18nTest.php');
     return $suite;
 }
Example #14
Show file File: AllTests.php Project: shojibflamon/Bar-Code-example
0
 /**
  * Regular suite
  *
  * All tests except those that require output buffering.
  *
  * @return PHPUnit_Framework_TestSuite
  */
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('Zend Framework');
     $suite->addTest(Zend_AllTests::suite());
     $suite->addTest(resources_AllTests::suite());
     return $suite;
 }
Example #15
Show file File: StopOnWarningTestSuite.php Project: phecho/phpunit
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('Test Warnings');
     $suite->addTestSuite('NoTestCases');
     $suite->addTestSuite('CoverageClassTest');
     return $suite;
 }
Example #16
Show file File: LuaEngineTestBase.php Project: sammykumar/TheVRForums
0
 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;
 }
Example #17
Show file File: Configuration.php Project: febryantosulistyo/ClassicSocial
0
 /**
  * @param  DOMElement $testSuiteNode
  * @param  boolean    $syntaxCheck
  * @return PHPUnit_Framework_TestSuite
  * @since  Method available since Release 3.4.0
  */
 protected function getTestSuite(DOMElement $testSuiteNode, $syntaxCheck)
 {
     if ($testSuiteNode->hasAttribute('name')) {
         $suite = new PHPUnit_Framework_TestSuite((string) $testSuiteNode->getAttribute('name'));
     } else {
         $suite = new PHPUnit_Framework_TestSuite();
     }
     foreach ($testSuiteNode->getElementsByTagName('directory') as $directoryNode) {
         $directory = (string) $directoryNode->nodeValue;
         if (empty($directory)) {
             continue;
         }
         if ($directoryNode->hasAttribute('prefix')) {
             $prefix = (string) $directoryNode->getAttribute('prefix');
         } else {
             $prefix = '';
         }
         if ($directoryNode->hasAttribute('suffix')) {
             $suffix = (string) $directoryNode->getAttribute('suffix');
         } else {
             $suffix = 'Test.php';
         }
         $testCollector = new PHPUnit_Runner_IncludePathTestCollector(array($directory), $suffix, $prefix);
         $suite->addTestFiles($testCollector->collectTests(), $syntaxCheck);
     }
     foreach ($testSuiteNode->getElementsByTagName('file') as $fileNode) {
         $file = (string) $fileNode->nodeValue;
         if (empty($file)) {
             continue;
         }
         $suite->addTestFile($file, $syntaxCheck);
     }
     return $suite;
 }
Example #18
Show file File: ChildSuite.php Project: Ceciceciceci/MySJSU-Class-Registration
0
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('Child');
     $suite->addTestSuite('OneTest');
     $suite->addTestSuite('TwoTest');
     return $suite;
 }