Skip to content

Commit

Permalink
Updating more tests with boolean handling, maybe in the near future f…
Browse files Browse the repository at this point in the history
…ixing this for both mysql and postgres is coming
  • Loading branch information
lorenzo committed Oct 27, 2010
1 parent eb49181 commit 8d80188
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
Expand Up @@ -602,25 +602,25 @@ function testIndexGeneration() {
$this->Dbo->query('CREATE INDEX pointless_bool ON ' . $name . '("bool")');
$this->Dbo->query('CREATE UNIQUE INDEX char_index ON ' . $name . '("small_char")');
$expected = array(
'PRIMARY' => array('column' => 'id', 'unique' => true),
'pointless_bool' => array('column' => 'bool', 'unique' => false),
'char_index' => array('column' => 'small_char', 'unique' => true),
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
'char_index' => array('column' => 'small_char', 'unique' => 1),

);
$result = $this->Dbo->index($name);
$this->Dbo->query('DROP TABLE ' . $name);
$this->assertEqual($expected, $result);

$this->Dbo->query('DROP TABLE ' . $name);
$name = $this->Dbo->fullTableName('index_test_2', false);
$this->Dbo->query('CREATE TABLE ' . $name . ' ("id" serial NOT NULL PRIMARY KEY, "bool" integer, "small_char" varchar(50), "description" varchar(40) )');
$this->Dbo->query('CREATE UNIQUE INDEX multi_col ON ' . $name . '("small_char", "bool")');
$expected = array(
'PRIMARY' => array('column' => 'id', 'unique' => true),
'multi_col' => array('column' => array('small_char', 'bool'), 'unique' => true),
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'multi_col' => array('column' => array('small_char', 'bool'), 'unique' => 1),
);
$result = $this->Dbo->index($name);
$this->assertEqual($expected, $result);
$this->Dbo->query('DROP TABLE ' . $name);
$this->assertEqual($expected, $result);
}

/**
Expand Down Expand Up @@ -697,15 +697,15 @@ function testAlterIndexes() {
'name' => 'AlterTest2',
'connection' => 'test',
'altertest' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
'name' => array('type' => 'string', 'null' => false, 'length' => 50),
'group1' => array('type' => 'integer', 'null' => true),
'group2' => array('type' => 'integer', 'null' => true),
'id' => array('type' => 'integer', 'null' => 0, 'default' => 0),
'name' => array('type' => 'string', 'null' => 0, 'length' => 50),
'group1' => array('type' => 'integer', 'null' => 1),
'group2' => array('type' => 'integer', 'null' => 1),
'indexes' => array(
'name_idx' => array('column' => 'name', 'unique' => false),
'group_idx' => array('column' => 'group1', 'unique' => false),
'compound_idx' => array('column' => array('group1', 'group2'), 'unique' => false),
'PRIMARY' => array('column' => 'id', 'unique' => true)
'name_idx' => array('column' => 'name', 'unique' => 0),
'group_idx' => array('column' => 'group1', 'unique' => 0),
'compound_idx' => array('column' => array('group1', 'group2'), 'unique' => 0),
'PRIMARY' => array('column' => 'id', 'unique' => 1)
)
)
));
Expand All @@ -719,15 +719,15 @@ function testAlterIndexes() {
'name' => 'AlterTest3',
'connection' => 'test',
'altertest' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
'name' => array('type' => 'string', 'null' => false, 'length' => 50),
'group1' => array('type' => 'integer', 'null' => true),
'group2' => array('type' => 'integer', 'null' => true),
'id' => array('type' => 'integer', 'null' => 0, 'default' => 0),
'name' => array('type' => 'string', 'null' => 0, 'length' => 50),
'group1' => array('type' => 'integer', 'null' => 1),
'group2' => array('type' => 'integer', 'null' => 1),
'indexes' => array(
'name_idx' => array('column' => 'name', 'unique' => true),
'group_idx' => array('column' => 'group2', 'unique' => false),
'compound_idx' => array('column' => array('group2', 'group1'), 'unique' => false),
'another_idx' => array('column' => array('group1', 'name'), 'unique' => false))
'name_idx' => array('column' => 'name', 'unique' => 1),
'group_idx' => array('column' => 'group2', 'unique' => 0),
'compound_idx' => array('column' => array('group2', 'group1'), 'unique' => 0),
'another_idx' => array('column' => array('group1', 'name'), 'unique' => 0))
)));

$this->Dbo->query($this->Dbo->alterSchema($schema3->compare($schema2)));
Expand Down

0 comments on commit 8d80188

Please sign in to comment.