Skip to content

Commit 92bd07b

Browse files
authored
[9.x] Improve test for prepareValueAndOperator method in builder Class (#44183)
1 parent d98bdac commit 92bd07b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/Database/DatabaseQueryBuilderTest.php

+22
Original file line numberDiff line numberDiff line change
@@ -3587,6 +3587,28 @@ public function testMergeWheresCanMergeWheresAndBindings()
35873587
$this->assertEquals(['foo', 'bar'], $builder->getBindings());
35883588
}
35893589

3590+
public function testPrepareValueAndOperator()
3591+
{
3592+
$builder = $this->getBuilder();
3593+
[$value, $operator] = $builder->prepareValueAndOperator('>', '20');
3594+
$this->assertSame('>', $value);
3595+
$this->assertSame('20', $operator);
3596+
3597+
$builder = $this->getBuilder();
3598+
[$value, $operator] = $builder->prepareValueAndOperator('>', '20', true);
3599+
$this->assertSame('20', $value);
3600+
$this->assertSame('=', $operator);
3601+
}
3602+
3603+
public function testPrepareValueAndOperatorExpectException()
3604+
{
3605+
$this->expectException(InvalidArgumentException::class);
3606+
$this->expectExceptionMessage('Illegal operator and value combination.');
3607+
3608+
$builder = $this->getBuilder();
3609+
$builder->prepareValueAndOperator(null, 'like');
3610+
}
3611+
35903612
public function testProvidingNullWithOperatorsBuildsCorrectly()
35913613
{
35923614
$builder = $this->getBuilder();

0 commit comments

Comments
 (0)