From 9f939fd413ffe9bfcf2960e189a199628abc6219 Mon Sep 17 00:00:00 2001 From: bfalke Date: Wed, 26 Oct 2022 14:22:47 +0200 Subject: [PATCH] Add test to filter layout by uiComponent --- features/bootstrap/DoctrineContext.php | 5 +++-- features/main/layout.feature | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/features/bootstrap/DoctrineContext.php b/features/bootstrap/DoctrineContext.php index f103c419..1a5e145d 100644 --- a/features/bootstrap/DoctrineContext.php +++ b/features/bootstrap/DoctrineContext.php @@ -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)); } diff --git a/features/main/layout.feature b/features/main/layout.feature index 5a1783c1..341ce4e0 100644 --- a/features/main/layout.feature +++ b/features/main/layout.feature @@ -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