Skip to content

Commit ae40a00

Browse files
committed
Add tests for filtering pages by refernce, title and uiComponent
1 parent 7db786e commit ae40a00

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

features/bootstrap/DoctrineContext.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,15 @@ public function theComponentGroupHasTheAllowedComponents(string $allowedComponen
394394
}
395395

396396
/**
397-
* @Given there is a Page
397+
* @Given /^there is a Page(?: with the reference "([^"]+)")*[ and]*(?: with the title "([^"]+)")*(?: with the uiComponent "([^"]+)")*$/
398398
*/
399-
public function thereIsAPage(string $reference = 'page'): Page
399+
public function thereIsAPage(string $reference = 'page', ?string $title = null, ?string $uiComponent = null): Page
400400
{
401401
$page = new Page();
402402
$page->isTemplate = false;
403403
$page->reference = $reference;
404+
$page->setTitle($title);
405+
$page->uiComponent = $uiComponent;
404406
$this->timestampedHelper->persistTimestampedFields($page, true);
405407
$this->manager->persist($page);
406408
$this->manager->flush();

features/main/page.feature

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,30 @@ Feature: Page resources
5757
Given there is a Page
5858
When I send a "DELETE" request to the resource "page"
5959
Then the response status code should be 204
60+
61+
@loginAdmin
62+
Scenario: The page resources can be filtered by reference
63+
Given there is a Page with the reference "primary"
64+
And there is a Page with the reference "secondary"
65+
When I send a "GET" request to "/_/pages?reference=primary"
66+
Then the response status code should be 200
67+
And the JSON node "hydra:member" should have "1" elements
68+
And the JSON node "hydra:member[0].reference" should be equal to "primary"
69+
70+
@loginAdmin
71+
Scenario: The page resources can be filtered by title
72+
Given there is a Page with the reference "primary" and with the title "primary"
73+
And there is a Page with the reference "secondary" and with the title "secondary"
74+
When I send a "GET" request to "/_/pages?title=primary"
75+
Then the response status code should be 200
76+
And the JSON node "hydra:member" should have "1" elements
77+
And the JSON node "hydra:member[0].reference" should be equal to "primary"
78+
79+
@loginAdmin
80+
Scenario: The page resources can be filtered by ui component
81+
Given there is a Page with the reference "primary" and with the uiComponent "primary"
82+
And there is a Page with the reference "secondary" and with the uiComponent "secondary"
83+
When I send a "GET" request to "/_/pages?uiComponent=primary"
84+
Then the response status code should be 200
85+
And the JSON node "hydra:member" should have "1" elements
86+
And the JSON node "hydra:member[0].reference" should be equal to "primary"

0 commit comments

Comments
 (0)