Making DboMysqlTest pass when a connection with a prefix is used. Fixes #185

This commit is contained in:
mark_story 2009-10-19 20:54:02 -04:00
parent 52180d50c5
commit 3922f136da

View file

@ -273,7 +273,7 @@ class DboMysqlTest extends CakeTestCase {
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));'); $this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$this->model = new CakeTestModel(array( $this->model = new CakeTestModel(array(
'name' => 'Tinyint', 'table' => $this->db->fullTableName('tinyint', false) 'name' => 'Tinyint', 'table' => 'tinyint', 'ds' => 'test_suite'
)); ));
$result = $this->model->schema(); $result = $this->model->schema();
@ -312,7 +312,7 @@ class DboMysqlTest extends CakeTestCase {
$name = $this->db->fullTableName('simple'); $name = $this->db->fullTableName('simple');
$this->db->query('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));'); $this->db->query('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$expected = array('PRIMARY' => array('column' => 'id', 'unique' => 1)); $expected = array('PRIMARY' => array('column' => 'id', 'unique' => 1));
$result = $this->db->index($name, false); $result = $this->db->index('simple', false);
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name); $this->db->query('DROP TABLE ' . $name);
@ -322,7 +322,7 @@ class DboMysqlTest extends CakeTestCase {
'PRIMARY' => array('column' => 'id', 'unique' => 1), 'PRIMARY' => array('column' => 'id', 'unique' => 1),
'pointless_bool' => array('column' => 'bool', 'unique' => 0), 'pointless_bool' => array('column' => 'bool', 'unique' => 0),
); );
$result = $this->db->index($name, false); $result = $this->db->index('with_a_key', false);
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name); $this->db->query('DROP TABLE ' . $name);
@ -333,7 +333,7 @@ class DboMysqlTest extends CakeTestCase {
'pointless_bool' => array('column' => 'bool', 'unique' => 0), 'pointless_bool' => array('column' => 'bool', 'unique' => 0),
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0), 'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
); );
$result = $this->db->index($name, false); $result = $this->db->index('with_two_keys', false);
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name); $this->db->query('DROP TABLE ' . $name);
@ -345,7 +345,7 @@ class DboMysqlTest extends CakeTestCase {
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0), 'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0), 'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
); );
$result = $this->db->index($name, false); $result = $this->db->index('with_compound_keys', false);
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name); $this->db->query('DROP TABLE ' . $name);
@ -358,7 +358,7 @@ class DboMysqlTest extends CakeTestCase {
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0), 'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
'other_way' => array('column' => array('small_int', 'bool'), 'unique' => 0), 'other_way' => array('column' => array('small_int', 'bool'), 'unique' => 0),
); );
$result = $this->db->index($name, false); $result = $this->db->index('with_multiple_compound_keys', false);
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name); $this->db->query('DROP TABLE ' . $name);
} }