Permalink
Browse files

- Merge [3931].

  • Loading branch information...
1 parent caeb884 commit c4e141a07cfdcc23a5b54332db269ddd8cc04e55 @sebastianbergmann committed Nov 4, 2008
Showing with 32 additions and 25 deletions.
  1. +2 −3 PHPUnit/Tests/TextUI/log-tap.phpt
  2. +2 −5 PHPUnit/Tests/TextUI/tap.phpt
  3. +5 −3 PHPUnit/TextUI/TestRunner.php
  4. +23 −14 PHPUnit/Util/Log/TAP.php
@@ -12,12 +12,11 @@ require_once dirname(dirname(dirname(__FILE__))) . '/TextUI/Command.php';
--EXPECTF--
PHPUnit %s by Sebastian Bergmann.
-1..3
-# TestSuite "BankAccountTest" started.
+TAP version 13
.ok 1 - testBalanceIsInitiallyZero(BankAccountTest)
.ok 2 - testBalanceCannotBecomeNegative(BankAccountTest)
.ok 3 - testBalanceCannotBecomeNegative2(BankAccountTest)
-# TestSuite "BankAccountTest" ended.
+1..3
Time: %i seconds
@@ -9,11 +9,8 @@ $_SERVER['argv'][3] = '../Samples/BankAccount/BankAccountTest.php';
require_once dirname(dirname(dirname(__FILE__))) . '/TextUI/Command.php';
?>
--EXPECTF--
-PHPUnit %s by Sebastian Bergmann.
-
-1..3
-# TestSuite "BankAccountTest" started.
+TAP version 13
ok 1 - testBalanceIsInitiallyZero(BankAccountTest)
ok 2 - testBalanceCannotBecomeNegative(BankAccountTest)
ok 3 - testBalanceCannotBecomeNegative2(BankAccountTest)
-# TestSuite "BankAccountTest" ended.
+1..3
@@ -196,9 +196,11 @@ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
}
}
- $this->printer->write(
- PHPUnit_Runner_Version::getVersionString() . "\n\n"
- );
+ if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
+ $this->printer->write(
+ PHPUnit_Runner_Version::getVersionString() . "\n\n"
+ );
+ }
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
View
@@ -72,11 +72,29 @@ class PHPUnit_Util_Log_TAP extends PHPUnit_Util_Printer implements PHPUnit_Frame
protected $testNumber = 0;
/**
+ * @var integer
+ */
+ protected $testSuiteLevel = 0;
+
+ /**
* @var boolean
*/
protected $testSuccessful = TRUE;
/**
+ * Constructor.
+ *
+ * @param mixed $out
+ * @throws InvalidArgumentException
+ * @since Method available since Release 3.3.4
+ */
+ public function __construct($out = NULL)
+ {
+ parent::__construct($out);
+ $this->write("TAP version 13\n");
+ }
+
+ /**
* An error occurred.
*
* @param PHPUnit_Framework_Test $test
@@ -141,14 +159,7 @@ public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time
*/
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
- $this->write(
- sprintf(
- "1..%d\n# TestSuite \"%s\" started.\n",
-
- count($suite),
- $suite->getName()
- )
- );
+ $this->testSuiteLevel++;
}
/**
@@ -158,13 +169,11 @@ public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
*/
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
- $this->write(
- sprintf(
- "# TestSuite \"%s\" ended.\n",
+ $this->testSuiteLevel--;
- $suite->getName()
- )
- );
+ if ($this->testSuiteLevel == 0) {
+ $this->write(sprintf("1..%d\n", $this->testNumber));
+ }
}
/**

0 comments on commit c4e141a

Please sign in to comment.