Passed
Pull Request — master (#376)
by Alexander
03:40 queued 01:00
created

BetweenColumnsConditionTest::testConstructor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\QueryBuilder\Conditions;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Db\Exception\InvalidArgumentException;
9
use Yiisoft\Db\QueryBuilder\Conditions\BetweenColumnsCondition;
10
11
/**
12
 * @group db
13
 */
14
final class BetweenColumnsConditionTest extends TestCase
15
{
16
    public function testConstructor(): void
17
    {
18
        $condition = new BetweenColumnsCondition(42, 'BETWEEN', 'min_value', 'max_value');
19
        $this->assertSame(42, $condition->getValue());
20
        $this->assertSame('BETWEEN', $condition->getOperator());
21
        $this->assertSame('min_value', $condition->getIntervalStartColumn());
22
        $this->assertSame('max_value', $condition->getIntervalEndColumn());
23
    }
24
25
    public function testException(): void
26
    {
27
        $this->expectException(InvalidArgumentException::class);
28
        $this->expectExceptionMessage("Operator 'between' requires three operands.");
29
        BetweenColumnsCondition::fromArrayDefinition('between', []);
30
    }
31
}
32