From b4f41b167b62bb628d0809fc0e9438e11dce2bb5 Mon Sep 17 00:00:00 2001 From: alex <> Date: Thu, 17 Nov 2005 11:47:30 +0000 Subject: Updated TPropertyValue so ensureArray parses a string like "(aaa,bbb,ccc)" into array("aaa","bbb","ccc"). Also added PradoUnitTestCase which is to be finalized shortly. --- tests/UnitTests/framework/common.php | 20 ++++---------------- tests/UnitTests/framework/utComponent.php | 3 --- 2 files changed, 4 insertions(+), 19 deletions(-) (limited to 'tests/UnitTests') diff --git a/tests/UnitTests/framework/common.php b/tests/UnitTests/framework/common.php index bcff7a89..80514875 100644 --- a/tests/UnitTests/framework/common.php +++ b/tests/UnitTests/framework/common.php @@ -40,23 +40,11 @@ class PradoUnitTestCase extends UnitTestCase { * @param string the type of exception that should be raised. * @return boolean true */ - public function assertException(string $code, string $exception) { - $pass = false; - $code = " -try { - $code -} catch ($exception \$e) { - \$pass = true; -}"; - eval($code); - if ($pass) { - $this->pass(); - } else { - $this->fail("Code did not produce correct exception (wanted $exception, got something else"); - } + public function assertException(string $code, string $exceptionType) { + $ex = null; + eval("try { $code } catch ($exceptionType \$e) { \$ex = \$e; }"); + $this->assertIsA($ex, $exceptionType); } } - - ?> \ No newline at end of file diff --git a/tests/UnitTests/framework/utComponent.php b/tests/UnitTests/framework/utComponent.php index b47c3de9..bd13b8cb 100644 --- a/tests/UnitTests/framework/utComponent.php +++ b/tests/UnitTests/framework/utComponent.php @@ -293,9 +293,6 @@ class utComponent extends UnitTestCase public function testEnsureObject() { $this->assertEqual(TPropertyValue::ensureObject($this->component), $this->component); - $this->assertNull(TPropertyValue::ensureObject(array(1,2,3))); - $this->assertNull(TPropertyValue::ensureObject(1)); - $this->assertNull(TPropertyValue::ensureObject("foo")); } /** -- cgit v1.2.3