| @@ 53-66 (lines=14) @@ | ||
| 50 | $this->resetDBSchema(true); |
|
| 51 | } |
|
| 52 | ||
| 53 | public function testMySQLCreateTableOptions() { |
|
| 54 | if(!(DB::get_conn() instanceof MySQLDatabase)) { |
|
| 55 | $this->markTestSkipped('MySQL only'); |
|
| 56 | } |
|
| 57 | ||
| 58 | ||
| 59 | $ret = DB::query(sprintf( |
|
| 60 | 'SHOW TABLE STATUS WHERE "Name" = \'%s\'', |
|
| 61 | 'DatabaseTest_MyObject' |
|
| 62 | ))->first(); |
|
| 63 | $this->assertEquals($ret['Engine'],'InnoDB', |
|
| 64 | "MySQLDatabase tables can be changed to InnoDB through DataObject::\$create_table_options" |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | ||
| 68 | function testIsSchemaUpdating() { |
|
| 69 | $schema = DB::get_schema(); |
|
| @@ 250-263 (lines=14) @@ | ||
| 247 | $this->assertEquals('Phil', $comment->Name); |
|
| 248 | } |
|
| 249 | ||
| 250 | public function testGetCaseInsensitive() { |
|
| 251 | // Test get_one() with bad case on the classname |
|
| 252 | // Note: This will succeed only if the underlying DB server supports case-insensitive |
|
| 253 | // table names (e.g. such as MySQL, but not SQLite3) |
|
| 254 | if(!(DB::get_conn() instanceof MySQLDatabase)) { |
|
| 255 | $this->markTestSkipped('MySQL only'); |
|
| 256 | } |
|
| 257 | ||
| 258 | $subteam1 = DataObject::get_one('dataobjecttest_subteam', array( |
|
| 259 | '"DataObjectTest_Team"."Title"' => 'Subteam 1' |
|
| 260 | ), true); |
|
| 261 | $this->assertNotEmpty($subteam1); |
|
| 262 | $this->assertEquals($subteam1->Title, "Subteam 1"); |
|
| 263 | } |
|
| 264 | ||
| 265 | public function testGetSubclassFields() { |
|
| 266 | /* Test that fields / has_one relations from the parent table and the subclass tables are extracted */ |
|