Skip to content

Instantly share code, notes, and snippets.

@isidromerayo
Created March 8, 2013 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isidromerayo/5115136 to your computer and use it in GitHub Desktop.
Save isidromerayo/5115136 to your computer and use it in GitHub Desktop.
Show time to execute test :)
<phpunit backupGlobals="false"
backupStaticAttributes="false"
syntaxCheck="false"
colors="true"
bootstrap="./bootstrap.php">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="SimpleTestListener" file="./SimpleTestListener.php">
</listener>
</listeners>
</phpunit>
<?php
class SimpleTestListener implements \PHPUnit_Framework_TestListener
{
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
printf("Test '%s' terminado y ha tardado %s segundos " . PHP_EOL,
get_class($test) . '=>' . $test->getName(),
number_format($time,3)
);
}
public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) {
}
public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time) {
}
public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) {
}
public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) {
}
public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) {
}
public function startTest(\PHPUnit_Framework_Test $test) {
}
public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment