diff options
author | xue <> | 2006-07-07 14:54:15 +0000 |
---|---|---|
committer | xue <> | 2006-07-07 14:54:15 +0000 |
commit | 61bb16ee2e5f0a66234e1575242169a10fde47b5 (patch) | |
tree | 3ee24dcc36ceae2c213130df1ea3d5c9fc110a27 /tests/UnitTests/framework/utPradoBase.php | |
parent | 7b84938b1b5964f2274d66e28ba17435924ffe35 (diff) |
Merge from 3.0 branch till 1253.
Diffstat (limited to 'tests/UnitTests/framework/utPradoBase.php')
-rw-r--r-- | tests/UnitTests/framework/utPradoBase.php | 110 |
1 files changed, 0 insertions, 110 deletions
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 @@ -<?php
-
-require_once(dirname(__FILE__).'/common.php');
-
-class testNode
-{
- public $data='';
- public $parent=null;
- public $child=null;
- public function __construct($data)
- {
- $this->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 |