]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Controller/NotificationControllerTest.php
Notifications
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Controller / NotificationControllerTest.php
diff --git a/tests/Wallabag/CoreBundle/Controller/NotificationControllerTest.php b/tests/Wallabag/CoreBundle/Controller/NotificationControllerTest.php
new file mode 100644 (file)
index 0000000..e92528c
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Tests\Wallabag\CoreBundle\Controller;
+
+use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
+use Wallabag\CoreBundle\Entity\Notification;
+
+class NotificationControllerTest extends WallabagCoreTestCase
+{
+    public function testDisplayNotification()
+    {
+        $this->logInAs('admin');
+
+        $client = $this->getClient();
+
+        $em = $client->getContainer()
+            ->get('doctrine.orm.entity_manager');
+
+        $notification = new Notification($this->getLoggedInUser());
+        $notification->setType(Notification::TYPE_USER)
+            ->setTitle('fooTitle')
+            ->setDescription('barDescription');
+
+        $em->persist($notification);
+        $em->flush();
+
+        $crawler = $client->request('GET', '/');
+        $this->assertCount(1, $notificationArea = $crawler->filter('.notifications-area .collection'));
+        $this->assertContains('fooTitle', $notificationArea->text());
+        $this->assertContains('barDescription', $notificationArea->text());
+    }
+}