Changeset 2329 for trunk/tests

Show
Ignore:
Timestamp:
10/31/2007 11:20:14 PM (14 months ago)
Author:
wei
Message:

Refactored ActiveRecord?: removed object registry, fixed relationship casing problems.

Location:
trunk/tests/simple_unit/ActiveRecord
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/simple_unit/ActiveRecord/ForeignKeyTestCase.php

    r2309 r2329  
    160160        { 
    161161                $item = ItemRecord::finder()->withRelated_Items()->findByPk(1); 
    162  
    163162                $this->assertNotNull($item); 
    164163                $this->assertEqual($item->name, "Professional Work Attire"); 
  • trunk/tests/simple_unit/ActiveRecord/MultipleForeignKeyTestCase.php

    r2309 r2329  
    3333 
    3434        public $object1; 
    35         public $object2; 
     35        //public $object2; //commented out for testing __get/__set 
    3636        public $object3; 
    3737 
     
    5858 
    5959        private $_state1; 
    60         public $state2; 
     60        //public $state2; //commented out for testing __get/__set 
    6161        public $state3; 
    6262 
     
    175175                $this->assertEqual($obj->parent_category->cat_id, 1); 
    176176        } 
     177 
     178        function testLazyLoadingGetterSetter_hasMany() 
     179        { 
     180                $arr = Table2::finder()->findByPk(2); 
     181 
     182                $this->assertNotNull($arr->state2); //lazy load 
     183                $this->assertEqual(count($arr->state2), 1); 
     184                $this->assertEqual($arr->state2[0]->id, "1"); 
     185                $this->assertNotNull($arr->state2[0]->object2); 
     186                $this->assertEqual($arr->state2[0]->object2->id, "2"); 
     187 
     188                $this->assertNotIdentical($arr, $arr->state2[0]->object2); 
     189        } 
    177190} 
    178191