Repository navigation
Expand file tree
/
Copy pathHookTest.php
More file actions
109 lines (88 loc) · 2.3 KB
/
Copy pathHookTest.php
File metadata and controls
109 lines (88 loc) · 2.3 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
declare(strict_types=1);
namespace Github\Api\App;
use Github\Tests\Api\TestCase;
class HookTest extends TestCase
{
/**
* @test
*/
public function shouldShowHookConfiguration()
{
$result = [
'content_type' => 'json',
'insecure_ssl' => 0,
'secret' => '********',
'url' => 'https://localhost/',
];
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('/app/hook/config', [])
->willReturn($result);
$this->assertEquals($result, $api->showConfig());
}
/**
* @test
*/
public function shouldUpdateHookConfiguration()
{
$parameters = [
'content_type' => 'json',
];
$api = $this->getApiMock();
$api->expects($this->once())
->method('patch')
->with('/app/hook/config', $parameters)
->willReturn([]);
$this->assertEquals([], $api->updateConfig($parameters));
}
/**
* @test
*/
public function shouldListHookDelivieries()
{
$result = [];
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('/app/hook/deliveries', [])
->willReturn($result);
$this->assertEquals($result, $api->deliveries());
}
/**
* @test
*/
public function shouldListHookDeliviery()
{
$result = [];
$delivery = 1234567;
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('/app/hook/deliveries/'.$delivery, [])
->willReturn($result);
$this->assertEquals($result, $api->delivery($delivery));
}
/**
* @test
*/
public function shouldRedeliveryHook()
{
$result = [];
$delivery = 1234567;
$api = $this->getApiMock();
$api->expects($this->once())
->method('post')
->with('/app/hook/deliveries/'.$delivery.'/attempts', [])
->willReturn($result);
$this->assertEquals($result, $api->redeliver($delivery));
}
/**
* @return string
*/
protected function getApiClass()
{
return \Github\Api\App\Hook::class;
}
}