-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathWebhookTest.php
More file actions
58 lines (44 loc) · 1.35 KB
/
WebhookTest.php
File metadata and controls
58 lines (44 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class NFe_WebhookTest extends NFe_TestCase {
private static $id = null;
public function testCreateAndDelete() {
$attributes = array(
'url' => 'http://google.com/test',
'events' => array(
'issue',
'cancel'
),
'status' => 'active'
);
$object = NFe_Webhook::create( $attributes );
$this->assertNotNull($object);
$this->assertNotNull($object->uri);
$this->assertEqual($object->uri, $attributes['url']);
self::$id = $object->id;
}
public function testGet() {
$object = NFe_Webhook::fetch( self::$id );
$this->assertNotNull( $object );
$this->assertNotNull( $object->uri );
$this->assertEqual( $object->uri, 'http://google.com/test' );
}
public function testUpdate() {
$object = NFe_Webhook::fetch( self::$id );
$new_url = 'http://google.com/test2';
$object->uri = $new_url;
$this->assertTrue($object->save());
$this->assertNotNull($object);
$this->assertNotNull($object->uri);
$this->assertEqual($object->uri, $new_url);
}
public function testDelete() {
$object = NFe_Webhook::fetch( self::$id );
$this->assertNotNull($object);
$this->assertNotNull( $object->uri );
$this->assertTrue($object->delete());
}
public function testSearch() {
$hooks = NFe_Webhook::search();
$this->assertNotNull( $hooks );
}
}