You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
41 lines
1.5 KiB
10 years ago
|
<?php
|
||
|
|
||
|
namespace yiiunit\framework\db\pgsql;
|
||
|
|
||
|
use yii\db\pgsql\Schema;
|
||
10 years ago
|
use yii\db\Query;
|
||
10 years ago
|
use yiiunit\framework\db\QueryTest;
|
||
|
use yiiunit\framework\db\SchemaTest;
|
||
|
|
||
|
/**
|
||
|
* @group db
|
||
|
* @group pgsql
|
||
|
*/
|
||
|
class PostgreSQLQueryTest extends QueryTest
|
||
|
{
|
||
|
public $driverName = 'pgsql';
|
||
10 years ago
|
|
||
|
public function testBooleanValues()
|
||
|
{
|
||
|
$db = $this->getConnection();
|
||
|
$command = $db->createCommand();
|
||
|
$command->batchInsert('bool_values',
|
||
|
['bool_col'], [
|
||
|
[true],
|
||
|
[false],
|
||
|
]
|
||
|
)->execute();
|
||
|
|
||
|
$this->assertEquals(1, (new Query())->from('bool_values')->where('bool_col = TRUE')->count('*', $db));
|
||
|
$this->assertEquals(1, (new Query())->from('bool_values')->where('bool_col = FALSE')->count('*', $db));
|
||
|
$this->assertEquals(2, (new Query())->from('bool_values')->where('bool_col IN (TRUE, FALSE)')->count('*', $db));
|
||
|
|
||
|
$this->assertEquals(1, (new Query())->from('bool_values')->where(['bool_col' => true])->count('*', $db));
|
||
|
$this->assertEquals(1, (new Query())->from('bool_values')->where(['bool_col' => false])->count('*', $db));
|
||
|
$this->assertEquals(2, (new Query())->from('bool_values')->where(['bool_col' => [true, false]])->count('*', $db));
|
||
|
|
||
|
$this->assertEquals(1, (new Query())->from('bool_values')->where('bool_col = :bool_col', ['bool_col' => true])->count('*', $db));
|
||
|
$this->assertEquals(1, (new Query())->from('bool_values')->where('bool_col = :bool_col', ['bool_col' => false])->count('*', $db));
|
||
|
}
|
||
10 years ago
|
}
|