Test Setup Failed
Push — master ( 2047f0...e15812 )
by Gennady
03:31
created

MessageTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 32
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreation() 0 6 1
A testCreationWithDeviceIdentifier() 0 5 1
A testSetTopic() 0 7 1
A testSetPriority() 0 7 1
1
<?php
2
3
namespace Apns;
4
5
class MessageTest extends \PHPUnit_Framework_TestCase
6
{
7
    public function testCreation()
8
    {
9
        $msg = new Message();
10
        $this->assertEquals(['aps' => []], $msg->getMessageBody());
11
        $this->assertNull($msg->getDeviceIdentifier());
12
    }
13
14
    public function testCreationWithDeviceIdentifier()
15
    {
16
        $msg = new Message('foo');
17
        $this->assertSame('foo', $msg->getDeviceIdentifier());
18
    }
19
20
    public function testSetTopic()
21
    {
22
        $msg = new Message();
23
        $msg->setTopic('foo');
24
        $this->assertEquals('foo', $msg->getTopic());
25
        $this->assertEquals(['apns-topic' => 'foo'], $msg->getMessageHeaders());
26
    }
27
28
    public function testSetPriority()
29
    {
30
        $msg = new Message();
31
        $msg->setPriority(10);
32
        $this->assertEquals(10, $msg->getPriority());
33
        $this->assertEquals(['apns-priority' => 10], $msg->getMessageHeaders());
34
    }
35
36
}