cvs: pear /PHPUnit2/Tests/Framework TestCaseTest.php
| From: | Sebastian Bergmann | Date: | Fri, 23 Apr 2004 16:06:04 +0000 |
| Subject: | cvs: pear /PHPUnit2/Tests/Framework TestCaseTest.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-18633@lists.php.net to get a copy of this message | ||
sebastian Fri Apr 23 12:06:04 2004 EDT
Modified files:
/pear/PHPUnit2/Tests/Framework TestCaseTest.php
Log:
Implement testWasRun(), verifyError(), verifyFailure(), and verifySuccess(). Add code comment.
http://cvs.php.net/diff.php/pear/PHPUnit2/Tests/Framework/TestCaseTest.php?r1=1.4&r2=1.5&ty=u
Index: pear/PHPUnit2/Tests/Framework/TestCaseTest.php
diff -u pear/PHPUnit2/Tests/Framework/TestCaseTest.php:1.4
pear/PHPUnit2/Tests/Framework/TestCaseTest.php:1.5
--- pear/PHPUnit2/Tests/Framework/TestCaseTest.php:1.4 Fri Apr 23 03:16:05 2004
+++ pear/PHPUnit2/Tests/Framework/TestCaseTest.php Fri Apr 23 12:06:04 2004
@@ -12,12 +12,16 @@
// | license@php.net so we can mail you a copy immediately. |
// +------------------------------------------------------------------------+
//
-// $Id: TestCaseTest.php,v 1.4 2004/04/23 07:16:05 sebastian Exp $
+// $Id: TestCaseTest.php,v 1.5 2004/04/23 16:06:04 sebastian Exp $
//
require_once 'PHPUnit2/Framework/TestCase.php';
+require_once 'PHPUnit2/Tests/WasRun.php';
+
/**
+ * A test case testing the testing framework.
+ *
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @copyright Copyright © 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.php.net/license/3_0.txt
The PHP License, Version 3.0
@@ -91,6 +95,37 @@
*/
public function testTearDownSetupFails() {
}
+
+ public function testWasRun() {
+ $test = new PHPUnit2_Tests_WasRun;
+ $test->run();
+
+ $this->assertTrue($test->wasRun);
+ }
+
+ protected function verifyError(PHPUnit2_Framework_TestCase $test) {
+ $result = $test->run();
+
+ $this->assertEquals(1, $result->errorCount());
+ $this->assertEquals(0, $result->failureCount());
+ $this->assertEquals(1, $result->runCount());
+ }
+
+ protected function verifyFailure(PHPUnit2_Framework_TestCase $test) {
+ $result = $test->run();
+
+ $this->assertEquals(0, $result->errorCount());
+ $this->assertEquals(1, $result->failureCount());
+ $this->assertEquals(1, $result->runCount());
+ }
+
+ protected function verifySuccess(PHPUnit2_Framework_TestCase $test) {
+ $result = $test->run();
+
+ $this->assertEquals(0, $result->errorCount());
+ $this->assertEquals(0, $result->failureCount());
+ $this->assertEquals(1, $result->runCount());
+ }
}
/*