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

NotificationPreferencesTest::createNotification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 10
rs 9.4285
c 1
b 0
f 0
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