Skip to content

Commit

Permalink
Updating model tests to support Mssql driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed May 22, 2011
1 parent ad67f3e commit 82e2d9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
4 changes: 4 additions & 0 deletions lib/Cake/Test/Case/Model/ModelIntegrationTest.php
Expand Up @@ -634,6 +634,8 @@ function testSchema() {
* @return void
*/
function testDeconstructFieldsTime() {
$this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.');

$this->loadFixtures('Apple');
$TestModel = new Apple();

Expand Down Expand Up @@ -721,6 +723,8 @@ function testDeconstructFieldsTime() {
* @return void
*/
function testDeconstructFieldsDateTime() {
$this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.');

$this->loadFixtures('Apple');
$TestModel = new Apple();

Expand Down
23 changes: 6 additions & 17 deletions lib/Cake/Test/Case/Model/ModelReadTest.php
Expand Up @@ -79,8 +79,8 @@ function testFetchingNonUniqueFKJoinTableRecords() {
*/
function testGroupBy() {
$db = ConnectionManager::getDataSource('test');
$isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle;
$message = 'Postgres and Oracle have strict GROUP BY and are incompatible with this test.';
$isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle || $this->db instanceof Mssql;
$message = 'Postgres, Oracle, SQLite and SQL Server have strict GROUP BY and are incompatible with this test.';

if ($this->skipIf($isStrictGroupBy, $message )) {
return;
Expand Down Expand Up @@ -367,13 +367,6 @@ function testParameterMismatch() {
* @return void
*/
function testVeryStrangeUseCase() {
$message = "skipping SELECT * FROM ? WHERE ? = ? AND ? = ?; prepared query.";
$message .= " MSSQL is incompatible with this test.";

if ($this->skipIf($this->db instanceof Mssql, $message)) {
return;
}

$this->loadFixtures('Article', 'User', 'Tag', 'ArticlesTag');
$Article = new Article();

Expand Down Expand Up @@ -3955,7 +3948,7 @@ function testFindAllWithConditionInChildQuery() {

$TestModel = new Basket();
$recursive = 3;
$result = $TestModel->find('all', compact('conditions', 'recursive'));
$result = $TestModel->find('all', compact('recursive'));

$expected = array(
array(
Expand Down Expand Up @@ -6629,13 +6622,9 @@ function testFindFirstNoIdUsed() {
* @return void
*/
function testFindCountDistinct() {
$skip = $this->skipIf(
$this->db instanceof Sqlite,
'SELECT COUNT(DISTINCT field) is not compatible with SQLite'
);
if ($skip) {
return;
}
$this->skipIf($this->db instanceof Sqlite, 'SELECT COUNT(DISTINCT field) is not compatible with SQLite');
$this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.');

$this->loadFixtures('Project');
$TestModel = new Project();
$TestModel->create(array('name' => 'project')) && $TestModel->save();
Expand Down

0 comments on commit 82e2d9e

Please sign in to comment.