Completed
Pull Request — master (#135)
by
unknown
02:17
created

NotificationPreferencesTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createNotification() 0 10 1
A testShouldCreateNotificationPreference() 0 5 1
A testEndpointDeleteNotificationPreference() 0 6 1
1
<?php
2
3
namespace Moip\Tests\Resource;
4
5
use Moip\Tests\TestCase;
6
use Moip\Resource\MoipResource;
7
use Moip\Resource\NotificationPreferences;
8
9
/**
10
 * Description of NotificationPreferencesTest.
11
 */
12
class NotificationPreferencesTest extends TestCase
13
{
14
    private function createNotification()
15
    {
16
        $this->mockHttpSession($this->body_notification_preference);
17
        $notification = $this->moip->notifications()->addEvent('ORDER.*')
18
            ->addEvent('PAYMENT.AUTHORIZED')
19
            ->setTarget('http://requestb.in/1dhjesw1')
20
            ->create();
21
22
        return $notification;
23
    }
24
25
    public function testShouldCreateNotificationPreference()
26
    {
27
        $notification = $this->createNotification();
28
        $this->assertNotEmpty($notification->getId());
29
    }
30
31
    public function testEndpointDeleteNotificationPreference()
32
    {
33
        $path = $this->moip->notifications()->generatePath('notifications', 'NPR-CQU74AQOIVCV');
34
        $expected = sprintf('%s/%s/%s/%s', MoipResource::VERSION, NotificationPreferences::PATH, 'notifications', 'NPR-CQU74AQOIVCV');
35
        $this->assertEquals($expected, $path);
36
    }
37
}
38