/**
  * test that listDetailedSources with a named table that doesn't exist.
  *
  * @return void
  */
 public function testListDetailedSourcesNamed()
 {
     $this->loadFixtures('Apple');
     $result = $this->Dbo->listDetailedSources('imaginary');
     $this->assertEquals(array(), $result, 'Should be empty when table does not exist.');
     $result = $this->Dbo->listDetailedSources();
     $tableName = $this->Dbo->fullTableName('apples', false, false);
     $this->assertTrue(isset($result[$tableName]), 'Key should exist');
 }
 /**
  * test altering the table settings with schema.
  *
  * @return void
  */
 function testAlteringTableParameters()
 {
     App::import('Model', 'CakeSchema');
     $this->Dbo->cacheSources = $this->Dbo->testing = false;
     $schema1 = new CakeSchema(array('name' => 'AlterTest1', 'connection' => 'test', 'altertest' => array('id' => array('type' => 'integer', 'null' => false, 'default' => 0), 'name' => array('type' => 'string', 'null' => false, 'length' => 50), 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_general_ci', 'engine' => 'MyISAM'))));
     $this->Dbo->rawQuery($this->Dbo->createSchema($schema1));
     $schema2 = new CakeSchema(array('name' => 'AlterTest1', 'connection' => 'test', 'altertest' => array('id' => array('type' => 'integer', 'null' => false, 'default' => 0), 'name' => array('type' => 'string', 'null' => false, 'length' => 50), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'))));
     $result = $this->Dbo->alterSchema($schema2->compare($schema1));
     $this->assertContains('DEFAULT CHARSET=utf8', $result);
     $this->assertContains('ENGINE=InnoDB', $result);
     $this->assertContains('COLLATE=utf8_general_ci', $result);
     $this->Dbo->rawQuery($result);
     $result = $this->Dbo->listDetailedSources('altertest');
     $this->assertEqual($result['Collation'], 'utf8_general_ci');
     $this->assertEqual($result['Engine'], 'InnoDB');
     $this->assertEqual($result['charset'], 'utf8');
     $this->Dbo->rawQuery($this->Dbo->dropSchema($schema1));
 }