Skip to content

Commit 91e9af2

Browse files
committed
Fixed QueryBuilderTest for firebird < 3.0.0
1 parent 49af115 commit 91e9af2

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/QueryBuilderTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,22 @@ public function testCreateTableWithAutoIncrement()
413413

414414
$this->assertEquals(4, (new Query())->from('autoincrement_table')->max('id', $this->getConnection(false)));
415415
}
416+
417+
/**
418+
* @dataProvider insertProvider
419+
* @param string $table
420+
* @param array $columns
421+
* @param array $params
422+
* @param string $expectedSQL
423+
* @param array $expectedParams
424+
*/
425+
public function testInsert($table, $columns, $params, $expectedSQL, $expectedParams) {
426+
$db = $this->getConnection(false);
427+
if (is_object($columns) && $columns instanceof \yii\db\Query && version_compare($db->firebird_version, '3.0.0', '<')) {
428+
$this->setExpectedException('\yii\base\NotSupportedException', 'Firebird < 3.0.0 has the "Unstable Cursor" problem');
429+
}
430+
parent::testInsert($table, $columns, $params, $expectedSQL, $expectedParams);
431+
}
416432

417433
public function upsertProvider()
418434
{
@@ -485,6 +501,23 @@ public function upsertProvider()
485501
return $newData;
486502
}
487503

504+
/**
505+
* @depends testInitFixtures
506+
* @dataProvider upsertProvider
507+
* @param string $table
508+
* @param array $insertColumns
509+
* @param array|null $updateColumns
510+
* @param string|string[] $expectedSQL
511+
* @param array $expectedParams
512+
*/
513+
public function testUpsert($table, $insertColumns, $updateColumns, $expectedSQL, $expectedParams) {
514+
$db = $this->getConnection(false);
515+
if (is_object($insertColumns) && $insertColumns instanceof \yii\db\Query && version_compare($db->firebird_version, '3.0.0', '<')) {
516+
$this->setExpectedException('\yii\base\NotSupportedException', 'Firebird < 3.0.0 has the "Unstable Cursor" problem');
517+
}
518+
parent::testUpsert($table, $insertColumns, $updateColumns, $expectedSQL, $expectedParams);
519+
}
520+
488521
public function batchInsertProvider()
489522
{
490523
$tests = parent::batchInsertProvider();

0 commit comments

Comments
 (0)