Skip to content

Commit 04b4d4a

Browse files
committed
refactor(test): unifies fixtures for filter
Continues the work at #7079 and before at #6865
1 parent 5eb5971 commit 04b4d4a

File tree

8 files changed

+137
-388
lines changed

8 files changed

+137
-388
lines changed

tests/Fixtures/TestBundle/Document/Chicken.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@
1313

1414
namespace ApiPlatform\Tests\Fixtures\TestBundle\Document;
1515

16+
use ApiPlatform\Doctrine\Orm\Filter\ExactFilter;
17+
use ApiPlatform\Doctrine\Orm\Filter\PartialSearchFilter;
1618
use ApiPlatform\Metadata\Get;
19+
use ApiPlatform\Metadata\GetCollection;
20+
use ApiPlatform\Metadata\QueryParameter;
1721
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
1822

1923
#[ODM\Document]
20-
#[Get]
24+
#[GetCollection(
25+
parameters: [
26+
'chickenCoop' => new QueryParameter(filter: new ExactFilter()),
27+
'name' => new QueryParameter(filter: new ExactFilter()),
28+
'namePartial' => new QueryParameter(
29+
filter: new PartialSearchFilter(),
30+
property: 'name',
31+
),
32+
],
33+
)]
2134
class Chicken
2235
{
2336
#[ODM\Id]

tests/Fixtures/TestBundle/Entity/Chicken.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,23 @@
1313

1414
namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity;
1515

16-
use ApiPlatform\Metadata\Get;
16+
use ApiPlatform\Doctrine\Orm\Filter\ExactFilter;
17+
use ApiPlatform\Doctrine\Orm\Filter\PartialSearchFilter;
18+
use ApiPlatform\Metadata\GetCollection;
19+
use ApiPlatform\Metadata\QueryParameter;
1720
use Doctrine\ORM\Mapping as ORM;
1821

1922
#[ORM\Entity]
20-
#[Get]
23+
#[GetCollection(
24+
parameters: [
25+
'chickenCoop' => new QueryParameter(filter: new ExactFilter()),
26+
'name' => new QueryParameter(filter: new ExactFilter()),
27+
'namePartial' => new QueryParameter(
28+
filter: new PartialSearchFilter(),
29+
property: 'name',
30+
),
31+
],
32+
)]
2133
class Chicken
2234
{
2335
#[ORM\Id]

tests/Fixtures/TestBundle/Entity/DummyAuthorExact.php

Lines changed: 0 additions & 58 deletions
This file was deleted.

tests/Fixtures/TestBundle/Entity/DummyAuthorPartial.php

Lines changed: 0 additions & 58 deletions
This file was deleted.

tests/Fixtures/TestBundle/Entity/DummyBookExact.php

Lines changed: 0 additions & 86 deletions
This file was deleted.

tests/Fixtures/TestBundle/Entity/DummyBookPartial.php

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)