Updating tests to expand coverage of buildcolumn.

This commit is contained in:
mark_story 2009-10-29 09:26:23 -04:00
parent 23831546b5
commit aa03756238

View file

@ -3591,16 +3591,16 @@ class DboSourceTest extends CakeTestCase {
); );
$this->testDb->buildColumn($data); $this->testDb->buildColumn($data);
$this->testDb->columns = array('varchar(255)' => 1);
$data = array( $data = array(
'name' => 'testName', 'name' => 'testName',
'type' => 'varchar(255)', 'type' => 'string',
'length' => 255,
'default', 'default',
'null' => true, 'null' => true,
'key' 'key'
); );
$result = $this->testDb->buildColumn($data); $result = $this->testDb->buildColumn($data);
$expected = '`testName` DEFAULT NULL'; $expected = '`testName` varchar(255) DEFAULT NULL';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$data = array( $data = array(
@ -3653,11 +3653,11 @@ class DboSourceTest extends CakeTestCase {
function testHasAny() { function testHasAny() {
$this->testDb->hasAny($this->Model, array()); $this->testDb->hasAny($this->Model, array());
$expected = 'SELECT COUNT(`TestModel`.`id`) AS count FROM `test_models` AS `TestModel` WHERE 1 = 1'; $expected = 'SELECT COUNT(`TestModel`.`id`) AS count FROM `test_models` AS `TestModel` WHERE 1 = 1';
$this->assertEqual($this->testDb->simulated[1], $expected); $this->assertEqual(end($this->testDb->simulated), $expected);
$this->testDb->hasAny($this->Model, array('TestModel.name' => 'harry')); $this->testDb->hasAny($this->Model, array('TestModel.name' => 'harry'));
$expected = "SELECT COUNT(`TestModel`.`id`) AS count FROM `test_models` AS `TestModel` WHERE `TestModel`.`name` = 'harry'"; $expected = "SELECT COUNT(`TestModel`.`id`) AS count FROM `test_models` AS `TestModel` WHERE `TestModel`.`name` = 'harry'";
$this->assertEqual($this->testDb->simulated[2], $expected); $this->assertEqual(end($this->testDb->simulated), $expected);
} }
/** /**