|
@@ 862-876 (lines=15) @@
|
| 859 |
|
self::assertCount(1, $addresses->matching($criteria)); |
| 860 |
|
} |
| 861 |
|
|
| 862 |
|
public function testMatchingCriteriaContainsComparison() |
| 863 |
|
{ |
| 864 |
|
$this->loadFixture(); |
| 865 |
|
|
| 866 |
|
$repository = $this->em->getRepository(CmsUser::class); |
| 867 |
|
|
| 868 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->contains('name', 'Foobar'))); |
| 869 |
|
self::assertCount(0, $users); |
| 870 |
|
|
| 871 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->contains('name', 'Rom'))); |
| 872 |
|
self::assertCount(1, $users); |
| 873 |
|
|
| 874 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->contains('status', 'dev'))); |
| 875 |
|
self::assertCount(2, $users); |
| 876 |
|
} |
| 877 |
|
|
| 878 |
|
public function testMatchingCriteriaStartsWithComparison() |
| 879 |
|
{ |
|
@@ 878-892 (lines=15) @@
|
| 875 |
|
self::assertCount(2, $users); |
| 876 |
|
} |
| 877 |
|
|
| 878 |
|
public function testMatchingCriteriaStartsWithComparison() |
| 879 |
|
{ |
| 880 |
|
$this->loadFixture(); |
| 881 |
|
|
| 882 |
|
$repository = $this->em->getRepository(CmsUser::class); |
| 883 |
|
|
| 884 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->startsWith('name', 'Foo'))); |
| 885 |
|
self::assertCount(0, $users); |
| 886 |
|
|
| 887 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->startsWith('name', 'R'))); |
| 888 |
|
self::assertCount(1, $users); |
| 889 |
|
|
| 890 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->startsWith('status', 'de'))); |
| 891 |
|
self::assertCount(2, $users); |
| 892 |
|
} |
| 893 |
|
|
| 894 |
|
public function testMatchingCriteriaEndsWithComparison() |
| 895 |
|
{ |
|
@@ 894-908 (lines=15) @@
|
| 891 |
|
self::assertCount(2, $users); |
| 892 |
|
} |
| 893 |
|
|
| 894 |
|
public function testMatchingCriteriaEndsWithComparison() |
| 895 |
|
{ |
| 896 |
|
$this->loadFixture(); |
| 897 |
|
|
| 898 |
|
$repository = $this->em->getRepository(CmsUser::class); |
| 899 |
|
|
| 900 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->endsWith('name', 'foo'))); |
| 901 |
|
self::assertCount(0, $users); |
| 902 |
|
|
| 903 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->endsWith('name', 'oman'))); |
| 904 |
|
self::assertCount(1, $users); |
| 905 |
|
|
| 906 |
|
$users = $repository->matching(new Criteria(Criteria::expr()->endsWith('status', 'ev'))); |
| 907 |
|
self::assertCount(2, $users); |
| 908 |
|
} |
| 909 |
|
|
| 910 |
|
/** |
| 911 |
|
* @group DDC-2478 |