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


PHP PHPUnit_Util_Fileloader::checkAndLoad方法代码示例

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


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

示例1: run

 /**
  * Run the runner.
  *
  * This will get a singleton instance of the class and configure
  * it according to the given configuration and any $_REQUEST
  * overriding parameters.
  *
  * It will configure it to use a {@link PHPUnit_Html_Printer} object
  * as the default output printer.
  *
  * @param   array       $arguments  configuration
  * @return  void
  */
 public static function run($arguments = array())
 {
     $_arguments = array('tpldir' => null, 'test' => null, 'testFile' => null, 'coverageClover' => null, 'coverageHtml' => null, 'filter' => null, 'groups' => null, 'excludeGroups' => null, 'processInsolation' => null, 'syntaxCheck' => false, 'stopOnError' => false, 'stopOnFailure' => false, 'stopOnIncomplete' => false, 'stopOnSkipped' => false, 'noGlobalsBackup' => true, 'staticBackup' => true, 'syntaxCheck' => false, 'bootstrap' => null, 'configuration' => null, 'noConfiguration' => false, 'strict' => false);
     $printer = new PHPUnit_Html_Printer($arguments['tpldir']);
     try {
         $arguments = $arguments ? array_merge($_arguments, array_intersect_key($arguments, $_arguments)) : $_arguments;
         $arguments['backupGlobals'] = !$arguments['noGlobalsBackup'];
         unset($arguments['noGlobalsBackup']);
         $arguments['backupStaticAttributes'] = !$arguments['staticBackup'];
         unset($arguments['staticBackup']);
         $arguments['useDefaultConfiguration'] = !$arguments['noConfiguration'];
         unset($arguments['noConfiguration']);
         if (isset($arguments['coverageHtml'])) {
             $arguments['reportDirectory'] = $arguments['coverageHtml'];
             unset($arguments['coverageHtml']);
         }
         if (!isset($arguments['test']) && !isset($arguments['testFile'])) {
             $arguments['test'] = getcwd();
         }
         $arguments['printer'] = $printer;
         $arguments['listeners'] = array(new PHPUnit_Util_DeprecatedFeature_Logger());
         if ($arguments['bootstrap']) {
             PHPUnit_Util_Fileloader::checkAndLoad($arguments['bootstrap'], $arguments['syntaxCheck']);
         }
         $runner = new PHPUnit_Html_TestRunner();
         $suite = $runner->getTest($arguments['test'], $arguments['testFile'], $arguments['syntaxCheck']);
         unset($arguments['test']);
         unset($arguments['testFile']);
         $result = $runner->doRun($suite, $arguments);
         $arguments['printer']->printResult($result);
     } catch (Exception $e) {
         $printer->printAborted($e);
     }
 }
开发者ID:phpgit,项目名称:PHPUnit_Html,代码行数:47,代码来源:PHPUnit_Html_TestRunner.php

示例2: handleBootstrap

 /**
  * Loads a bootstrap file.
  *
  * @param  string  $filename
  * @param  boolean $syntaxCheck
  * @see PHPUnit_TextUI_Command::handleBootstrap()
  * @since Method available since Release 2.16.0
  */
 protected function handleBootstrap($filename, $syntaxCheck = false)
 {
     try {
         PHPUnit_Util_Fileloader::checkAndLoad($filename, $syntaxCheck);
     } catch (RuntimeException $e) {
         PHPUnit_TextUI_TestRunner::showError($e->getMessage());
     }
 }
开发者ID:nojimage,项目名称:stagehand-testrunner,代码行数:16,代码来源:PHPUnitPreparator.php

示例3: load

 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @return ReflectionClass
  * @throws RuntimeException
  */
 public function load($suiteClassName, $suiteClassFile = '')
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     if (empty($suiteClassFile)) {
         $suiteClassFile = PHPUnit_Util_Filesystem::classNameToFilename($suiteClassName);
     }
     if (!class_exists($suiteClassName, FALSE)) {
         PHPUnit_Util_Class::collectStart();
         $filename = PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile);
         $loadedClasses = PHPUnit_Util_Class::collectEnd();
     }
     if (!class_exists($suiteClassName, FALSE) && !empty($loadedClasses)) {
         $offset = 0 - strlen($suiteClassName);
         foreach ($loadedClasses as $loadedClass) {
             $class = new ReflectionClass($loadedClass);
             if (substr($loadedClass, $offset) === $suiteClassName && $class->getFileName() == $filename) {
                 $suiteClassName = $loadedClass;
                 break;
             }
         }
     }
     if (!class_exists($suiteClassName, FALSE) && !empty($loadedClasses)) {
         $testCaseClass = 'PHPUnit_Framework_TestCase';
         foreach ($loadedClasses as $loadedClass) {
             $class = new ReflectionClass($loadedClass);
             $classFile = $class->getFileName();
             if ($class->isSubclassOf($testCaseClass) && !$class->isAbstract()) {
                 $suiteClassName = $loadedClass;
                 $testCaseClass = $loadedClass;
                 if ($classFile == realpath($suiteClassFile)) {
                     break;
                 }
             }
             if ($class->hasMethod('suite')) {
                 $method = $class->getMethod('suite');
                 if (!$method->isAbstract() && $method->isPublic() && $method->isStatic()) {
                     $suiteClassName = $loadedClass;
                     if ($classFile == realpath($suiteClassFile)) {
                         break;
                     }
                 }
             }
         }
     }
     if (class_exists($suiteClassName, FALSE)) {
         $class = new ReflectionClass($suiteClassName);
         $filePath = $GLOBALS['base_dir'] . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'phpunit' . DIRECTORY_SEPARATOR . $suiteClassFile;
         if ($class->getFileName() == realpath($filePath)) {
             return $class;
         }
     }
     throw new PHPUnit_Framework_Exception(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:59,代码来源:StandardTestSuiteLoader.php

示例4: load

 /**
  *
  * @param string $suiteClassName        	
  * @param string $suiteClassFile        	
  *
  * @return ReflectionClass
  *
  * @throws PHPUnit_Framework_Exception
  */
 public function load($suiteClassName, $suiteClassFile = '')
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     if (empty($suiteClassFile)) {
         $suiteClassFile = PHPUnit_Util_Filesystem::classNameToFilename($suiteClassName);
     }
     if (!class_exists($suiteClassName, false)) {
         $loadedClasses = get_declared_classes();
         $filename = PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile);
         $loadedClasses = array_values(array_diff(get_declared_classes(), $loadedClasses));
     }
     if (!class_exists($suiteClassName, false) && !empty($loadedClasses)) {
         $offset = 0 - strlen($suiteClassName);
         foreach ($loadedClasses as $loadedClass) {
             $class = new ReflectionClass($loadedClass);
             if (substr($loadedClass, $offset) === $suiteClassName && $class->getFileName() == $filename) {
                 $suiteClassName = $loadedClass;
                 break;
             }
         }
     }
     if (!class_exists($suiteClassName, false) && !empty($loadedClasses)) {
         $testCaseClass = 'PHPUnit_Framework_TestCase';
         foreach ($loadedClasses as $loadedClass) {
             $class = new ReflectionClass($loadedClass);
             $classFile = $class->getFileName();
             if ($class->isSubclassOf($testCaseClass) && !$class->isAbstract()) {
                 $suiteClassName = $loadedClass;
                 $testCaseClass = $loadedClass;
                 if ($classFile == realpath($suiteClassFile)) {
                     break;
                 }
             }
             if ($class->hasMethod('suite')) {
                 $method = $class->getMethod('suite');
                 if (!$method->isAbstract() && $method->isPublic() && $method->isStatic()) {
                     $suiteClassName = $loadedClass;
                     if ($classFile == realpath($suiteClassFile)) {
                         break;
                     }
                 }
             }
         }
     }
     if (class_exists($suiteClassName, false)) {
         $class = new ReflectionClass($suiteClassName);
         if ($class->getFileName() == realpath($suiteClassFile)) {
             return $class;
         }
     }
     throw new PHPUnit_Framework_Exception(sprintf("Class '%s' could not be found in '%s'.", $suiteClassName, $suiteClassFile));
 }
开发者ID:sapwoo,项目名称:portfolio,代码行数:61,代码来源:StandardTestSuiteLoader.php

示例5: handleBootstrap

 /**
  * Loads a bootstrap file.
  *
  * @param string $filename
  */
 protected function handleBootstrap($filename)
 {
     try {
         PHPUnit_Util_Fileloader::checkAndLoad($filename);
     } catch (PHPUnit_Framework_Exception $e) {
         PHPUnit_TextUI_TestRunner::showError($e->getMessage());
     }
 }
开发者ID:rtwo,项目名称:phpunit,代码行数:13,代码来源:Command.php

示例6: addTestFile

 /**
  * Wraps both <code>addTest()</code> and <code>addTestSuite</code>
  * as well as the separate import statements for the user's convenience.
  *
  * If the named file cannot be read or there are no new tests that can be
  * added, a <code>PHPUnit_Framework_Warning</code> will be created instead,
  * leaving the current test run untouched.
  *
  * @param  string  $filename
  * @param  boolean $syntaxCheck
  * @param  array   $phptOptions Array with ini settings for the php instance
  *                              run, key being the name if the setting,
  *                              value the ini value.
  * @throws InvalidArgumentException
  * @access public
  * @since  Method available since Release 2.3.0
  * @author Stefano F. Rausch <stefano@rausch-e.net>
  */
 public function addTestFile($filename, $syntaxCheck = TRUE, $phptOptions = array())
 {
     if (!is_string($filename)) {
         throw new InvalidArgumentException();
     }
     if (file_exists($filename) && substr($filename, -5) == '.phpt') {
         $this->addTest(new PHPUnit_Extensions_PhptTestCase($filename, $phptOptions));
         return;
     }
     if (!file_exists($filename)) {
         $includePaths = explode(PATH_SEPARATOR, get_include_path());
         foreach ($includePaths as $includePath) {
             $file = $includePath . DIRECTORY_SEPARATOR . $filename;
             if (file_exists($file)) {
                 $filename = $file;
                 break;
             }
         }
     }
     PHPUnit_Util_Class::collectStart();
     PHPUnit_Util_Fileloader::checkAndLoad($filename, $syntaxCheck);
     $newClasses = PHPUnit_Util_Class::collectEnd();
     $testsFound = FALSE;
     foreach ($newClasses as $className) {
         $class = new ReflectionClass($className);
         if (!$class->isAbstract()) {
             if ($class->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
                 $method = $class->getMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME);
                 if ($method->isStatic()) {
                     $this->addTest($method->invoke(NULL, $className));
                     $testsFound = TRUE;
                 }
             } else {
                 if ($class->implementsInterface('PHPUnit_Framework_Test')) {
                     $this->addTestSuite($class);
                     $testsFound = TRUE;
                 }
             }
         }
     }
     if (!$testsFound) {
         $this->addTest(new PHPUnit_Framework_Warning('No tests found in file "' . $filename . '".'));
     }
     $this->numTests = -1;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:63,代码来源:TestSuite.php

示例7: handleLoader

 /**
  * @param  string  $loaderName
  */
 protected static function handleLoader($loaderName)
 {
     if (!class_exists($loaderName, FALSE)) {
         PHPUnit_Util_Fileloader::checkAndLoad(str_replace('_', '/', $loaderName) . '.php');
     }
     if (class_exists($loaderName, FALSE)) {
         $class = new ReflectionClass($loaderName);
         if ($class->implementsInterface('PHPUnit_Runner_TestSuiteLoader') && $class->isInstantiable()) {
             $loader = $class->newInstance();
         }
     }
     if (!isset($loader)) {
         PHPUnit_TextUI_TestRunner::showError(sprintf('Could not use "%s" as loader.', $loaderName));
     }
     PHPUnit_TextUI_TestRunner::setLoader($loader);
 }
开发者ID:xiplias,项目名称:pails,代码行数:19,代码来源:Command.php

示例8: load

 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @param  boolean $syntaxCheck
  * @return ReflectionClass
  * @throws RuntimeException
  */
 public function load($suiteClassName, $suiteClassFile = '', $syntaxCheck = TRUE)
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     if (empty($suiteClassFile)) {
         $suiteClassFile = str_replace(array('_', '\\'), DIRECTORY_SEPARATOR, $suiteClassName) . '.php';
     }
     if (!class_exists($suiteClassName, FALSE)) {
         if (!file_exists($suiteClassFile)) {
             $includePaths = explode(PATH_SEPARATOR, get_include_path());
             foreach ($includePaths as $includePath) {
                 $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
                 if (file_exists($file)) {
                     $suiteClassFile = $file;
                     break;
                 }
             }
         }
         PHPUnit_Util_Class::collectStart();
         PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile, $syntaxCheck);
         $loadedClasses = PHPUnit_Util_Class::collectEnd();
     }
     if (!class_exists($suiteClassName, FALSE) && !empty($loadedClasses)) {
         $offset = 0 - strlen($suiteClassName);
         foreach ($loadedClasses as $loadedClass) {
             if (substr($loadedClass, $offset) === $suiteClassName) {
                 $suiteClassName = $loadedClass;
                 break;
             }
         }
     }
     if (!class_exists($suiteClassName, FALSE) && !empty($loadedClasses)) {
         $testCaseClass = 'PHPUnit_Framework_TestCase';
         foreach ($loadedClasses as $loadedClass) {
             $class = new ReflectionClass($loadedClass);
             if ($class->isSubclassOf($testCaseClass)) {
                 $suiteClassName = $loadedClass;
                 $testCaseClass = $loadedClass;
                 if ($class->getFileName() == realpath($suiteClassFile)) {
                     break;
                 }
             }
             if ($class->hasMethod('suite')) {
                 $method = $class->getMethod('suite');
                 if (!$method->isAbstract() && $method->isPublic() && $method->isStatic()) {
                     $suiteClassName = $loadedClass;
                     break;
                 }
             }
         }
     }
     if (class_exists($suiteClassName, FALSE)) {
         $class = new ReflectionClass($suiteClassName);
         if ($class->getFileName() == realpath($suiteClassFile)) {
             return $class;
         }
     }
     throw new RuntimeException(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
 }
开发者ID:kytvi2p,项目名称:ZettaFramework,代码行数:65,代码来源:StandardTestSuiteLoader.php

示例9: load

 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @return ReflectionClass
  * @throws RuntimeException
  * @access public
  */
 public function load($suiteClassName, $suiteClassFile = '')
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     $suiteClassFile = !empty($suiteClassFile) ? $suiteClassFile : str_replace('_', '/', $suiteClassName) . '.php';
     if (!class_exists($suiteClassName, FALSE)) {
         if (!file_exists($suiteClassFile)) {
             $includePaths = PHPUnit_Util_Fileloader::getIncludePaths();
             foreach ($includePaths as $includePath) {
                 $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
                 if (file_exists($file)) {
                     $suiteClassFile = $file;
                     break;
                 }
             }
         }
         PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile);
     }
     if (class_exists($suiteClassName, FALSE)) {
         return new ReflectionClass($suiteClassName);
     } else {
         throw new RuntimeException(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:30,代码来源:StandardTestSuiteLoader.php

示例10: load

 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @param  boolean $syntaxCheck
  * @return ReflectionClass
  * @throws RuntimeException
  */
 public function load($suiteClassName, $suiteClassFile = '', $syntaxCheck = TRUE)
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     if (empty($suiteClassFile)) {
         $suiteClassFile = str_replace(array('_', '::'), DIRECTORY_SEPARATOR, $suiteClassName) . '.php';
     }
     if (!class_exists($suiteClassName, FALSE)) {
         if (!file_exists($suiteClassFile)) {
             $includePaths = explode(PATH_SEPARATOR, get_include_path());
             foreach ($includePaths as $includePath) {
                 $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
                 if (file_exists($file)) {
                     $suiteClassFile = $file;
                     break;
                 }
             }
         }
         PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile, $syntaxCheck);
     }
     if (class_exists($suiteClassName, FALSE)) {
         return new ReflectionClass($suiteClassName);
     } else {
         throw new RuntimeException(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
     }
 }
开发者ID:maximseshuk,项目名称:lz77-kit,代码行数:32,代码来源:StandardTestSuiteLoader.php

示例11: addTestFile

 /**
  * Wraps both <code>addTest()</code> and <code>addTestSuite</code>
  * as well as the separate import statements for the user's convenience.
  *
  * If the named file cannot be read or there are no new tests that can be
  * added, a <code>PHPUnit_Framework_Warning</code> will be created instead,
  * leaving the current test run untouched.
  *
  * @param  string                      $filename
  * @param  array                       $phptOptions Array with ini settings for the php instance
  *                                                  run, key being the name if the setting,
  *                                                  value the ini value.
  * @throws PHPUnit_Framework_Exception
  * @since  Method available since Release 2.3.0
  * @author Stefano F. Rausch <stefano@rausch-e.net>
  */
 public function addTestFile($filename, $phptOptions = array())
 {
     if (!is_string($filename)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
     }
     if (file_exists($filename) && substr($filename, -5) == '.phpt') {
         $this->addTest(new PHPUnit_Extensions_PhptTestCase($filename, $phptOptions));
         return;
     }
     $classes = get_declared_classes();
     $filename = PHPUnit_Util_Fileloader::checkAndLoad($filename);
     $newClasses = array_diff(get_declared_classes(), $classes);
     foreach ($newClasses as $className) {
         $this->foundClasses[] = $className;
     }
     $baseName = str_replace('.php', '', basename($filename));
     end($this->foundClasses);
     while ($className = current($this->foundClasses)) {
         if (substr($className, 0 - strlen($baseName)) == $baseName) {
             $class = new ReflectionClass($className);
             if ($class->getFileName() == $filename) {
                 $newClasses = array($className);
                 unset($this->foundClasses[key($this->foundClasses)]);
                 break;
             }
         }
         prev($this->foundClasses);
     }
     foreach ($newClasses as $className) {
         $class = new ReflectionClass($className);
         if (!$class->isAbstract()) {
             if ($class->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
                 $method = $class->getMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME);
                 if ($method->isStatic()) {
                     $this->addTest($method->invoke(null, $className));
                 }
             } elseif ($class->implementsInterface('PHPUnit_Framework_Test')) {
                 $this->addTestSuite($class);
             }
         }
     }
     $this->numTests = -1;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:59,代码来源:TestSuite.php

示例12: collectTestsFromFile

 public static function collectTestsFromFile($filename)
 {
     PHPUnit_Util_Class::collectStart();
     PHPUnit_Util_Fileloader::checkAndLoad($filename, FALSE);
     $newClasses = PHPUnit_Util_Class::collectEnd();
     $baseName = str_replace('.php', '', basename($filename));
     foreach ($newClasses as $className) {
         if (substr($className, 0 - strlen($baseName)) == $baseName) {
             $newClasses = array($className);
             break;
         }
     }
     $tests = array();
     // of PHPUnit_Framework_Test
     foreach ($newClasses as $className) {
         $class = new ReflectionClass($className);
         if (!$class->isAbstract()) {
             if ($class->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
                 $method = $class->getMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME);
                 if ($method->isStatic()) {
                     $newTest = $method->invoke(NULL, $className);
                     // of type PHPUnit_Framework_Test
                     $tests[] = $newTest;
                 }
             } else {
                 if ($class->implementsInterface('PHPUnit_Framework_Test')) {
                     $tests[] = new PHPUnit_Framework_TestSuite($class);
                 }
             }
         }
     }
     return $tests;
 }
开发者ID:Aktubius,项目名称:Lesons_SAG,代码行数:33,代码来源:_intellij_phpunit_launcher.php

示例13: _suite

 protected static function _suite($alltests_class, $alltests_file, $sub_suite = null)
 {
     $suite_name = basename($alltests_class, "_AllTests");
     $readable_name = str_replace("_", " ", $suite_name);
     $suite = new PHPUnit_Framework_TestSuite($readable_name);
     $tests = self::_getTests(dirname($alltests_file));
     // trickery to get around the statics problem in php
     eval("\$disabled = " . $alltests_class . "::\$disabled;");
     eval("\$requires_config = " . $alltests_class . "::\$requires_config;");
     foreach ($tests as $test => $filename) {
         $test_file_path = dirname($alltests_file) . DIRECTORY_SEPARATOR . $filename;
         $test_class_name = $suite_name . "_" . $test;
         $test_class_config = ZFTestManager::getConfig($test_class_name);
         if (!is_null($sub_suite) && strpos($test, $sub_suite) === false) {
             continue;
         }
         // if test is disabled by default, and not turned on, continue
         if (in_array($test_class_name, $disabled) && $test_class_config['enabled'] != true) {
             continue;
         }
         // if test is not disabled by default, but is disabled in config, continue
         if (!in_array($test_class_name, $disabled) && $test_class_config['disabled'] == true) {
             continue;
         }
         if (in_array($test_class_name, $requires_config) && $test_class_config === null) {
             echo "Class {$test_class_name} is enabled, but requires config options to be set in TestConfiguration.ini.\n";
             echo "See {$test_file_path} for more details.\n";
             exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
         }
         PHPUnit_Util_Fileloader::checkAndLoad($test_file_path);
         try {
             $suite->addTestSuite($test_class_name);
         } catch (InvalidArgumentException $e) {
             echo "File for {$test_class_name} was loaded, but a class named {$test_class_name} was not found.\n";
             exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
         }
         //$suite->addTestFile($test_file_path);
     }
     return $suite;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:40,代码来源:ZFTestManager.php

示例14: addTestFile

 /**
  * Wraps both <code>addTest()</code> and <code>addTestSuite</code>
  * as well as the separate import statements for the user's convenience.
  *
  * If the named file cannot be read or there are no new tests that can be
  * added, a <code>PHPUnit_Framework_Warning</code> will be created instead,
  * leaving the current test run untouched.
  *
  * @param  string  $filename
  * @param  boolean $syntaxCheck
  * @param  array   $phptOptions Array with ini settings for the php instance
  *                              run, key being the name if the setting,
  *                              value the ini value.
  * @throws InvalidArgumentException
  * @since  Method available since Release 2.3.0
  * @author Stefano F. Rausch <stefano@rausch-e.net>
  */
 public function addTestFile($filename, $syntaxCheck = FALSE, $phptOptions = array())
 {
     if (!is_string($filename)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
     }
     if (file_exists($filename) && substr($filename, -5) == '.phpt') {
         $this->addTest(new PHPUnit_Extensions_PhptTestCase($filename, $phptOptions));
         return;
     }
     PHPUnit_Util_Class::collectStart();
     $filename = PHPUnit_Util_Fileloader::checkAndLoad($filename, $syntaxCheck);
     $newClasses = PHPUnit_Util_Class::collectEnd();
     $baseName = str_replace('.php', '', basename($filename));
     foreach ($newClasses as $className) {
         if (substr($className, 0 - strlen($baseName)) == $baseName) {
             $class = new ReflectionClass($className);
             if ($class->getFileName() == $filename) {
                 $newClasses = array($className);
                 break;
             }
         }
     }
     $testsFound = FALSE;
     foreach ($newClasses as $className) {
         $class = new ReflectionClass($className);
         if (!$class->isAbstract()) {
             if ($class->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
                 $method = $class->getMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME);
                 if ($method->isStatic()) {
                     $this->addTest($method->invoke(NULL, $className));
                     $testsFound = TRUE;
                 }
             } else {
                 if ($class->implementsInterface('PHPUnit_Framework_Test')) {
                     $this->addTestSuite($class);
                     $testsFound = TRUE;
                 }
             }
         }
     }
     $this->numTests = -1;
 }
开发者ID:reflectivedevelopment,项目名称:jfh-lib,代码行数:59,代码来源:TestSuite.php

示例15: loadFile

 /**
  * Include a file
  *
  * @param string $filename
  */
 public static function loadFile($filename)
 {
     PHPUnitFileLoader::checkAndLoad($filename);
 }
开发者ID:ockcyp,项目名称:covers-validator,代码行数:9,代码来源:FileLoader.php


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