diff --git a/config/templates/pages/event_overview.xml b/config/templates/pages/event_overview.xml new file mode 100644 index 0000000..e386244 --- /dev/null +++ b/config/templates/pages/event_overview.xml @@ -0,0 +1,57 @@ + + diff --git a/templates/pages/event_overview.html.twig b/templates/pages/event_overview.html.twig new file mode 100644 index 0000000..d3a687b --- /dev/null +++ b/templates/pages/event_overview.html.twig @@ -0,0 +1,26 @@ +{% extends "base.html.twig" %} + +{% block content %} +
+
+

{{ content.title }}

+

{{ content.article|raw }}

+
+
+ +
+
+ {% for event in content.events %} +
+

{{ event.title }}

+

{{ event.teaser }}

+

+ + View details » + +

+
+ {% endfor %} +
+
+{% endblock %} diff --git a/tests/Functional/Pages/EventOverviewTest.php b/tests/Functional/Pages/EventOverviewTest.php new file mode 100644 index 0000000..fbaab12 --- /dev/null +++ b/tests/Functional/Pages/EventOverviewTest.php @@ -0,0 +1,65 @@ +client = $this->createWebsiteClient(); + $this->initPhpcr(); + } + + public function testEventOverview(): void + { + $event1 = $this->createEvent('Sulu is awesome', 'en'); + $this->enableEvent($event1); + $event2 = $this->createEvent('Symfony Live is awesome', 'en'); + $this->enableEvent($event2); + $event3 = $this->createEvent('Disabled', 'en'); + + $this->createPage( + 'event_overview', + 'example', + [ + 'title' => 'Symfony Live', + 'url' => '/events', + 'published' => true, + ] + ); + + $crawler = $this->client->request(Request::METHOD_GET, '/en/events'); + + $response = $this->client->getResponse(); + $this->assertInstanceOf(Response::class, $response); + $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); + $this->assertStringContainsString('Symfony Live', $crawler->filter('h1')->html()); + $this->assertNotNull($content = $crawler->filter('.event-title')->eq(0)->html()); + $this->assertStringContainsString($event1->getTitle() ?: '', $content); + $this->assertNotNull($content = $crawler->filter('.event-title')->eq(1)->html()); + $this->assertStringContainsString($event2->getTitle() ?: '', $content); + } + + protected static function getDocumentManager(): DocumentManagerInterface + { + return static::getContainer()->get('sulu_document_manager.document_manager'); + } +}