123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?php
-
-
- require_once(dirname(__FILE__) . '/../dumper.php');
- require_once(dirname(__FILE__) . '/../compatibility.php');
- require_once(dirname(__FILE__) . '/../test_case.php');
- require_once(dirname(__FILE__) . '/../expectation.php');
-
-
- class PHPUnit_TestCase extends SimpleTestCase {
- var $_loosely_typed;
-
- function PHPUnit_TestCase($label = false) {
- $this->SimpleTestCase($label);
- $this->_loosely_typed = false;
- }
-
- function assertEquals($first, $second, $message = "%s", $delta = 0) {
- if ($this->_loosely_typed) {
- $expectation = &new EqualExpectation($first);
- } else {
- $expectation = &new IdenticalExpectation($first);
- }
- $this->assert($expectation, $second, $message);
- }
-
- function assertNotNull($value, $message = "%s") {
- parent::assert(new TrueExpectation(), isset($value), $message);
- }
-
- function assertNull($value, $message = "%s") {
- parent::assert(new TrueExpectation(), !isset($value), $message);
- }
-
- function assertSame(&$first, &$second, $message = "%s") {
- $dumper = &new SimpleDumper();
- $message = sprintf(
- $message,
- "[" . $dumper->describeValue($first) .
- "] and [" . $dumper->describeValue($second) .
- "] should reference the same object");
- return $this->assert(
- new TrueExpectation(),
- SimpleTestCompatibility::isReference($first, $second),
- $message);
- }
-
- function assertNotSame(&$first, &$second, $message = "%s") {
- $dumper = &new SimpleDumper();
- $message = sprintf(
- $message,
- "[" . $dumper->describeValue($first) .
- "] and [" . $dumper->describeValue($second) .
- "] should not be the same object");
- return $this->assert(
- new falseExpectation(),
- SimpleTestCompatibility::isReference($first, $second),
- $message);
- }
-
- function assertTrue($condition, $message = "%s") {
- parent::assert(new TrueExpectation(), $condition, $message);
- }
-
- function assertFalse($condition, $message = "%s") {
- parent::assert(new FalseExpectation(), $condition, $message);
- }
-
- function assertRegExp($pattern, $subject, $message = "%s") {
- $this->assert(new PatternExpectation($pattern), $subject, $message);
- }
-
- function assertType($value, $type, $message = "%s") {
- parent::assert(new TrueExpectation(), gettype($value) == strtolower($type), $message);
- }
-
- function setLooselyTyped($loosely_typed) {
- $this->_loosely_typed = $loosely_typed;
- }
-
- function countTestCases() {
- return $this->getSize();
- }
-
- function getName() {
- return $this->getLabel();
- }
-
- function setName($name) {
- }
- }
- ?>
|