Skip to content

Commit

Permalink
Fixing failing tests and issues with Sqlite.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 3, 2011
1 parent d24c408 commit 2c21fc9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 4 additions & 0 deletions lib/Cake/Model/Datasource/Database/Sqlite.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ public function resultSet($results) {
$selects = array('seqno', 'cid', 'name'); $selects = array('seqno', 'cid', 'name');
} }
while ($j < $num_fields) { while ($j < $num_fields) {
if (!isset($selects[$j])) {
$j++;
continue;
}
if (preg_match('/\bAS\s+(.*)/i', $selects[$j], $matches)) { if (preg_match('/\bAS\s+(.*)/i', $selects[$j], $matches)) {
$columnName = trim($matches[1],'"'); $columnName = trim($matches[1],'"');
} else { } else {
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ public function testCacheMethod() {
/** /**
* testLog method * testLog method
* *
* @outputBuffering enabled
* @return void * @return void
*/ */
public function testLog() { public function testLog() {
Expand Down
9 changes: 2 additions & 7 deletions lib/Cake/Test/Case/Model/ModelReadTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -345,17 +345,15 @@ public function testParameterMismatch() {
$query .= ' WHERE ' . $this->db->fullTableName('articles'); $query .= ' WHERE ' . $this->db->fullTableName('articles');
$query .= '.published = ? AND ' . $this->db->fullTableName('articles') . '.user_id = ?'; $query .= '.published = ? AND ' . $this->db->fullTableName('articles') . '.user_id = ?';
$params = array('Y'); $params = array('Y');
$this->expectError();


ob_start();
$result = $Article->query($query, $params); $result = $Article->query($query, $params);
ob_end_clean(); $this->assertEmpty($result);
$this->assertEqual($result, null);
} }


/** /**
* testVeryStrangeUseCase method * testVeryStrangeUseCase method
* *
* @expectedException PDOException
* @return void * @return void
*/ */
public function testVeryStrangeUseCase() { public function testVeryStrangeUseCase() {
Expand All @@ -368,11 +366,8 @@ public function testVeryStrangeUseCase() {
$this->db->fullTableName('articles') . '.user_id', '3', $this->db->fullTableName('articles') . '.user_id', '3',
$this->db->fullTableName('articles') . '.published', 'Y' $this->db->fullTableName('articles') . '.published', 'Y'
); );
$this->expectError();


ob_start();
$result = $Article->query($query, $param); $result = $Article->query($query, $param);
ob_end_clean();
} }


/** /**
Expand Down
5 changes: 4 additions & 1 deletion lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
$this->criticDb = $this->getMock('DboSource'); $methods = array_diff(get_class_methods('DboSource'), array('enabled'));
$methods[] = 'connect';

$this->criticDb = $this->getMock('DboSource', $methods);
$this->criticDb->fullDebug = true; $this->criticDb->fullDebug = true;
$this->db = ConnectionManager::getDataSource('test'); $this->db = ConnectionManager::getDataSource('test');
$this->_backupConfig = $this->db->config; $this->_backupConfig = $this->db->config;
Expand Down

0 comments on commit 2c21fc9

Please sign in to comment.