|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Testing\TestResponse; |
|
4
|
|
|
use VGirol\JsonApiAssert\Laravel\Assert; |
|
5
|
|
|
|
|
6
|
3 |
|
TestResponse::macro( |
|
7
|
3 |
|
'assertJsonApiResponse400', |
|
8
|
|
|
/** |
|
9
|
|
|
* @param array $expectedErrors An array of the expected error objects. |
|
10
|
|
|
* @param boolean $strict If true, unsafe characters are not allowed when checking members name. |
|
11
|
|
|
* |
|
12
|
|
|
* @return void |
|
13
|
|
|
* @throws \PHPUnit\Framework\AssertionFailedError |
|
14
|
|
|
*/ |
|
15
|
3 |
|
function ($expectedErrors, $strict = false) { |
|
16
|
6 |
|
Assert::assertIsErrorResponse($this, 400, $expectedErrors, $strict); |
|
|
|
|
|
|
17
|
6 |
|
} |
|
18
|
|
|
); |
|
19
|
|
|
|
|
20
|
3 |
|
TestResponse::macro( |
|
21
|
3 |
|
'assertJsonApiResponse403', |
|
22
|
|
|
/** |
|
23
|
|
|
* @param array $expectedErrors An array of the expected error objects. |
|
24
|
|
|
* @param boolean $strict If true, unsafe characters are not allowed when checking members name. |
|
25
|
|
|
* |
|
26
|
|
|
* @return void |
|
27
|
|
|
* @throws \PHPUnit\Framework\AssertionFailedError |
|
28
|
|
|
*/ |
|
29
|
3 |
|
function ($expectedErrors, $strict = false) { |
|
30
|
6 |
|
Assert::assertIsErrorResponse($this, 403, $expectedErrors, $strict); |
|
|
|
|
|
|
31
|
6 |
|
} |
|
32
|
|
|
); |
|
33
|
|
|
|
|
34
|
3 |
|
TestResponse::macro( |
|
35
|
3 |
|
'assertJsonApiResponse404', |
|
36
|
|
|
/** |
|
37
|
|
|
* @param array $expectedErrors An array of the expected error objects. |
|
38
|
|
|
* @param boolean $strict If true, unsafe characters are not allowed when checking members name. |
|
39
|
|
|
* |
|
40
|
|
|
* @return void |
|
41
|
|
|
* @throws \PHPUnit\Framework\AssertionFailedError |
|
42
|
|
|
*/ |
|
43
|
3 |
|
function ($expectedErrors, $strict = false) { |
|
44
|
6 |
|
Assert::assertIsErrorResponse($this, 404, $expectedErrors, $strict); |
|
|
|
|
|
|
45
|
6 |
|
} |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
3 |
|
TestResponse::macro( |
|
49
|
3 |
|
'assertJsonApiResponse406', |
|
50
|
|
|
/** |
|
51
|
|
|
* @param array $expectedErrors An array of the expected error objects. |
|
52
|
|
|
* @param boolean $strict If true, unsafe characters are not allowed when checking members name. |
|
53
|
|
|
* |
|
54
|
|
|
* @return void |
|
55
|
|
|
* @throws \PHPUnit\Framework\AssertionFailedError |
|
56
|
|
|
*/ |
|
57
|
3 |
|
function ($expectedErrors, $strict = false) { |
|
58
|
6 |
|
Assert::assertIsErrorResponse($this, 406, $expectedErrors, $strict); |
|
|
|
|
|
|
59
|
6 |
|
} |
|
60
|
|
|
); |
|
61
|
|
|
|
|
62
|
3 |
|
TestResponse::macro( |
|
63
|
3 |
|
'assertJsonApiResponse409', |
|
64
|
|
|
/** |
|
65
|
|
|
* @param array $expectedErrors An array of the expected error objects. |
|
66
|
|
|
* @param boolean $strict If true, unsafe characters are not allowed when checking members name. |
|
67
|
|
|
* |
|
68
|
|
|
* @return void |
|
69
|
|
|
* @throws \PHPUnit\Framework\AssertionFailedError |
|
70
|
|
|
*/ |
|
71
|
3 |
|
function ($expectedErrors, $strict = false) { |
|
72
|
6 |
|
Assert::assertIsErrorResponse($this, 409, $expectedErrors, $strict); |
|
|
|
|
|
|
73
|
6 |
|
} |
|
74
|
|
|
); |
|
75
|
|
|
|
|
76
|
3 |
|
TestResponse::macro( |
|
77
|
3 |
|
'assertJsonApiResponse415', |
|
78
|
|
|
/** |
|
79
|
|
|
* @param array $expectedErrors An array of the expected error objects. |
|
80
|
|
|
* @param boolean $strict If true, unsafe characters are not allowed when checking members name. |
|
81
|
|
|
* |
|
82
|
|
|
* @return void |
|
83
|
|
|
* @throws \PHPUnit\Framework\AssertionFailedError |
|
84
|
|
|
*/ |
|
85
|
3 |
|
function ($expectedErrors, $strict = false) { |
|
86
|
6 |
|
Assert::assertIsErrorResponse($this, 415, $expectedErrors, $strict); |
|
|
|
|
|
|
87
|
6 |
|
} |
|
88
|
|
|
); |
|
89
|
|
|
|