Changeset 4029
- Timestamp:
- 03/19/08 01:29:12 (16 months ago)
- Location:
- branches/0.10/tests
- Files:
-
- 4 removed
- 12 modified
- 2 moved
-
BatchIteratorTestCase.php (modified) (3 diffs)
-
Cache/QuerySqliteTestCase.php (moved) (moved from branches/0.10/tests/CacheQuerySqliteTestCase.php) (1 diff)
-
CollectionTestCase.php (modified) (11 diffs)
-
ConfigurableTestCase.php (modified) (12 diffs)
-
Export/ReporterTestCase.php (deleted)
-
ImportTestCase.php (modified) (1 diff)
-
Jwage (deleted)
-
JwageTestCase.php (deleted)
-
Migration/MysqlTestCase.php (deleted)
-
PessimisticLockingTestCase.php (modified) (1 diff)
-
PluginTestCase.php (modified) (1 diff)
-
Record/CascadingDeleteTestCase.php (moved) (moved from branches/0.10/tests/CascadingDeleteTestCase.php) (1 diff)
-
Record/SaveBlankRecordTestCase.php (modified) (1 diff)
-
Relation/AccessTestCase.php (modified) (3 diffs)
-
Relation/ManyToManyTestCase.php (modified) (6 diffs)
-
run.php (modified) (14 diffs)
-
Ticket/741TestCase.php (modified) (1 diff)
-
Ticket/749TestCase.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10/tests/BatchIteratorTestCase.php
r3884 r4029 33 33 class Doctrine_BatchIterator_TestCase extends Doctrine_UnitTestCase { 34 34 public function prepareTables() { 35 $this->tables = array("Entity ", "User", "Group", "Address", "Email", "Phonenumber");35 $this->tables = array("EntityAddress", "Entity", "User", "Group", "Address", "Email", "Phonenumber"); 36 36 parent::prepareTables(); 37 37 } … … 69 69 $user->save(); 70 70 71 $user = $user->getTable()->find($user-> obtainIdentifier());71 $user = $user->getTable()->find($user->id); 72 72 $this->assertEqual($user->name, "tester"); 73 73 $this->assertEqual($user->Address[0]->address, "street 1"); 74 74 $this->assertEqual($user->Address[1]->address, "street 2"); 75 75 76 $user = $user->getTable()->find($user-> obtainIdentifier());76 $user = $user->getTable()->find($user->id); 77 77 $a = array(); 78 78 foreach($user->Address as $address) { … … 84 84 $user = $graph->query("FROM User"); 85 85 } 86 87 86 } -
branches/0.10/tests/Cache/QuerySqliteTestCase.php
r2359 r4029 1 1 <?php 2 require_once("UnitTestCase.php");3 4 2 class Doctrine_Cache_Query_SqliteTestCase extends Doctrine_UnitTestCase { 5 3 public function setUp() { -
branches/0.10/tests/CollectionTestCase.php
r3884 r4029 33 33 class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase 34 34 { 35 /**36 35 public function testLoadRelatedForAssociation() 37 36 { … … 70 69 $this->assertEqual($coll->count(), 8); 71 70 72 $count = $this-> dbh->count();71 $count = $this->connection->count(); 73 72 74 73 $coll->loadRelated('Group'); 75 $this->assertEqual(($count + 1), $this-> dbh->count());74 $this->assertEqual(($count + 1), $this->connection->count()); 76 75 $this->assertEqual($coll[0]->Group->count(), 2); 77 $this->assertEqual(($count + 1), $this-> dbh->count());76 $this->assertEqual(($count + 1), $this->connection->count()); 78 77 $this->assertEqual($coll[1]->Group->count(), 1); 79 78 80 $this->assertEqual(($count + 1), $this-> dbh->count());79 $this->assertEqual(($count + 1), $this->connection->count()); 81 80 82 81 $this->assertEqual($coll[2]->Group->count(), 3); 83 82 84 $this->assertEqual(($count + 1), $this-> dbh->count());83 $this->assertEqual(($count + 1), $this->connection->count()); 85 84 $this->assertEqual($coll[5]->Group->count(), 3); 86 85 87 $this->assertEqual(($count + 1), $this-> dbh->count());86 $this->assertEqual(($count + 1), $this->connection->count()); 88 87 89 88 $this->connection->clear(); … … 117 116 $resources = $this->connection->query('FROM Resource'); 118 117 119 $count = $this-> dbh->count();118 $count = $this->connection->count(); 120 119 $resources->loadRelated('Type'); 121 120 122 $this->assertEqual(($count + 1), $this-> dbh->count());121 $this->assertEqual(($count + 1), $this->connection->count()); 123 122 $this->assertEqual($resources[0]->name, 'resource 1'); 124 123 $this->assertEqual($resource[0]->Type[0]->type, 'type 1'); 125 124 $this->assertEqual($resource[0]->Type[1]->type, 'type 2'); 126 $this->assertEqual(($count + 1), $this-> dbh->count());125 $this->assertEqual(($count + 1), $this->connection->count()); 127 126 128 127 $this->assertEqual($resource[1]->name, 'resource 2'); 129 128 $this->assertEqual($resource[1]->Type[0]->type, 'type 3'); 130 129 $this->assertEqual($resource[1]->Type[1]->type, 'type 4'); 131 $this->assertEqual(($count + 1), $this-> dbh->count());132 } 133 */130 $this->assertEqual(($count + 1), $this->connection->count()); 131 } 132 134 133 public function testAdd() 135 134 { … … 148 147 } 149 148 150 151 149 public function testLoadRelated() 152 150 { 153 $coll = $this->connection->query('FROM User (id)');151 $coll = $this->connection->query('FROM User u'); 154 152 155 153 $q = $coll->loadRelated(); … … 157 155 $this->assertTrue($q instanceof Doctrine_Query); 158 156 159 $q->addFrom('User.Group ');157 $q->addFrom('User.Group g'); 160 158 161 159 $coll2 = $q->execute($coll->getPrimaryKeys()); 162 160 $this->assertEqual($coll2->count(), $coll->count()); 163 161 164 $count = $this-> dbh->count();162 $count = $this->connection->count(); 165 163 $coll[0]->Group[0]; 166 $this->assertEqual($count, $this-> dbh->count());164 $this->assertEqual($count, $this->connection->count()); 167 165 } 168 166 public function testLoadRelatedForLocalKeyRelation() … … 172 170 $this->assertEqual($coll->count(), 8); 173 171 174 $count = $this-> dbh->count();172 $count = $this->connection->count(); 175 173 $coll->loadRelated('Email'); 176 174 177 $this->assertEqual(($count + 1), $this-> dbh->count());175 $this->assertEqual(($count + 1), $this->connection->count()); 178 176 179 177 $this->assertEqual($coll[0]->Email->address, 'zYne@example.com'); 180 178 181 $this->assertEqual(($count + 1), $this-> dbh->count());179 $this->assertEqual(($count + 1), $this->connection->count()); 182 180 183 181 $this->assertEqual($coll[2]->Email->address, 'caine@example.com'); … … 187 185 $this->assertEqual($coll[4]->Email->address, 'stallone@example.com'); 188 186 189 $this->assertEqual(($count + 1), $this-> dbh->count());187 $this->assertEqual(($count + 1), $this->connection->count()); 190 188 191 189 $this->connection->clear(); … … 196 194 $this->assertEqual($coll->count(), 8); 197 195 198 $count = $this-> dbh->count();196 $count = $this->connection->count(); 199 197 $coll->loadRelated("Phonenumber"); 200 198 201 $this->assertEqual(($count + 1), $this-> dbh->count());199 $this->assertEqual(($count + 1), $this->connection->count()); 202 200 203 201 $this->assertEqual($coll[0]->Phonenumber[0]->phonenumber, "123 123"); 204 202 205 $this->assertEqual(($count + 1), $this-> dbh->count());203 $this->assertEqual(($count + 1), $this->connection->count()); 206 204 207 205 $coll[0]->Phonenumber[1]->phonenumber; 208 206 209 $this->assertEqual(($count + 1), $this-> dbh->count());207 $this->assertEqual(($count + 1), $this->connection->count()); 210 208 211 209 $this->assertEqual($coll[4]->Phonenumber[0]->phonenumber, "111 555 333"); … … 220 218 $this->assertEqual($coll[6]["Phonenumber"][2]->phonenumber, "123 456"); 221 219 222 $this->assertEqual(($count + 1), $this-> dbh->count());220 $this->assertEqual(($count + 1), $this->connection->count()); 223 221 224 222 $this->connection->clear(); … … 233 231 public function testExpand() 234 232 { 235 $users = $this->connection->query("FROM User.Phonenumber WHERE User.Phonenumber.phonenumber LIKE '%123%'");236 237 $this->assertTrue($users instanceof Doctrine_Collection _Batch);233 $users = $this->connection->query("FROM User.Phonenumber WHERE User.Phonenumber.phonenumber"); 234 235 $this->assertTrue($users instanceof Doctrine_Collection); 238 236 $this->assertTrue($users[1] instanceof User); 239 $this->assertTrue($users[1]->Phonenumber instanceof Doctrine_Collection _Lazy);237 $this->assertTrue($users[1]->Phonenumber instanceof Doctrine_Collection); 240 238 $data = $users[1]->Phonenumber->getData(); 241 239 242 240 $coll = $users[1]->Phonenumber; 243 241 244 $this->assertEqual(count($data), 1);242 $this->assertEqual(count($data), 3); 245 243 246 244 foreach($coll as $record) { … … 253 251 254 252 $this->assertEqual($coll[2]->state(), Doctrine_Record::STATE_PROXY); 255 256 257 253 258 254 $coll->setKeyColumn('id'); -
branches/0.10/tests/ConfigurableTestCase.php
r2388 r4029 1 1 <?php 2 require_once("UnitTestCase.php");3 4 2 class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase { 5 3 public function prepareTables() { } … … 15 13 } 16 14 public function testSetIndexNameFormatAttribute() { 15 $original = $this->manager->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT); 17 16 $this->manager->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%_index'); 18 17 19 18 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT), '%_index'); 19 $this->manager->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, $original); 20 20 } 21 21 public function testSetSequenceNameFormatAttribute() { 22 $original = $this->manager->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT); 22 23 $this->manager->setAttribute(Doctrine::ATTR_SEQNAME_FORMAT, '%_sequence'); 23 24 24 25 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT), '%_sequence'); 26 $this->manager->setAttribute(Doctrine::ATTR_SEQNAME_FORMAT, $original); 25 27 } 26 28 public function testExceptionIsThrownWhenSettingIndexNameFormatAttributeAtTableLevel() { … … 41 43 } 42 44 public function testSettingFieldCaseIsSuccesfulWithZero() { 45 $original = $this->connection->getAttribute(Doctrine::ATTR_FIELD_CASE); 43 46 try { 44 47 $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, 0); … … 47 50 $this->fail(); 48 51 } 52 $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, $original); 49 53 } 50 54 public function testSettingFieldCaseIsSuccesfulWithCaseConstants() { 55 $original = $this->connection->getAttribute(Doctrine::ATTR_FIELD_CASE); 51 56 try { 52 57 $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, CASE_LOWER); … … 55 60 $this->fail(); 56 61 } 62 $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, $original); 57 63 } 58 64 public function testSettingFieldCaseIsSuccesfulWithCaseConstants2() { 65 $original = $this->connection->getAttribute(Doctrine::ATTR_FIELD_CASE); 59 66 try { 60 67 $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, CASE_UPPER); … … 63 70 $this->fail(); 64 71 } 72 $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, $original); 65 73 } 66 74 public function testExceptionIsThrownWhenSettingFieldCaseToNotZeroOneOrTwo() { … … 87 95 88 96 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER), true); 89 $this->manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);97 $this->manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); 90 98 } 91 99 public function testDefaultSequenceColumnNameAttributeValueIsId() { … … 93 101 } 94 102 public function testSequenceColumnNameAttributeAcceptsStrings() { 103 $original = $this->manager->getAttribute(Doctrine::ATTR_SEQCOL_NAME); 95 104 $this->manager->setAttribute(Doctrine::ATTR_SEQCOL_NAME, 'sequence'); 96 105 97 106 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQCOL_NAME), 'sequence'); 107 $this->manager->setAttribute(Doctrine::ATTR_SEQCOL_NAME, $original); 98 108 } 99 109 public function testValidatorAttributeAcceptsBooleans() { 100 $this->manager->setAttribute(Doctrine::ATTR_V LD, true);110 $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, true); 101 111 102 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_VLD), true); 103 } 104 public function testAutoLengthValidationAttributeAcceptsBooleans() { 105 $this->manager->setAttribute(Doctrine::ATTR_AUTO_LENGTH_VLD, true); 106 107 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_AUTO_LENGTH_VLD), true); 108 } 109 public function testAutoTypeValidationAttributeAcceptsBooleans() { 110 $this->manager->setAttribute(Doctrine::ATTR_AUTO_TYPE_VLD, true); 111 112 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_AUTO_TYPE_VLD), true); 112 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_VALIDATE), true); 113 $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, false); 113 114 } 114 115 public function testDefaultPortabilityAttributeValueIsAll() { … … 120 121 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_PORTABILITY), 121 122 Doctrine::PORTABILITY_RTRIM | Doctrine::PORTABILITY_FIX_CASE); 123 $this->manager->setAttribute(Doctrine::ATTR_PORTABILITY, Doctrine::PORTABILITY_ALL); 122 124 } 123 125 public function testDefaultListenerIsDoctrineEventListener() { … … 125 127 } 126 128 public function testListenerAttributeAcceptsEventListenerObjects() { 127 $this->manager->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_Debugger()); 129 $original = $this->manager->getAttribute(Doctrine::ATTR_LISTENER); 130 $this->manager->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener()); 128 131 129 $this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener_Debugger); 132 $this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener); 133 $this->manager->setAttribute(Doctrine::ATTR_LISTENER, $original); 130 134 } 131 135 public function testCollectionKeyAttributeAcceptsValidColumnName() { 136 $original = $this->connection->getTable('User')->getAttribute(Doctrine::ATTR_COLL_KEY); 132 137 try { 133 138 $this->connection->getTable('User')->setAttribute(Doctrine::ATTR_COLL_KEY, 'name'); … … 137 142 $this->fail(); 138 143 } 144 $this->connection->getTable('User')->setAttribute(Doctrine::ATTR_COLL_KEY, $original); 139 145 } 140 146 public function testSettingInvalidColumnNameToCollectionKeyAttributeThrowsException() { … … 156 162 } 157 163 } 158 public function testSetAttribute() {159 $table = $this->connection->getTable("User");160 /**161 $this->manager->setAttribute(Doctrine::ATTR_CACHE_TTL,100);162 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_TTL),100);163 164 $this->manager->setAttribute(Doctrine::ATTR_CACHE_SIZE,1);165 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_SIZE),1);166 167 $this->manager->setAttribute(Doctrine::ATTR_CACHE_DIR,"%ROOT%".DIRECTORY_SEPARATOR."cache");168 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_DIR),$this->manager->getRoot().DIRECTORY_SEPARATOR."cache");169 */170 $this->manager->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_LAZY);171 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_FETCHMODE),Doctrine::FETCH_LAZY);172 173 $this->manager->setAttribute(Doctrine::ATTR_BATCH_SIZE, 5);174 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_BATCH_SIZE),5);175 176 $this->manager->setAttribute(Doctrine::ATTR_LOCKMODE, Doctrine::LOCK_PESSIMISTIC);177 $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_LOCKMODE), Doctrine::LOCK_PESSIMISTIC);178 179 // test invalid arguments180 /**181 try {182 $this->manager->setAttribute(Doctrine::ATTR_CACHE_TTL,-12);183 } catch(Exception $e) {184 $this->assertTrue($e instanceof Exception);185 }186 try {187 $this->manager->setAttribute(Doctrine::ATTR_CACHE_SIZE,-12);188 } catch(Exception $e) {189 $this->assertTrue($e instanceof Exception);190 }191 try {192 $this->manager->setAttribute(Doctrine::ATTR_BATCH_SIZE,-12);193 } catch(Exception $e) {194 $this->assertTrue($e instanceof Exception);195 }196 */197 try {198 $this->connection->beginTransaction();199 $this->manager->setAttribute(Doctrine::ATTR_LOCKMODE, Doctrine::LOCK_OPTIMISTIC);200 } catch(Exception $e) {201 $this->assertTrue($e instanceof Exception);202 $this->connection->commit();203 }204 205 try {206 $this->connection->beginTransaction();207 $this->connection->setAttribute(Doctrine::ATTR_LOCKMODE, Doctrine::LOCK_PESSIMISTIC);208 } catch(Exception $e) {209 $this->assertTrue($e instanceof Exception);210 $this->connection->commit();211 }212 213 }214 164 public function testGetAttributes() { 215 165 $this->assertTrue(is_array($this->manager->getAttributes())); -
branches/0.10/tests/ImportTestCase.php
r3884 r4029 46 46 $this->conn = Doctrine_Manager::connection($this->dbh); 47 47 48 $this->conn->import->import ('Import/_files');48 $this->conn->import->importSchema('Import/_files'); 49 49 50 50 $this->assertTrue(file_exists('Import/_files/ImportTestUser.php')); 51 $this->assertTrue(file_exists('Import/_files/generated/BaseImportTestUser.php')); 51 52 } 52 53 } -
branches/0.10/tests/PessimisticLockingTestCase.php
r3884 r4029 47 47 $entry1->topic = 'I love donuts!'; 48 48 $entry1->save(); 49 } 50 51 public function prepareTables() 52 { 53 $this->tables = array('Forum_Entry', 'Entity', 'Phonenumber', 'Email', 'Groupuser'); 54 parent::prepareTables(); 49 55 } 50 56 -
branches/0.10/tests/PluginTestCase.php
r4010 r4029 98 98 public function setUp() 99 99 { 100 $options = array('fields' => array('title', 'content'));100 $options = array('fields' => array('title', 'content')); 101 101 $auditLog = new Doctrine_Template_Versionable($options); 102 102 $search = new Doctrine_Template_Searchable($options); 103 $slug = new Doctrine_Template_Sluggable($options);103 $slug = new Doctrine_Template_Sluggable($options); 104 104 $i18n = new Doctrine_Template_I18n($options); 105 106 105 107 106 $i18n->addChild($auditLog) -
branches/0.10/tests/Record/CascadingDeleteTestCase.php
r3884 r4029 31 31 * @version $Revision$ 32 32 */ 33 class Doctrine_ CascadingDelete_TestCase extends Doctrine_UnitTestCase33 class Doctrine_Record_CascadingDelete_TestCase extends Doctrine_UnitTestCase 34 34 { 35 35 public function prepareData() 36 36 { } 37 37 public function prepareTables() 38 { } 38 { 39 $this->tables = array('ForeignKeyTest'); 40 parent::prepareTables(); 41 } 39 42 public function testCascadingDeleteEmulation() 40 43 { -
branches/0.10/tests/Record/SaveBlankRecordTestCase.php
r3884 r4029 45 45 public function testSaveBlankRecord() 46 46 { 47 $user = new User();47 $user = new MyUser(); 48 48 $user->state('TDIRTY'); 49 49 $user->save(); 50 50 51 $this->assertTrue(isset($user['id']) );51 $this->assertTrue(isset($user['id']) && $user['id']); 52 52 } 53 53 54 54 public function testSaveBlankRecord2() 55 55 { 56 $ myUserGroup = new MyUserGroup();57 $ myUserGroup->state('TDIRTY');58 $ myUserGroup->save();56 $group = new MyUserGroup(); 57 $group->state('TDIRTY'); 58 $group->save(); 59 59 60 $this->assertTrue(isset($ user['id']));60 $this->assertTrue(isset($group['id']) && $group['id']); 61 61 } 62 62 } -
branches/0.10/tests/Relation/AccessTestCase.php
r2388 r4029 71 71 72 72 public function prepareTables() { 73 $this->tables += array("MyUser",73 $this->tables = array("Data_File", "File_Owner","MyUser", 74 74 "MyOneThing", 75 75 "MyUserOneThing", … … 161 161 } 162 162 163 $query = "FROM MyUser ,164 MyUser.MyOneThing,165 MyUser.MyOneThing.MyUserOneThing,166 MyUser.MyOtherThing,167 MyUser.MyOtherThing.MyUserOtherThing";163 $query = "FROM MyUser a1, 164 a1.MyOneThing a2, 165 a2.MyUserOneThing a3, 166 a1.MyOtherThing a4, 167 a4.MyUserOtherThing a5"; 168 168 $users = $this->connection->query($query); 169 169 foreach($users as $u) { … … 187 187 } 188 188 189 $query = "FROM MyUser ,190 MyUser.MyOtherThing,191 MyUser.MyOtherThing.MyUserOtherThing,192 MyUser.MyOneThing,193 MyUser.MyOneThing.MyUserOneThing";189 $query = "FROM MyUser a1, 190 a1.MyOtherThing a2, 191 a2.MyUserOtherThing a3, 192 a1.MyOneThing a4, 193 a4.MyUserOneThing a5"; 194 194 $users = $this->connection->query($query); 195 195 foreach($users as $u) { -
branches/0.10/tests/Relation/ManyToManyTestCase.php
r2359 r4029 4 4 public function prepareData() { } 5 5 public function prepareTables() { 6 $this->tables = array('JC1', 'JC2', 'JC3', 'RTC1', 'RTC2', 'M2MTest', 'M2MTest2'); 6 7 parent::prepareTables(); 7 8 } … … 33 34 try { 34 35 $rel = $component->getTable()->getRelation('M2MTest2'); 35 $this->pass();36 } catch(Doctrine_Exception $e) {37 $this->fail();38 }39 $this->assertEqual($rel->getForeign(), 'oid');40 try {41 $rel = $component->getTable()->getRelation('RTC4');42 36 $this->pass(); 43 37 } catch(Doctrine_Exception $e) { … … 125 119 $component->name = '2'; 126 120 127 $count = $this-> dbh->count();128 129 $component->save(); 130 131 $this->assertEqual($this-> dbh->count(), ($count + 5));121 $count = $this->connection->count(); 122 123 $component->save(); 124 125 $this->assertEqual($this->connection->count(), ($count + 5)); 132 126 133 127 $this->assertEqual($component->RTC1->count(), 2); … … 142 136 $component->RTC2[1]->name = '2'; 143 137 144 $count = $this-> dbh->count();145 146 $component->save(); 147 148 $this->assertEqual($this-> dbh->count(), ($count + 4));138 $count = $this->connection->count(); 139 140 $component->save(); 141 142 $this->assertEqual($this->connection->count(), ($count + 4)); 149 143 150 144 $this->assertEqual($component->RTC2->count(), 2); … … 163 157 $component->name = '2'; 164 158 165 $count = $this-> dbh->count();166 167 $component->save(); 168 169 $this->assertEqual($this-> dbh->count(), ($count + 5));159 $count = $this->connection->count(); 160 161 $component->save(); 162 163 $this->assertEqual($this->connection->count(), ($count + 5)); 170 164 171 165 $this->assertEqual($component->RTC2->count(), 2); … … 180 174 $component->RTC1[1]->name = '2'; 181 175 182 $count = $this-> dbh->count();183 184 $component->save(); 185 186 $this->assertEqual($this-> dbh->count(), ($count + 4));176 $count = $this->connection->count(); 177 178 $component->save(); 179 180 $this->assertEqual($this->connection->count(), ($count + 3)); 187 181 188 182 $this->assertEqual($component->RTC1->count(), 2); -
branches/0.10/tests/run.php
r4006 r4029 2 2 error_reporting(E_ALL | E_STRICT); 3 3 ini_set('max_execution_time', 900); 4 ini_set( "date.timezone", "GMT+0");4 ini_set('date.timezone', 'GMT+0'); 5 5 6 6 require_once(dirname(__FILE__) . '/DoctrineTest.php'); … … 10 10 11 11 $test = new DoctrineTest(); 12 //TICKET test cases 13 $tickets = new GroupTest('Tickets tests', 'tickets'); 12 13 // Ticket Tests 14 // If you write a ticket testcase add it to the bottom of the list, with the ticket number in it 15 $tickets = new GroupTest('Tickets Tests', 'tickets'); 14 16 $tickets->addTestCase(new Doctrine_Ticket_Njero_TestCase()); 17 $tickets->addTestCase(new Doctrine_Ticket_381_TestCase()); 18 $tickets->addTestCase(new Doctrine_Ticket_424B_TestCase()); 19 $tickets->addTestCase(new Doctrine_Ticket_424C_TestCase()); 15 20 $tickets->addTestCase(new Doctrine_Ticket_428_TestCase()); 21 $tickets->addTestCase(new Doctrine_Ticket_438_TestCase()); 16 22 $tickets->addTestCase(new Doctrine_Ticket_480_TestCase()); 17 23 $tickets->addTestCase(new Doctrine_Ticket_486_TestCase()); 18 $tickets->addTestCase(new Doctrine_Ticket_5 87_TestCase());24 $tickets->addTestCase(new Doctrine_Ticket_565_TestCase()); 19 25 $tickets->addTestCase(new Doctrine_Ticket_576_TestCase()); 20 26 $tickets->addTestCase(new Doctrine_Ticket_583_TestCase()); 27 $tickets->addTestCase(new Doctrine_Ticket_587_TestCase()); 21 28 $tickets->addTestCase(new Doctrine_Ticket_626B_TestCase()); 22 29 $tickets->addTestCase(new Doctrine_Ticket_626C_TestCase()); 30 $tickets->addTestCase(new Doctrine_Ticket_626D_TestCase()); 31 $tickets->addTestCase(new Doctrine_Ticket_638_TestCase()); 23 32 $tickets->addTestCase(new Doctrine_Ticket_642_TestCase()); 24 //If you write a ticket testcase add it here like shown above!25 33 $tickets->addTestCase(new Doctrine_Ticket_438_TestCase()); 26 $tickets->addTestCase(new Doctrine_Ticket_638_TestCase());27 34 $tickets->addTestCase(new Doctrine_Ticket_673_TestCase()); 28 $tickets->addTestCase(new Doctrine_Ticket_626D_TestCase());29 35 $tickets->addTestCase(new Doctrine_Ticket_697_TestCase()); 36 30 37 // Only uncomment the following ticket if you want to check free() performance! 31 38 //$tickets->addTestCase(new Doctrine_Ticket_710_TestCase()); 39 32 40 $tickets->addTestCase(new Doctrine_Ticket_736_TestCase()); 41 $tickets->addTestCase(new Doctrine_Ticket_741_TestCase()); 42 $tickets->addTestCase(new Doctrine_Ticket_749_TestCase()); 33 43 $tickets->addTestCase(new Doctrine_Ticket_786_TestCase()); 34 44 $tickets->addTestCase(new Doctrine_Ticket_876_TestCase()); 35 45 $test->addTestCase($tickets); 36 46 37 // Connection drivers (not yet fully tested)38 $driver = new GroupTest( "Driver tests", 'driver');47 // Connection Tests (not yet fully tested) 48 $driver = new GroupTest('Driver Tests', 'driver'); 39 49 $driver->addTestCase(new Doctrine_Connection_Pgsql_TestCase()); 40 50 $driver->addTestCase(new Doctrine_Connection_Oracle_TestCase()); … … 46 56 $test->addTestCase($driver); 47 57 48 // Transaction module(FULLY TESTED)49 $transaction = new GroupTest( "Transaction tests", 'transaction');58 // Transaction Tests (FULLY TESTED) 59 $transaction = new GroupTest('Transaction Tests', 'transaction'); 50 60 $transaction->addTestCase(new Doctrine_Transaction_TestCase()); 51 61 $transaction->addTestCase(new Doctrine_Transaction_Firebird_TestCase()); … … 58 68 $test->addTestCase($transaction); 59 69 60 // DataDict module(FULLY TESTED)61 $data_dict = new GroupTest('DataDict tests', 'data_dict');70 // DataDict Tests (FULLY TESTED) 71 $data_dict = new GroupTest('DataDict Tests', 'data_dict'); 62 72 $data_dict->addTestCase(new Doctrine_DataDict_TestCase()); 63 73 $data_dict->addTestCase(new Doctrine_DataDict_Firebird_TestCase()); … … 70 80 $test->addTestCase($data_dict); 71 81 72 // Sequence module(not yet fully tested)73 $sequence = new GroupTest('Sequence tests','sequence');82 // Sequence Tests (not yet fully tested) 83 $sequence = new GroupTest('Sequence Tests', 'sequence'); 74 84 $sequence->addTestCase(new Doctrine_Sequence_TestCase()); 75 85 $sequence->addTestCase(new Doctrine_Sequence_Firebird_TestCase()); … … 82 92 $test->addTestCase($sequence); 83 93 84 // Export module (not yet fully tested) 85 $export = new GroupTest('Export tests','export'); 86 //$export->addTestCase(new Doctrine_Export_Reporter_TestCase()); 94 // Export Tests (not yet fully tested) 95 $export = new GroupTest('Export Tests', 'export'); 87 96 $export->addTestCase(new Doctrine_Export_Firebird_TestCase()); 88 97 $export->addTestCase(new Doctrine_Export_Informix_TestCase()); … … 97 106 $test->addTestCase($export); 98 107 99 //$test->addTestCase(new Doctrine_CascadingDelete_TestCase()); 100 101 // Import module (not yet fully tested) 102 $import = new GroupTest('Import tests','import'); 103 //$import->addTestCase(new Doctrine_Import_TestCase()); 108 // Import Tests (not yet fully tested) 109 $import = new GroupTest('Import Tests', 'import'); 110 $import->addTestCase(new Doctrine_Import_TestCase()); 104 111 $import->addTestCase(new Doctrine_Import_Firebird_TestCase()); 105 112 $import->addTestCase(new Doctrine_Import_Informix_TestCase()); … … 113 120 $test->addTestCase($import); 114 121 115 // Expression module(not yet fully tested)116 $expression = new GroupTest('Expression tests','expression');122 // Expression Tests (not yet fully tested) 123 $expression = new GroupTest('Expression Tests', 'expression'); 117 124 $expression->addTestCase(new Doctrine_Expression_TestCase()); 118 125 $expression->addTestCase(new Doctrine_Expression_Driver_TestCase()); … … 126 133 $test->addTestCase($expression); 127 134 128 // Core 129 $core = new GroupTest('Core tests: Access, Configurable, Manager, Connection, Table, UnitOfWork, Collection, Hydrate, Tokenizer','core');135 // Core Tests 136 $core = new GroupTest('Core Test', 'core'); 130 137 $core->addTestCase(new Doctrine_Base_TestCase()); 131 138 $core->addTestCase(new Doctrine_Access_TestCase()); 132 //$core->addTestCase(new Doctrine_Configurable_TestCase());139 $core->addTestCase(new Doctrine_Configurable_TestCase()); 133 140 $core->addTestCase(new Doctrine_Manager_TestCase()); 134 141 $core->addTestCase(new Doctrine_Connection_TestCase()); 135 142 $core->addTestCase(new Doctrine_Table_TestCase()); 136 143 $core->addTestCase(new Doctrine_UnitOfWork_TestCase()); 137 //$core->addTestCase(new Doctrine_Collection_TestCase());144 $core->addTestCase(new Doctrine_Collection_TestCase()); 138 145 $core->addTestCase(new Doctrine_Collection_Snapshot_TestCase()); 139 146 $core->addTestCase(new Doctrine_Hydrate_FetchMode_TestCase()); 140 147 $core->addTestCase(new Doctrine_Tokenizer_TestCase()); 141 //$core->addTestCase(new Doctrine_Collection_Offset_TestCase());142 //$core->addTestCase(new Doctrine_BatchIterator_TestCase());148 $core->addTestCase(new Doctrine_Collection_Offset_TestCase()); 149 $core->addTestCase(new Doctrine_BatchIterator_TestCase()); 143 150 $core->addTestCase(new Doctrine_Hydrate_TestCase()); 144 151 $test->addTestCase($core); 145 152 146 // Relation handling147 $relation = new GroupTest('Relation tests: includes TreeStructure','relation');153 // Relation Tests 154 $relation = new GroupTest('Relation Tests', 'relation'); 148 155 $relation->addTestCase(new Doctrine_TreeStructure_TestCase()); 149 156 $relation->addTestCase(new Doctrine_Relation_TestCase()); 150 //$relation->addTestCase(new Doctrine_Relation_Access_TestCase());151 //$relation->addTestCase(new Doctrine_Relation_ManyToMany_TestCase());157 $relation->addTestCase(new Doctrine_Relation_Access_TestCase()); 158 $relation->addTestCase(new Doctrine_Relation_ManyToMany_TestCase()); 152 159 $relation->addTestCase(new Doctrine_Relation_ManyToMany2_TestCase()); 153 160 $relation->addTestCase(new Doctrine_Relation_OneToMany_TestCase()); … … 157 164 $test->addTestCase($relation); 158 165 159 // Data types160 $data_types = new GroupTest('Data Types tests: Enum and Boolean','data_types');166 // Data Types Tests 167 $data_types = new GroupTest('Data Types Tests', 'data_types'); 161 168 $data_types->addTestCase(new Doctrine_DataType_Enum_TestCase()); 162 169 $data_types->addTestCase(new Doctrine_DataType_Boolean_TestCase()); 163 170 $test->addTestCase($data_types); 164 171 165 // Utility components 166 $plugins = new GroupTest('Plugin tests: View, Validator, Hook','plugins'); 167 //$utility->addTestCase(new Doctrine_PessimisticLocking_TestCase()); 168 //$plugins->addTestCase(new Doctrine_Plugin_TestCase()); 169 $plugins->addTestCase(new Doctrine_View_TestCase()); 170 $plugins->addTestCase(new Doctrine_AuditLog_TestCase()); 171 $plugins->addTestCase(new Doctrine_Validator_TestCase()); 172 $plugins->addTestCase(new Doctrine_Validator_Future_TestCase()); 173 $plugins->addTestCase(new Doctrine_Validator_Past_TestCase()); 174 $plugins->addTestCase(new Doctrine_Hook_TestCase()); 175 $plugins->addTestCase(new Doctrine_I18n_TestCase()); 176 $test->addTestCase($plugins); 177 178 // Db component 179 $db = new GroupTest('Db tests: Db and Profiler','db'); 172 // Behaviors Testing 173 $behaviors = new GroupTest('Behaviors Tests', 'behaviors'); 174 //$behaviors->addTestCase(new Doctrine_Plugin_TestCase()); 175 $behaviors->addTestCase(new Doctrine_View_TestCase()); 176 $behaviors->addTestCase(new Doctrine_AuditLog_TestCase()); 177 $behaviors->addTestCase(new Doctrine_Validator_TestCase()); 178 $behaviors->addTestCase(new Doctrine_Validator_Future_TestCase()); 179 $behaviors->addTestCase(new Doctrine_Validator_Past_TestCase()); 180 $behaviors->addTestCase(new Doctrine_Hook_TestCase()); 181 $behaviors->addTestCase(new Doctrine_I18n_TestCase()); 182 $test->addTestCase($behaviors); 183 184 // Db Tests 185 $db = new GroupTest('Db Tests', 'db'); 180 186 $db->addTestCase(new Doctrine_Db_TestCase()); 181 187 $db->addTestCase(new Doctrine_Connection_Profiler_TestCase()); 182 188 $test->addTestCase($db); 183 189 184 // Event listeners185 $event_listener = new GroupTest('EventListener tests','event_listener');190 // Event Listener Tests 191 $event_listener = new GroupTest('EventListener Tests','event_listener'); 186 192 $event_listener->addTestCase(new Doctrine_EventListener_TestCase()); 187 193 $event_listener->addTestCase(new Doctrine_EventListener_Chain_TestCase()); 188 194 $test->addTestCase($event_listener); 189 195 190 // Query tests191 $query_tests = new GroupTest('Query tests','query_test');196 // Query Tests 197 $query_tests = new GroupTest('Query Tests','query'); 192 198 $query_tests->addTestCase(new Doctrine_Query_Condition_TestCase()); 193 199 $query_tests->addTestCase(new Doctrine_Query_MultiJoin_TestCase()); … … 200 206 $query_tests->addTestCase(new Doctrine_Query_Check_TestCase()); 201 207 $query_tests->addTestCase(new Doctrine_Query_Limit_TestCase()); 202 //$query_tests->addTestCase(new Doctrine_Query_IdentifierQuoting_TestCase());208 $query_tests->addTestCase(new Doctrine_Query_IdentifierQuoting_TestCase()); 203 209 $query_tests->addTestCase(new Doctrine_Query_Update_TestCase()); 204 210 $query_tests->addTestCase(new Doctrine_Query_Delete_TestCase()); … … 208 214 $query_tests->addTestCase(new Doctrine_Query_Subquery_TestCase()); 209 215 $query_tests->addTestCase(new Doctrine_Query_Driver_TestCase()); 210 $query_tests->addTestCase(new Doctrine_Record_Hook_TestCase());211 216 $query_tests->addTestCase(new Doctrine_Query_AggregateValue_TestCase()); 212 217 $query_tests->addTestCase(new Doctrine_Query_Where_TestCase()); … … 223 228 $test->addTestCase($query_tests); 224 229 225 // Record 226 $record = new GroupTest('Record tests','record'); 230 // Record Tests 231 $record = new GroupTest('Record Tests', 'record'); 232 $record->addTestCase(new Doctrine_Record_Hook_TestCase()); 233 $record->addTestCase(new Doctrine_Record_CascadingDelete_TestCase()); 227 234 $record->addTestCase(new Doctrine_Record_Filter_TestCase()); 228 235 $record->addTestCase(new Doctrine_Record_TestCase()); 229 236 $record->addTestCase(new Doctrine_Record_State_TestCase()); 230 237 $record->addTestCase(new Doctrine_Record_SerializeUnserialize_TestCase()); 231 // This test used to segfault php because of infinite recursion in Connection/UnitOfWork232 238 $record->addTestCase(new Doctrine_Record_Lock_TestCase()); 233 239 $record->addTestCase(new Doctrine_Record_ZeroValues_TestCase()); 234 //$record->addTestCase(new Doctrine_Record_SaveBlankRecord_TestCase());240 $record->addTestCase(new Doctrine_Record_SaveBlankRecord_TestCase()); 235 241 $record->addTestCase(new Doctrine_Record_Inheritance_TestCase()); 236 242 $record->addTestCase(new Doctrine_Record_Synchronize_TestCase()); 237 243 $test->addTestCase($record); 238 244 239 $test->addTestCase(new Doctrine_CustomPrimaryKey_TestCase()); 240 $test->addTestCase(new Doctrine_CustomResultSetOrder_TestCase()); 241 242 $test->addTestCase(new Doctrine_CtiColumnAggregation_TestCase()); 243 $test->addTestCase(new Doctrine_ColumnAggregationInheritance_TestCase()); 244 $test->addTestCase(new Doctrine_ClassTableInheritance_TestCase()); 245 $test->addTestCase(new Doctrine_ColumnAlias_TestCase()); 246 247 248 $test->addTestCase(new Doctrine_RawSql_TestCase()); 249 250 $test->addTestCase(new Doctrine_NewCore_TestCase()); 251 252 $test->addTestCase(new Doctrine_Template_TestCase()); 253 $test->addTestCase(new Doctrine_NestedSet_SingleRoot_TestCase()); 254 255 // Search tests 256 $search = new GroupTest('Search tests','search'); 245 // Inheritance Tests 246 $inheritance = new GroupTest('Inheritance Tests', 'inheritance'); 247 $inheritance->addTestCase(new Doctrine_CtiColumnAggregation_TestCase()); 248 $inheritance->addTestCase(new Doctrine_ColumnAggregationInheritance_TestCase()); 249 $inheritance->addTestCase(new Doctrine_ClassTableInheritance_TestCase()); 250 $inheritance->addTestCase(new Doctrine_Query_ApplyInheritance_TestCase()); 251 $test->addTestCase($inheritance); 252 253 // Search Tests 254 $search = new GroupTest('Search Tests', 'search'); 257 255 $search->addTestCase(new Doctrine_Search_TestCase()); 258 256 $search->addTestCase(new Doctrine_Search_Query_TestCase()); 259 257 $search->addTestCase(new Doctrine_Search_File_TestCase()); 260 261 258 $test->addTestCase($search); 262 259 263 // Cache tests264 $cache = new GroupTest('Cache tests','cache');260 // Cache Tests 261 $cache = new GroupTest('Cache Tests', 'cache'); 265 262 $cache->addTestCase(new Doctrine_Query_Cache_TestCase()); 266 263 $cache->addTestCase(new Doctrine_Cache_Apc_TestCase()); 267 //$cache->addTestCase(new Doctrine_Cache_Memcache_TestCase());268 //$cache->addTestCase(new Doctrine_Cache_Sqlite_TestCase());269 //$cache->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());270 //$cache->addTestCase(new Doctrine_Cache_FileTestCase());271 //$cache->addTestCase(new Doctrine_Cache_SqliteTestCase());264 $cache->addTestCase(new Doctrine_Cache_Memcache_TestCase()); 265 $cache->addTestCase(new Doctrine_Cache_Sqlite_TestCase()); 266 $cache->addTestCase(new Doctrine_Cache_Query_Sqlite_TestCase()); 267 $cache->addTestCase(new Doctrine_Cache_FileTestCase()); 268 $cache->addTestCase(new Doctrine_Cache_SqliteTestCase()); 272 269 //$cache->addTestCase(new Doctrine_Cache_TestCase()); 273 270 $test->addTestCase($cache); 274 271 275 272 // Migration Tests 276 $migration = new GroupTest('Migration tests','migration');273 $migration = new GroupTest('Migration Tests', 'migration'); 277 274 $migration->addTestCase(new Doctrine_Migration_TestCase()); 278 //$migration->addTestCase(new Doctrine_Migration_Mysql_TestCase());279 275 $test->addTestCase($migration); 280 276 281 $test->addTestCase(new Doctrine_Query_ApplyInheritance_TestCase()); 282 283 $parser = new GroupTest('Parser tests', 'parser'); 277 // File Parser Tests 278 $parser = new GroupTest('Parser Tests', 'parser'); 284 279 $parser->addTestCase(new Doctrine_Parser_TestCase()); 285 280 $test->addTestCase($parser); 286 281 282 // Data Fixtures Tests 287 283 $data = new GroupTest('Data exporting/importing fixtures', 'data_fixtures'); 288 284 $data->addTestCase(new Doctrine_Data_Import_TestCase()); … … 290 286 $test->addTestCase($data); 291 287 292 $jwage = new GroupTest('Jwage', 'jwage'); 293 $jwage->addTestCase(new Doctrine_Jwage_TestCase()); 294 $test->addTestCase($jwage); 288 // Unsorted Tests. These need to be sorted and placed in the appropriate group 289 $unsorted = new GroupTest('Unsorted Tests', 'unsorted'); 290 $unsorted->addTestCase(new Doctrine_CustomPrimaryKey_TestCase()); 291 $unsorted->addTestCase(new Doctrine_CustomResultSetOrder_TestCase()); 292 $unsorted->addTestCase(new Doctrine_ColumnAlias_TestCase()); 293 //$unsorted->addTestCase(new Doctrine_RawSql_TestCase()); 294 $unsorted->addTestCase(new Doctrine_NewCore_TestCase()); 295 $unsorted->addTestCase(new Doctrine_Template_TestCase()); 296 $unsorted->addTestCase(new Doctrine_NestedSet_SingleRoot_TestCase()); 297 $unsorted->addTestCase(new Doctrine_PessimisticLocking_TestCase()); 298 $test->addTestCase($unsorted); 295 299 296 300 $test->run(); 297 301 298 echo memory_get_peak_usage() / 1024 . "\n";302 echo "\nMemory Usage: " . memory_get_peak_usage() / 1024 . "\n"; -
branches/0.10/tests/Ticket/741TestCase.php
r3576 r4029 27 27 28 28 } 29 30 31 29 32 30 class Parent741 extends Doctrine_Record -
branches/0.10/tests/Ticket/749TestCase.php
r3884 r4029 46 46 public function testSelectDataFromSubclassAsCollection() 47 47 { 48 $records = Doctrine_Query::create()->query(' 49 FROM Record749 r ORDER BY r.title 50 ', array()); 48 $records = Doctrine_Query::create()->query('FROM Record749 r ORDER BY r.title', array()); 51 49 52 50 $this->verifyRecords($records); … … 55 53 public function testSelectDataFromParentClassAsCollection() 56 54 { 57 $records = Doctrine_Query::create()->query(' 58 FROM Parent749 p ORDER BY p.title 59 ', array()); 55 $records = Doctrine_Query::create()->query('FROM Parent749 p ORDER BY p.title', array()); 60 56 61 57 $this->verifyRecords($records); … … 79 75 $this->assertEqual($record['Related']['content'], $expected['content']); 80 76 } catch (Exception $e) { 81 $this->fail('Caught exception when trying to get related content .');77 $this->fail('Caught exception when trying to get related content: ' . $e->getMessage()); 82 78 } 83 79 } … … 99 95 $this->hasColumn('type', 'integer', 11, array ()); 100 96 101 $this-> option('subclasses', array('Record749'));97 $this->setSubclasses(array('Record749' => array('type' => 1))); 102 98 } 103 99 … … 120 116 $this->hasOne('RelatedRecord749 as Related', array('local' => 'id', 121 117 'foreign' => 'record_id')); 122 123 $this->setInheritanceMap(array('type' => '1'));124 118 } 125 119 }