From e7e7c7403b1ffffdf1a7a4bb9e1de752fe1c72db Mon Sep 17 00:00:00 2001 From: wei <> Date: Wed, 5 Jul 2006 07:45:41 +0000 Subject: clean up tests --- .../simpletest/extensions/pear_test_case.php | 199 --------------------- .../simpletest/extensions/phpunit_test_case.php | 108 ----------- 2 files changed, 307 deletions(-) delete mode 100644 tests/UnitTests/simpletest/extensions/pear_test_case.php delete mode 100644 tests/UnitTests/simpletest/extensions/phpunit_test_case.php (limited to 'tests/UnitTests/simpletest/extensions') diff --git a/tests/UnitTests/simpletest/extensions/pear_test_case.php b/tests/UnitTests/simpletest/extensions/pear_test_case.php deleted file mode 100644 index c9ac0743..00000000 --- a/tests/UnitTests/simpletest/extensions/pear_test_case.php +++ /dev/null @@ -1,199 +0,0 @@ -SimpleTestCase($label); - $this->_loosely_typed = false; - } - - /** - * Will test straight equality if set to loose - * typing, or identity if not. - * @param $first First value. - * @param $second Comparison value. - * @param $message Message to display. - * @public - */ - function assertEquals($first, $second, $message = "%s", $delta = 0) { - if ($this->_loosely_typed) { - $expectation = &new EqualExpectation($first); - } else { - $expectation = &new IdenticalExpectation($first); - } - $this->assertExpectation($expectation, $second, $message); - } - - /** - * Passes if the value tested is not null. - * @param $value Value to test against. - * @param $message Message to display. - * @public - */ - function assertNotNull($value, $message = "%s") { - parent::assertTrue(isset($value), $message); - } - - /** - * Passes if the value tested is null. - * @param $value Value to test against. - * @param $message Message to display. - * @public - */ - function assertNull($value, $message = "%s") { - parent::assertTrue(!isset($value), $message); - } - - /** - * In PHP5 the identity test tests for the same - * object. This is a reference test in PHP4. - * @param $first First object handle. - * @param $second Hopefully the same handle. - * @param $message Message to display. - * @public - */ - 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->assertTrue( - SimpleTestCompatibility::isReference($first, $second), - $message); - } - - /** - * In PHP5 the identity test tests for the same - * object. This is a reference test in PHP4. - * @param $first First object handle. - * @param $second Hopefully a different handle. - * @param $message Message to display. - * @public - */ - 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->assertFalse( - SimpleTestCompatibility::isReference($first, $second), - $message); - } - - /** - * Sends pass if the test condition resolves true, - * a fail otherwise. - * @param $condition Condition to test true. - * @param $message Message to display. - * @public - */ - function assertTrue($condition, $message = "%s") { - parent::assertTrue($condition, $message); - } - - /** - * Sends pass if the test condition resolves false, - * a fail otherwise. - * @param $condition Condition to test false. - * @param $message Message to display. - * @public - */ - function assertFalse($condition, $message = "%s") { - parent::assertTrue(!$condition, $message); - } - - /** - * Tests a regex match. Needs refactoring. - * @param $pattern Regex to match. - * @param $subject String to search in. - * @param $message Message to display. - * @public - */ - function assertRegExp($pattern, $subject, $message = "%s") { - $this->assertExpectation( - new WantedPatternExpectation($pattern), - $subject, - $message); - } - - /** - * Tests the type of a value. - * @param $value Value to take type of. - * @param $type Hoped for type. - * @param $message Message to display. - * @public - */ - function assertType($value, $type, $message = "%s") { - parent::assertTrue(gettype($value) == strtolower($type), $message); - } - - /** - * Sets equality operation to act as a simple equal - * comparison only, allowing a broader range of - * matches. - * @param $loosely_typed True for broader comparison. - * @public - */ - function setLooselyTyped($loosely_typed) { - $this->_loosely_typed = $loosely_typed; - } - - /** - * For progress indication during - * a test amongst other things. - * @return Usually one. - * @public - */ - function countTestCases() { - return $this->getSize(); - } - - /** - * Accessor for name, normally just the class - * name. - * @public - */ - function getName() { - return $this->getLabel(); - } - - /** - * Does nothing. For compatibility only. - * @param $name Dummy - * @public - */ - function setName($name) { - } - } -?> diff --git a/tests/UnitTests/simpletest/extensions/phpunit_test_case.php b/tests/UnitTests/simpletest/extensions/phpunit_test_case.php deleted file mode 100644 index 4c6fa54e..00000000 --- a/tests/UnitTests/simpletest/extensions/phpunit_test_case.php +++ /dev/null @@ -1,108 +0,0 @@ -SimpleTestCase($label); - } - - /** - * Sends pass if the test condition resolves true, - * a fail otherwise. - * @param $condition Condition to test true. - * @param $message Message to display. - * @public - */ - function assert($condition, $message = false) { - parent::assertTrue($condition, $message); - } - - /** - * Will test straight equality if set to loose - * typing, or identity if not. - * @param $first First value. - * @param $second Comparison value. - * @param $message Message to display. - * @public - */ - function assertEquals($first, $second, $message = false) { - $this->assertExpectation( - new EqualExpectation($first), - $second, - $message); - } - - /** - * Will test straight equality if set to loose - * typing, or identity if not. - * @param $first First value. - * @param $second Comparison value. - * @param $message Message to display. - * @public - */ - function assertEqualsMultilineStrings($first, $second, $message = false) { - $this->assertExpectation( - new EqualExpectation($first), - $second, - $message); - } - - /** - * Tests a regex match. - * @param $pattern Regex to match. - * @param $subject String to search in. - * @param $message Message to display. - * @public - */ - function assertRegexp($pattern, $subject, $message = false) { - $this->assertExpectation( - new WantedPatternExpectation($pattern), - $subject, - $message); - } - - /** - * Sends an error which we interpret as a fail - * with a different message for compatibility. - * @param $message Message to display. - * @public - */ - function error($message) { - parent::assertTrue(false, "Error triggered [$message]"); - } - - /** - * Accessor for name. - * @public - */ - function name() { - return $this->getLabel(); - } - } -?> -- cgit v1.2.3