Skip to content

Commit

Permalink
FilterProcessorTest: Add test cases to assemble predicates for EXISTS…
Browse files Browse the repository at this point in the history
… and NOT EXISTS operators
  • Loading branch information
raviks789 committed Jun 24, 2024
1 parent b46bd66 commit 23e3e9d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/FilterProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace ipl\Tests\Sql;

use ipl\Sql\Compat\FilterProcessor;
use ipl\Sql\Filter\Exists;
use ipl\Sql\Filter\In;
use ipl\Sql\Filter\NotExists;
use ipl\Sql\Filter\NotIn;
use ipl\Sql\Select;
use ipl\Stdlib\Filter;
Expand Down Expand Up @@ -93,4 +95,24 @@ public function testNotInToSql()
FilterProcessor::assemblePredicate(new NotIn(['foo', 'bar'], $select))
);
}

public function testExistsToSql()
{
$select = (new Select())->from('oof')->columns('*');

$this->assertSame(
[' EXISTS ?' => $select],
FilterProcessor::assemblePredicate(new Exists($select))
);
}

public function testNotExistsToSql()
{
$select = (new Select())->from('oof')->columns('*');

$this->assertSame(
[' NOT EXISTS ?' => $select],
FilterProcessor::assemblePredicate(new NotExists($select))
);
}
}

0 comments on commit 23e3e9d

Please sign in to comment.