From 61bb16ee2e5f0a66234e1575242169a10fde47b5 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 7 Jul 2006 14:54:15 +0000 Subject: Merge from 3.0 branch till 1253. --- tests/UnitTests/framework/utPradoBase.php | 110 ------------------------------ 1 file changed, 110 deletions(-) delete mode 100644 tests/UnitTests/framework/utPradoBase.php (limited to 'tests/UnitTests/framework/utPradoBase.php') diff --git a/tests/UnitTests/framework/utPradoBase.php b/tests/UnitTests/framework/utPradoBase.php deleted file mode 100644 index a53c17dd..00000000 --- a/tests/UnitTests/framework/utPradoBase.php +++ /dev/null @@ -1,110 +0,0 @@ -data=$data; - } -} - -class utPradoBase extends UnitTestCase -{ - public function testFrameworkPath() - { - $this->assertTrue(FRAMEWORK_DIR===Prado::getFrameworkPath()); - } - - public function testSerialization() - { - $object=new TComponent; - $number=12345.123; - $string='12345\'"'; - $array=array('123'=>123,'abc'=>'def'); - $this->assertFalse($object===Prado::unserialize(Prado::serialize($object))); - $this->assertTrue(Prado::unserialize(Prado::serialize($object)) instanceof TComponent); - $this->assertTrue($number===Prado::unserialize(Prado::serialize($number))); - $this->assertTrue($string===Prado::unserialize(Prado::serialize($string))); - $this->assertTrue($array===Prado::unserialize(Prado::serialize($array))); - - // test complex object reference structure grandparent <-> parent <-> child - $grandp=new testNode('grandp'); - $parent=new testNode('parent'); - $child=new testNode('child'); - $grandp->child=$parent; - $parent->child=$child; - $child->parent=$parent; - $parent->parent=$grandp; - - $newGrandp=Prado::unserialize(Prado::serialize($grandp)); - $this->assertTrue($newGrandp!==$grandp); - $this->assertTrue($newGrandp instanceof testNode); - $this->assertTrue($newGrandp->parent===null); - $this->assertTrue($newGrandp->data==='grandp'); - - $newParent=$newGrandp->child; - $this->assertTrue($newParent!==$parent); - $this->assertTrue($newParent instanceof testNode); - $this->assertTrue($newParent->parent===$newGrandp); - $this->assertTrue($newParent->data==='parent'); - - $newChild=$newParent->child; - $this->assertTrue($newChild!==$child); - $this->assertTrue($newChild instanceof testNode); - $this->assertTrue($newChild->parent===$newParent); - $this->assertTrue($newChild->child===null); - $this->assertTrue($newChild->data==='child'); - } - - public function testCreateComponent() - { - $this->assertTrue(Prado::createComponent('TComponent') instanceof TComponent); - $this->assertTrue(Prado::createComponent('System.TComponent') instanceof TComponent); - try - { - Prado::createComponent('System.TComponent2'); - $this->fail('exception not raised when creating a nonexistent component'); - } - catch(TInvalidDataValueException $e) - { - $this->pass(); - } - } - - public function testNamespace() - { - $this->assertTrue(FRAMEWORK_DIR===Prado::getPathOfAlias('System')); - $this->assertTrue(Prado::getPathOfAlias('System2')===null); - $testSystem=dirname(__FILE__).'/TestSystem'; - - Prado::setPathOfAlias('TestSystem',$testSystem); - $this->assertTrue(realpath($testSystem)===Prado::getPathOfAlias('TestSystem')); - - $this->assertTrue(Prado::getPathOfNamespace('TestSystem.*')===realpath($testSystem)); - $this->assertTrue(Prado::getPathOfNamespace('TestSystem.protected.*')===realpath($testSystem).'/protected'); - - // test repeatedly using the same namespaces - Prado::using('System.*'); - Prado::using('System.*'); - Prado::using('System.TComponent'); - Prado::using('System.TComponent'); - - try - { - Prado::using('System'); - $this->fail('no exception raised when using an invalid namespace for a directory'); - } - catch(TInvalidDataValueException $e) - { - $this->pass(); - } - // TODO: using new namespaces to see if classes can be automatically loaded or found - } -} - -?> \ No newline at end of file -- cgit v1.2.3