Completed
Push — master ( 0e7751...1494d2 )
by dan
02:09
created

AdapterTestCase::assertBasicMessageData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace IrishDan\NotificationBundle\Test\Adapter;
4
5
use IrishDan\NotificationBundle\Message\MessageInterface;
6
use IrishDan\NotificationBundle\Test\NotificationTestCase;
7
8
abstract class AdapterTestCase extends NotificationTestCase
9
{
10
    protected $notification;
11
    protected $adapter;
12
13
    public function setUp()
14
    {
15
        parent::setUp();
16
17
        $this->setTwigTemplatesDirectory();
18
19
        $this->notification = $this->getNotificationWithUser();
20
    }
21
22
    protected function setTwig()
23
    {
24
        $twig = $this->getService('twig');
25
        $this->adapter->setTemplating($twig);
26
    }
27
28
    protected function setTwigTemplatesDirectory()
29
    {
30
        $path = __DIR__ . '/../Resources/';
31
        $this->getService('twig.loader')->addPath($path, $namespace = '__main__');
32
    }
33
34
    protected function assertMessageDataStructure(MessageInterface $message)
35
    {
36
        $this->assertInstanceOf('IrishDan\NotificationBundle\Message\MessageInterface', $message);
37
38
        $messageData = $message->getMessageData();
39
        $this->assertArrayHasKey('title', $messageData);
40
        $this->assertArrayHasKey('body', $messageData);
41
    }
42
43
    protected function assertBasicMessageData(MessageInterface $message)
44
    {
45
        $messageData = $message->getMessageData();
46
        $this->assertEquals('New member', $messageData['title']);
47
        $this->assertEquals('A new member has just joined', $messageData['body']);
48
    }
49
}