mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-05 23:14:40 +01:00
Fixes #13582: Added tests for all yii\db\QueryBuilder::resetSequence implementations, fixed SQLite implementation
This commit is contained in:
committed by
Alexander Makarov
parent
56c65f6079
commit
fab53b4a6e
@@ -131,4 +131,17 @@ class QueryBuilderTest extends \yiiunit\framework\db\QueryBuilderTest
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function testResetSequence()
|
||||
{
|
||||
$qb = $this->getQueryBuilder();
|
||||
|
||||
$expected = "SELECT SETVAL('\"item_id_seq\"',(SELECT COALESCE(MAX(\"id\"),0) FROM \"item\")+1,false)";
|
||||
$sql = $qb->resetSequence('item');
|
||||
$this->assertEquals($expected, $sql);
|
||||
|
||||
$expected = "SELECT SETVAL('\"item_id_seq\"',4,false)";
|
||||
$sql = $qb->resetSequence('item', 4);
|
||||
$this->assertEquals($expected, $sql);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user