當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PHPUnit_TextUI_TestRunner類代碼示例

本文整理匯總了PHP中PHPUnit_TextUI_TestRunner的典型用法代碼示例。如果您正苦於以下問題:PHP PHPUnit_TextUI_TestRunner類的具體用法?PHP PHPUnit_TextUI_TestRunner怎麽用?PHP PHPUnit_TextUI_TestRunner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PHPUnit_TextUI_TestRunner類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: main

 public function main()
 {
     if (!is_dir(realpath($this->testdirectory))) {
         throw new BuildException("NativePHPUnitTask requires a Test Directory path given, '" . $this->testdirectory . "' given.");
     }
     set_include_path(realpath($this->testdirectory) . PATH_SEPARATOR . get_include_path());
     $printer = new NativePhpunitPrinter();
     $arguments = array('configuration' => $this->configuration, 'coverageClover' => $this->coverageClover, 'junitLogfile' => $this->junitlogfile, 'printer' => $printer);
     require_once "PHPUnit/TextUI/TestRunner.php";
     $runner = new PHPUnit_TextUI_TestRunner();
     $suite = $runner->getTest($this->test, $this->testfile, true);
     try {
         $result = $runner->doRun($suite, $arguments);
         /* @var $result PHPUnit_Framework_TestResult */
         if ($this->haltonfailure && $result->failureCount() > 0 || $this->haltonerror && $result->errorCount() > 0) {
             throw new BuildException("PHPUnit: " . $result->failureCount() . " Failures and " . $result->errorCount() . " Errors, " . "last failure message: " . $printer->getMessages());
         }
         $this->log("PHPUnit Success: " . count($result->passed()) . " tests passed, no " . "failures (" . $result->skippedCount() . " skipped, " . $result->notImplementedCount() . " not implemented)");
         // Hudson for example doesn't like the backslash in class names
         if (file_exists($this->coverageClover)) {
             $this->log("Generated Clover Coverage XML to: " . $this->coverageClover);
             $content = file_get_contents($this->coverageClover);
             $content = str_replace("\\", ".", $content);
             file_put_contents($this->coverageClover, $content);
             unset($content);
         }
     } catch (\Exception $e) {
         throw new BuildException("NativePhpunitTask failed: " . $e->getMessage());
     }
 }
開發者ID:alcaeus,項目名稱:mongodb-odm,代碼行數:30,代碼來源:NativePhpunitTask.php

示例2: indexAction

 /**
  *
  */
 public function indexAction()
 {
     $argv = $this->getRequest()->getServer('argv');
     $test_to_run = isset($argv[3]) ? $argv[3] : Const_Tests::RUN_ALL_TESTS;
     $test_to_run = str_replace('_', '/', $test_to_run);
     foreach (Core_Files::listFiles(cfg()->tests_path) as $test) {
         if (!strstr($test, $test_to_run . '.php') && $test_to_run != Const_Tests::RUN_ALL_TESTS) {
             continue;
         }
         $class_path = str_replace(cfg()->tests_path, '', $test);
         $class_path_frag = explode('/', $class_path);
         $class_path_frag = array_map("ucfirst", $class_path_frag);
         $class_path_frag[count($class_path_frag) - 1] = str_replace('.php', '', $class_path_frag[count($class_path_frag) - 1]);
         $class = implode('_', $class_path_frag);
         $class_name = 'Tests_' . $class . 'File';
         echo '--------------------------------------' . PHP_EOL;
         echo 'Running test: ' . $class_name . PHP_EOL;
         echo '--------------------------------------' . PHP_EOL;
         $phpunit = new PHPUnit_TextUI_TestRunner();
         $phpunit->run($phpunit->getTest($class_name, $test), array('colors' => 'auto'));
         if ($test_to_run != Const_Tests::RUN_ALL_TESTS) {
             die;
         }
         echo PHP_EOL . PHP_EOL;
     }
     die;
 }
開發者ID:bozhich,項目名稱:PHP-on-Rails,代碼行數:30,代碼來源:Index.php

示例3: execute

 /**
  * Execute the Command
  *
  * @access protected
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!file_exists(\Skeleton\Test\Config::$test_directory)) {
         $output->writeln('<error>Config::$test_directory is not set to a valid directory</error>');
         return 1;
     }
     $directory = \Skeleton\Test\Config::$test_directory;
     $phpunit = new \PHPUnit_TextUI_TestRunner();
     $printer = new \PrettyResultPrinter\Printer();
     $test_results = $phpunit->run($phpunit->getTest($directory, '', '.php'), ['colors' => 'always', 'verbose' => true, 'debug' => false, 'tap' => true, 'printer' => $printer]);
 }
開發者ID:tigron,項目名稱:skeleton-test,代碼行數:18,代碼來源:all.php

示例4: suite

 /**
  * TestSuite
  */
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('sfReplicaThumbnailPlugin');
     // Replica tests
     $suite->addTestFile(DIR_SF_REPLICA . '/lib/vendor/Replica/test/AllTests.php');
     PHPUnit_Util_Filter::removeDirectoryFromWhitelist(DIR_SF_REPLICA . '/lib/vendor');
     // Plugin tests
     $runner = new PHPUnit_TextUI_TestRunner(new PHPUnit_Runner_StandardTestSuiteLoader());
     $suite->addTest($runner->getTest(dirname(__FILE__) . '/unit'));
     return $suite;
 }
開發者ID:pycmam,項目名稱:sfReplicaThumbnailPlugin,代碼行數:14,代碼來源:AllTests.php

示例5: execute

 protected function execute($arguments = array(), $options = array())
 {
     //    $initTask = new sfPhpunitInitTask($this->dispatcher, $this->formatter);
     //    $initTask->run();
     chdir(sfConfig::get('sf_root_dir'));
     shell_exec('./symfony phpunit:init');
     $path = $arguments['test'];
     sfBasePhpunitTestSuite::setProjectConfiguration($this->configuration);
     $runner = new PHPUnit_TextUI_TestRunner();
     $runner->doRun(sfPhpunitSuiteLoader::factory($path)->getSuite());
 }
開發者ID:hansrip,項目名稱:transzam,代碼行數:11,代碼來源:sfPhpunitRuntestTask.class.php

示例6: run

 /**
  * @param  mixed $test
  * @param  array $arguments
  * @throws InvalidArgumentException
  */
 public static function run($test, array $arguments = array())
 {
     if ($test instanceof ReflectionClass) {
         $test = new \PHPUnit_Framework_TestSuite($test);
     }
     if ($test instanceof \PHPUnit_Framework_Test) {
         $aTestRunner = new \PHPUnit_TextUI_TestRunner();
         return $aTestRunner->doRun($test, $arguments);
     } else {
         throw new InvalidArgumentException('No test case or test suite found.');
     }
 }
開發者ID:noikiy,項目名稱:tools,代碼行數:17,代碼來源:TestRunner.php

示例7: main

 public static function main()
 {
     if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
         $suite = new PHPUnit_Framework_TestSuite("Zend_Service_WindowsAzure_BlobSessionHandlerTest");
         $result = PHPUnit_TextUI_TestRunner::run($suite);
     }
 }
開發者ID:sasezaki,項目名稱:mirror-zf1-tests,代碼行數:7,代碼來源:BlobSessionHandlerTest.php

示例8: main

 public static function main()
 {
     if (!class_exists('PHPUnit_TextUI_TestRunner', true)) {
         require_once 'PHPUnit/TextUI/TestRunner.php';
     }
     PHPUnit_TextUI_TestRunner::run(self::suite());
 }
開發者ID:Geeklog-Core,項目名稱:geeklog,代碼行數:7,代碼來源:AllTests.php

示例9: testDB

 public function testDB()
 {
     $test_suites = new PHPUnit_Framework_TestSuite();
     $test_suites->addTestSuite('Socialad_DB_Test');
     $arguments = array();
     PHPUnit_TextUI_TestRunner::run($test_suites, $arguments);
 }
開發者ID:hsz-webdev,項目名稱:phpfoxunittest,代碼行數:7,代碼來源:unittest.class.php

示例10: run

 /**
  * Ugly hack to get around PHPUnit having a hard coded class name for the Runner. :(
  *
  * @param array $argv The command arguments
  * @param bool  $exit The exit mode.
  *
  * @return void
  */
 public function run(array $argv, $exit = TRUE)
 {
     $this->handleArguments($argv);
     $runner = $this->getRunner($this->arguments['loader']);
     if (is_object($this->arguments['test']) && $this->arguments['test'] instanceof PHPUnit_Framework_Test) {
         $suite = $this->arguments['test'];
     } else {
         $suite = $runner->getTest($this->arguments['test'], $this->arguments['testFile']);
     }
     if ($this->arguments['listGroups']) {
         PHPUnit_TextUI_TestRunner::printVersionString();
         print "Available test group(s):\n";
         $groups = $suite->getGroups();
         sort($groups);
         foreach ($groups as $group) {
             print " - {$group}\n";
         }
         exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
     }
     unset($this->arguments['test']);
     unset($this->arguments['testFile']);
     try {
         $result = $runner->doRun($suite, $this->arguments);
     } catch (PHPUnit_Framework_Exception $e) {
         print $e->getMessage() . "\n";
     }
     if ($exit) {
         if (isset($result) && $result->wasSuccessful()) {
             exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
         } elseif (!isset($result) || $result->errorCount() > 0) {
             exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
         }
         exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
     }
 }
開發者ID:mrbadao,項目名稱:api-official,代碼行數:43,代碼來源:CakeTestSuiteCommand.php

示例11: main

 public static function main()
 {
     if (!function_exists('phpunit_autoload')) {
         require_once 'PHPUnit/TextUI/TestRunner.php';
     }
     PHPUnit_TextUI_TestRunner::run(self::suite());
 }
開發者ID:SuhitNarayan,項目名稱:SuhitNarayan-SEMANTICTECH,代碼行數:7,代碼來源:AllTests.php

示例12: execute

 /**
  * Execute the Command
  *
  * @access protected
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!file_exists(\Skeleton\Database\Migration\Config::$migration_directory)) {
         $output->writeln('<error>Config::$test_directory is not set to a valid directory</error>');
         return 1;
     }
     $directory = \Skeleton\Test\Config::$test_directory;
     $phpunit = new \PHPUnit_TextUI_TestRunner();
     $arguments = ['colors' => 'always', 'verbose' => true, 'debug' => true, 'tap' => true];
     if (!$input->getOption('disable-pretty-printer')) {
         $arguments['printer'] = new \PrettyResultPrinter\Printer();
     }
     $suite = new \PHPUnit_Framework_TestSuite();
     $suite->addTestSuite($input->getArgument('name'));
     $test_results = $phpunit->run($suite, $arguments);
 }
開發者ID:tigron,項目名稱:skeleton-test,代碼行數:23,代碼來源:run.php

示例13: main

    /**
     * Runs the test methods of this class.
     *
     * @access public
     * @static
     */
    public static function main()
    {
        require_once "PHPUnit/TextUI/TestRunner.php";

        $suite  = new PHPUnit_Framework_TestSuite("Zend_View_Helper_FormCheckboxTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:13,代碼來源:FormCheckboxTest.php

示例14: main

    /**
     * Runs the test methods of this class.
     *
     * @return void
     */
    public static function main()
    {
        require_once "PHPUnit/TextUI/TestRunner.php";

        $suite  = new PHPUnit_Framework_TestSuite("Zend_Form_Decorator_HtmlTagTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:12,代碼來源:HtmlTagTest.php

示例15: main

    /**
     * Runs the test methods of this class.
     */
    public static function main()
    {
        require_once "PHPUnit/TextUI/TestRunner.php";

        $suite  = new PHPUnit_Framework_TestSuite("Zend_Controller_Action_Helper_RedirectorTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:10,代碼來源:RedirectorTest.php


注:本文中的PHPUnit_TextUI_TestRunner類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。