Skip to content

Commit

Permalink
test regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jul 3, 2022
1 parent 42757c6 commit 71fdd5f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/ConditionSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,20 @@ public function testLikeCondition(): void

$t = (clone $u)->addCondition('name', 'like', '%John%');
$this->assertCount(1, $t->export());
$t = (clone $u)->addCondition('name', 'regexp', '^Joh');
$this->assertCount(1, $t->export());

$t = (clone $u)->addCondition('name', 'like', '%john%');
$this->assertCount(1, $t->export());
$t = (clone $u)->addCondition('name', 'regexp', '^joh');
$this->assertCount(1, $t->export());

$t = (clone $u)->addCondition('created', 'like', '%19%');
$this->assertCount(2, $t->export()); // only year 2019 records

$t = (clone $u)->addCondition('created', 'regexp', '19');
$this->assertCount(2, $t->export());

$t = (clone $u)->addCondition('active', 'like', '%1%');
$this->assertCount(2, $t->export()); // only active records

Expand Down

0 comments on commit 71fdd5f

Please sign in to comment.