From 5cbc255331e9b02e1d501a72fee82e03e46dca1f Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sun, 11 Dec 2016 23:27:56 +0300 Subject: [PATCH] EventsControllerTest tests page heading and table with events are properly shown. --- .../Tests/Controller/EventsControllerTest.php | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Skobkin/Bundle/PointToolsBundle/Tests/Controller/EventsControllerTest.php diff --git a/src/Skobkin/Bundle/PointToolsBundle/Tests/Controller/EventsControllerTest.php b/src/Skobkin/Bundle/PointToolsBundle/Tests/Controller/EventsControllerTest.php new file mode 100644 index 0000000..e04045e --- /dev/null +++ b/src/Skobkin/Bundle/PointToolsBundle/Tests/Controller/EventsControllerTest.php @@ -0,0 +1,43 @@ +request('GET', '/events/last'); + + $this->assertEquals( + 1, + $crawler->filter('.last-subscriptions-log h3')->count() + ); + } + + public function testHasEvents() + { + $client = static::createClient(); + + $crawler = $client->request('GET', '/events/last'); + + // Checking that we have events table + $this->assertEquals( + 1, + $crawler->filter('.last-subscriptions-log table')->count(), + 'Has no events table' + ); + + // Checking that we have at least one event in the table + $this->assertGreaterThan( + 0, + $crawler->filter('.last-subscriptions-log table')->children()->filter('tbody')->children()->count(), + 'No events shown in the table' + ); + } + + // @todo test pagination +} \ No newline at end of file