Skip to content

Commit

Permalink
Fixed QueryBuilderTest for firebird < 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Apr 3, 2018
1 parent 49af115 commit 91e9af2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/QueryBuilderTest.php
Expand Up @@ -413,6 +413,22 @@ public function testCreateTableWithAutoIncrement()

$this->assertEquals(4, (new Query())->from('autoincrement_table')->max('id', $this->getConnection(false)));
}

/**
* @dataProvider insertProvider
* @param string $table
* @param array $columns
* @param array $params
* @param string $expectedSQL
* @param array $expectedParams
*/
public function testInsert($table, $columns, $params, $expectedSQL, $expectedParams) {
$db = $this->getConnection(false);
if (is_object($columns) && $columns instanceof \yii\db\Query && version_compare($db->firebird_version, '3.0.0', '<')) {
$this->setExpectedException('\yii\base\NotSupportedException', 'Firebird < 3.0.0 has the "Unstable Cursor" problem');
}
parent::testInsert($table, $columns, $params, $expectedSQL, $expectedParams);
}

public function upsertProvider()
{
Expand Down Expand Up @@ -485,6 +501,23 @@ public function upsertProvider()
return $newData;
}

/**
* @depends testInitFixtures
* @dataProvider upsertProvider
* @param string $table
* @param array $insertColumns
* @param array|null $updateColumns
* @param string|string[] $expectedSQL
* @param array $expectedParams
*/
public function testUpsert($table, $insertColumns, $updateColumns, $expectedSQL, $expectedParams) {
$db = $this->getConnection(false);
if (is_object($insertColumns) && $insertColumns instanceof \yii\db\Query && version_compare($db->firebird_version, '3.0.0', '<')) {
$this->setExpectedException('\yii\base\NotSupportedException', 'Firebird < 3.0.0 has the "Unstable Cursor" problem');
}
parent::testUpsert($table, $insertColumns, $updateColumns, $expectedSQL, $expectedParams);
}

public function batchInsertProvider()
{
$tests = parent::batchInsertProvider();
Expand Down

0 comments on commit 91e9af2

Please sign in to comment.