Skip to content

Commit

Permalink
Simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Oct 31, 2014
1 parent 70acd2f commit bb67df4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3442,14 +3442,17 @@ public function testVirtualFieldsWithSubquery() {
);
$conditions = array('Article.id' => array(1, 2));
$contain = array('Comment.extra');

$test = ConnectionManager::getDatasource('test');
$test->getLog();
$result = $Article->find('all', compact('conditions', 'contain'));

$expected = 'SELECT `Comment`.`id`, `Comment`.`article_id`, `Comment`.`user_id`, `Comment`.`comment`, `Comment`.`published`, `Comment`.`created`,' .
' `Comment`.`updated`, (SELECT id FROM comments WHERE id = (SELECT 1)) AS `Comment__extra`' .
' FROM `cake_test`.`comments` AS `Comment` WHERE `Comment`.`article_id` IN (1, 2)';
$test = ConnectionManager::getDatasource('test');

$log = $test->getLog();
$this->assertTextEquals($expected, $log['log'][116]['query']);
$this->assertTextEquals($expected, $log['log'][count($log['log']) - 2]['query']);
}

/**
Expand Down

0 comments on commit bb67df4

Please sign in to comment.