1 | <?php |
||
2 | |||
3 | use Illuminate\Testing\TestResponse; |
||
4 | use VGirol\JsonApiAssert\Laravel\Assert; |
||
5 | |||
6 | 3 | TestResponse::macro( |
|
7 | 3 | 'assertJsonApiFetchedSingleResource', |
|
8 | /** |
||
9 | * @param array|null $expected The expected resource object |
||
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 ($expected, $strict = false) { |
|
16 | 6 | Assert::assertFetchedSingleResourceResponse($this, $expected, $strict); |
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
17 | 6 | } |
|
18 | ); |
||
19 | |||
20 | 3 | TestResponse::macro( |
|
21 | 3 | 'assertJsonApiFetchedResourceCollection', |
|
22 | /** |
||
23 | * @param array $expected The expected collection of resource 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 ($expected, $strict = false) { |
|
30 | 6 | Assert::assertFetchedResourceCollectionResponse($this, $expected, $strict); |
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
31 | 6 | } |
|
32 | ); |
||
33 | |||
34 | 3 | TestResponse::macro( |
|
35 | 3 | 'assertJsonApiFetchedRelationships', |
|
36 | /** |
||
37 | * @param array|null $expected The expected collection of resource identifier 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 ($expected, $strict = false) { |
|
44 | 9 | Assert::assertFetchedRelationshipsResponse($this, $expected, $strict); |
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
45 | 9 | } |
|
46 | ); |
||
47 | |||
48 | 3 | TestResponse::macro( |
|
49 | 3 | 'assertJsonApiPagination', |
|
50 | /** |
||
51 | * @param array $expectedLinks |
||
52 | * @param array $expectedMeta |
||
53 | * |
||
54 | * @return void |
||
55 | * @throws \PHPUnit\Framework\AssertionFailedError |
||
56 | */ |
||
57 | 3 | function ($expectedLinks, $expectedMeta) { |
|
58 | 6 | Assert::assertResponseHasPagination($this, $expectedLinks, $expectedMeta); |
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
59 | 6 | } |
|
60 | ); |
||
61 | |||
62 | 3 | TestResponse::macro( |
|
63 | 3 | 'assertJsonApiNoPagination', |
|
64 | /** |
||
65 | * @return void |
||
66 | * @throws \PHPUnit\Framework\AssertionFailedError |
||
67 | */ |
||
68 | 3 | function () { |
|
69 | 6 | Assert::assertResponseHasNoPagination($this); |
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
70 | 6 | } |
|
71 | ); |
||
72 | |||
73 | 3 | TestResponse::macro( |
|
74 | 3 | 'assertJsonApiContainsInclude', |
|
75 | /** |
||
76 | * @param array $expected |
||
77 | * |
||
78 | * @return void |
||
79 | * @throws \PHPUnit\Framework\AssertionFailedError |
||
80 | */ |
||
81 | 3 | function ($expected) { |
|
82 | Assert::assertResponseContainsInclude($this, $expected); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
83 | 3 | } |
|
84 | ); |
||
85 |