Skip to content

Commit d1ecf2e

Browse files
Add SQLite InconditionBuilderTest class to assert subquery IN is not supported and raise code coverage. (#20652)
1 parent ae7f548 commit d1ecf2e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
* @link https://www.yiiframework.com/
5+
* @copyright Copyright (c) 2008 Yii Software LLC
6+
* @license https://www.yiiframework.com/license/
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
namespace yiiunit\framework\db\sqlite\conditions;
12+
13+
use yii\base\NotSupportedException;
14+
use yii\db\conditions\InCondition;
15+
use yii\db\Query;
16+
use yii\db\sqlite\conditions\InConditionBuilder;
17+
use yiiunit\framework\db\DatabaseTestCase;
18+
19+
/**
20+
* @group sqlite
21+
*
22+
* @author Wilmer Arambula <[email protected]>
23+
*/
24+
final class InconditionBuilderTest extends DatabaseTestCase
25+
{
26+
public $driverName = 'sqlite';
27+
28+
public function testBuildSubqueryInCondition(): void
29+
{
30+
$db = $this->getConnection();
31+
$query = new Query();
32+
$inConditionBuilder = new InConditionBuilder($db->getQueryBuilder());
33+
34+
$inCondition = new InCondition(
35+
['id'],
36+
'in',
37+
$query->select('id')->from('users')->where(['active' => 1]),
38+
);
39+
40+
$this->expectException(NotSupportedException::class);
41+
$this->expectExceptionMessage(
42+
'yii\db\sqlite\conditions\InConditionBuilder::buildSubqueryInCondition is not supported by SQLite.',
43+
);
44+
45+
$inConditionBuilder->build($inCondition);
46+
}
47+
}

0 commit comments

Comments
 (0)