Skip to content

Commit

Permalink
Add test to filter layout by uiComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
bofalke committed Oct 26, 2022
1 parent 1ed7403 commit 9f939fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions features/bootstrap/DoctrineContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,13 @@ public function thereIsARouteWithRedirects(string $firstPath, string $redirectTo
}

/**
* @Given /^there is a Layout(?: with the reference "([^"]+)")*[ and]*(?: with createdAt "([^"]+)")*$/
* @Given /^there is a Layout(?: with the reference "([^"]+)")*[ and]*(?: with createdAt "([^"]+)")*(?: with the uiComponent "([^"]+)")*$/
*/
public function thereIsALayout(string $reference = 'no-reference', ?string $createdAt = null): void
public function thereIsALayout(string $reference = 'no-reference', ?string $createdAt = null, ?string $uiComponent = null): void
{
$layout = new Layout();
$layout->reference = $reference;
$layout->uiComponent = $uiComponent;
if (null !== $createdAt) {
$layout->setCreatedAt(new \DateTimeImmutable($createdAt));
}
Expand Down
8 changes: 8 additions & 0 deletions features/main/layout.feature
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,12 @@ Feature: Layout resources
And the JSON node "hydra:member[0].reference" should be equal to "layout_2"
And the JSON node "hydra:member[1].reference" should be equal to "layout_1"

@loginUser
Scenario: The layout resources can be filtered by ui components
Given there is a Layout with the reference "primary" and with the uiComponent "PrimaryLayout"
And there is a Layout with the reference "secondary" and with the uiComponent "SecondaryLayout"
When I send a "GET" request to "/_/layouts?uiComponent=PrimaryLayout"
Then the response status code should be 200
And the JSON node "hydra:member" should have "1" elements
And the JSON node "hydra:member[0].reference" should be equal to "primary"
# Todo: Order by and search filter tests needed to ensure it is implemented

0 comments on commit 9f939fd

Please sign in to comment.