Completed
Push — master ( 0e1ec5...c2994e )
by Jean C.
12s
created

testShouldCreateNotificationPreference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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