aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Controller/NotificationControllerTest.php
blob: e92528caded375a7f4d26c054f29e07012474d90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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());
    }
}