Changeset 439
- Timestamp:
- 11/17/07 07:27:38 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/kaste/framework/test/unit/lib/AkActiveRecord/_AkActiveRecord_connection_handling.php
r416 r439 11 11 function test_should_establish_a_connection() 12 12 { 13 $this->installAndIncludeModels(array(' EmptyModel'=>'id'));13 $this->installAndIncludeModels(array('DummyModel'=>'id')); 14 14 15 $Model =& $this-> EmptyModel;15 $Model =& $this->DummyModel; 16 16 $default_connection =& AkDbAdapter::getConnection(); 17 $available_tables_on_default = $default_connection->availableTables(); 17 18 unset ($Model->_db); 18 $this->assertTrue($Model->establishConnection()===$default_connection); 19 $this->assertFalse($Model->establishConnection('development')===$default_connection); 20 19 20 $this->assertReference($Model->establishConnection(),$default_connection); 21 $development_connection =& $Model->establishConnection('development'); 22 23 $available_tables_on_development = $development_connection->availableTables(); 24 $this->assertFalse($development_connection===$default_connection); 25 21 26 $this->assertFalse($Model->establishConnection('not_specified_profile')); 22 27 $this->assertError("Could not find the database profile 'not_specified_profile' in config/config.php."); 28 29 $check_default_connection =& AkDbAdapter::getConnection(); 30 $this->assertReference($default_connection,$check_default_connection); 31 $this->assertReference($default_connection->connection,$check_default_connection->connection); 32 33 //because we dont get two different connections at the same time on PHP if user and password is identical 34 //thus: !$this->assertEqual($available_tables_on_default,$check_default_connection->availableTables()); 35 //we have to: 36 $check_default_connection->connect(); 37 //now we get: 38 $this->assertEqual($available_tables_on_default,$check_default_connection->availableTables()); 39 //BUT again: !! 40 //$this->assertNotEqual($available_tables_on_development,$development_connection->availableTables()); 41 //$this->assertEqual($available_tables_on_default,$development_connection->availableTables()); 23 42 24 43 }
