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


PHP PHPUnit_Framework_TestResult::wasSuccessful方法代码示例

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


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

示例1: testNavigationAccessTest

 public function testNavigationAccessTest()
 {
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->addTestSuite('AccessNavigationTest');
     $suite->run($result = new PHPUnit_Framework_TestResult());
     $this->assertEquals(5, $result->count());
     $this->assertTrue($result->wasSuccessful());
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:8,代码来源:NavigationTestTest.php

示例2: testAclIsTested

 public function testAclIsTested()
 {
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->addTestSuite('FooAclTest');
     $suite->run($result = new PHPUnit_Framework_TestResult());
     $this->assertTrue($result->wasSuccessful(), 'Test should be run successfully');
     $this->assertEquals(2, $result->count());
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:8,代码来源:AclTestTest.php

示例3: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @access protected
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         $this->write("\n[1;37;42m" . ($result = sprintf("OK (%d test%s, %d assertion%s)", count($result), count($result) == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's')) . str_repeat(' ', 80 - strlen($result)) . "[0m\n");
     } elseif ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
         $this->write("\n[1;37;43mOk, but incomplete or skipped tests!                                            [0m\n" . sprintf("Tests: %d, Assertions: %d%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
     } else {
         $this->write(sprintf("\n[1;37;41mFailures                                                                        [m\n" . "Tests: %d, Assertions: %s%s%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
     }
 }
开发者ID:kore,项目名称:arbit-result-printer,代码行数:14,代码来源:printer.php

示例4: assertTestsAreSuccessful

 protected function assertTestsAreSuccessful(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful()) {
         return;
     }
     $msg = "Test should pass, instead there are {$result->errorCount()} errors:\n";
     /** @var $error PHPUnit_Framework_TestFailure */
     foreach ($result->errors() as $error) {
         $msg .= $error->exceptionMessage();
     }
     $this->fail($msg);
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:12,代码来源:ZendTest.php

示例5: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         if ($this->colors) {
             $this->write("[30;42m[2K");
         }
         $this->write(sprintf("OK (%d test%s, %d assertion%s)\n", count($result), count($result) == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's'));
         if ($this->colors) {
             $this->write("[0m[2K");
         }
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             if ($this->colors) {
                 $this->write("[30;43m[2KOK, but incomplete or skipped tests!\n" . "[0m[30;43m[2K");
             } else {
                 $this->write("OK, but incomplete or skipped tests!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %d%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("[0m[2K");
             }
         } else {
             $this->write("\n");
             if ($this->colors) {
                 $this->write("[37;41m[2KFAILURES!\n[0m[37;41m[2K");
             } else {
                 $this->write("FAILURES!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %s%s%s%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("[0m[2K");
             }
         }
     }
     if (!$this->verbose && $result->deprecatedFeaturesCount() > 0) {
         $message = sprintf("Warning: Deprecated PHPUnit features are being used %s times!\n" . "Use --verbose for more information.\n", $result->deprecatedFeaturesCount());
         if ($this->colors) {
             $message = "[37;41m[2K" . $message . "[0m";
         }
         $this->write("\n" . $message);
     }
 }
开发者ID:qcodo,项目名称:qcodo,代码行数:45,代码来源:ResultPrinter.php

示例6: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         if ($this->colors) {
             $this->write("[30;42m[2K");
         }
         $this->write(sprintf("OK (%d test%s, %d assertion%s)\n", count($result), count($result) == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's'));
         if ($this->colors) {
             $this->write("[0m[2K");
         }
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             if ($this->colors) {
                 $this->write("[30;43m[2KOK, but incomplete or skipped tests!\n" . "[0m[30;43m[2K");
             } else {
                 $this->write("OK, but incomplete or skipped tests!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %d%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("[0m[2K");
             }
         } else {
             $this->write("\n");
             if ($this->colors) {
                 $this->write("[37;41m[2KFAILURES!\n[0m[37;41m[2K");
             } else {
                 $this->write("FAILURES!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %s%s%s%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("[0m[2K");
             }
         }
     }
 }
开发者ID:pavan-git,项目名称:visualphpunit,代码行数:38,代码来源:ResultPrinter.php

示例7: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @access protected
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         $this->write(sprintf("\nOK (%d test%s)\n", count($result), count($result) == 1 ? '' : 's'));
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             $this->write(sprintf("\nOK, but incomplete or skipped tests!\n" . "Tests: %d%s%s.\n", count($result), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         } else {
             $this->write(sprintf("\nFAILURES!\n" . "Tests: %d%s%s%s%s.\n", count($result), $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         }
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:16,代码来源:ResultPrinter.php

示例8: renderTestStatistics

    /**
     * Renders and output the tests statistics.
     *
     * @param PHPUnit_Framework_TestResult $testResult the test result
     *
     * @return void
     */
    protected function renderTestStatistics(PHPUnit_Framework_TestResult $testResult)
    {
        if ($testResult->wasSuccessful()) {
            $testStatistics = '<h2 class="wasSuccessful">' . $this->translate('testing_success') . '</h2>';
        } else {
            if ($testResult->errorCount() > 0) {
                $testStatistics = '<script type="text/javascript">/*<![CDATA[*/setProgressBarClass("hadError");/*]]>*/</script>
					<h2 class="hadError">' . $this->translate('testing_failure') . '</h2>';
            } else {
                $testStatistics = '<script type="text/javascript">/*<![CDATA[*/setProgressBarClass("hadFailure");/*]]>*/</script>
					<h2 class="hadFailure">' . $this->translate('testing_failure') . '</h2>';
            }
        }
        $testStatistics .= '<p>' . $testResult->count() . ' ' . $this->translate('tests_total') . ', ' . $this->testListener->assertionCount() . ' ' . $this->translate('assertions_total') . ', ' . $testResult->failureCount() . ' ' . $this->translate('tests_failures') . ', ' . $testResult->skippedCount() . ' ' . $this->translate('tests_skipped') . ', ' . $testResult->notImplementedCount() . ' ' . $this->translate('tests_incomplete') . ', ' . $testResult->errorCount() . ' ' . $this->translate('tests_errors') . ', <span title="' . $this->testStatistics->getTime() . '&nbsp;' . $this->translate('tests_seconds') . '">' . round($this->testStatistics->getTime(), 3) . '&nbsp;' . $this->translate('tests_seconds') . ', </span>' . t3lib_div::formatSize($this->testStatistics->getMemory()) . 'B (' . $this->testStatistics->getMemory() . ' B) ' . $this->translate('tests_leaks') . '</p>';
        $this->outputService->output($testStatistics);
    }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:23,代码来源:Module.php

示例9: getTestStatus

 /**
  * Returns test run status based on session strategy requested by browser.
  *
  * @param BrowserTestCase               $test_case   Browser test case.
  * @param \PHPUnit_Framework_TestResult $test_result Test result.
  *
  * @return boolean
  * @see    IsolatedSessionStrategy
  * @see    SharedSessionStrategy
  */
 public function getTestStatus(BrowserTestCase $test_case, \PHPUnit_Framework_TestResult $test_result)
 {
     if ($this->isShared()) {
         // All tests in a test case use same session -> failed even if 1 test fails.
         return $test_result->wasSuccessful();
     }
     // Each test in a test case are using it's own session -> failed if test fails.
     return !$test_case->hasFailed();
 }
开发者ID:mablae,项目名称:phpunit-mink,代码行数:19,代码来源:BrowserConfiguration.php

示例10: assertFailed

 /**
  * Asserts that the given result belongs to a test that failed.
  *
  * @param PHPUnit_Framework_TestResult $result
  */
 protected function assertFailed(PHPUnit_Framework_TestResult $result)
 {
     $message = 'Test was expected to fail, but it was executed successfully.';
     $this->assertFalse($result->wasSuccessful(), $message);
 }
开发者ID:matthimatiker,项目名称:molcomponents,代码行数:10,代码来源:WebControllerTestCaseExternalTest.php

示例11: getExitStatus

 /**
  * Compute a shell exit status for the given result.
  * Behaves like PHPUnit_TextUI_Command.
  *
  * @param      PHPUnit_Framework_TestResult The test result object.
  *
  * @return     int The shell exit code.
  * @deprecated 1.1.0 Use AgaviPhpUnitCli
  */
 public static function getExitStatus(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful()) {
         return PHPUnit_TextUI_TestRunner::SUCCESS_EXIT;
     } elseif ($result->errorCount()) {
         return PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT;
     } else {
         return PHPUnit_TextUI_TestRunner::FAILURE_EXIT;
     }
 }
开发者ID:horros,项目名称:agavi,代码行数:19,代码来源:AgaviTesting.class.php

示例12: formatTestResult

 public static function formatTestResult(\PHPUnit_Framework_TestResult $result, $assertions)
 {
     $tests = $result->count();
     $errors = $result->errorCount();
     $failures = $result->failureCount();
     $skipped = $result->skippedCount();
     $incomplete = $result->notImplementedCount();
     $msg = self::formatResultPart($errors, 'error', 's');
     $msg .= self::formatResultPart($failures, 'failure', 's');
     $msg .= self::formatResultPart($skipped, 'skipped');
     $msg .= self::formatResultPart($incomplete, 'incomplete');
     return sprintf('%s (%d %s, %d %s%s)', $result->wasSuccessful() ? 'OK' : 'FAILED', $tests, $tests != 1 ? 'tests' : 'test', $assertions, $assertions != 1 ? 'assertions' : 'assertion', $msg);
 }
开发者ID:pago,项目名称:pantr,代码行数:13,代码来源:PHPUnit.php

示例13: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @access protected
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         $this->write(sprintf("<tfoot><tr style='background-color: green'><td colspan='5'>OK (%d test%s)</td>/<tr></tfoot>", count($result), count($result) == 1 ? '' : 's'));
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             $this->write(sprintf("<tfoot><tr style='background-color: yellow'><td colspan='5'>OK, but incomplete or skipped tests! Tests: %d%s%s.</td>/<tr></tfoot>", count($result), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         } else {
             $this->write(sprintf("<tfoot><tr style='background-color: red'><td colspan='5'>FAILURES ! Tests: %d%s%s.</td>/<tr></tfoot>", count($result), $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         }
     }
     $this->write('</table>');
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:17,代码来源:CopixTestPrinter.class.php

示例14: printFooter

 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @access protected
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful()) {
         printf("\nOK (%d test%s)\n", $result->runCount(), $result->runCount() == 1 ? '' : 's');
     } else {
         printf("\nFAILURES!!!\nTests run: %d, Failures: %d, Errors: %d.\n", $result->runCount(), $result->failureCount(), $result->errorCount());
     }
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:12,代码来源:ResultPrinter.php


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