Completed
Push — master ( 9298cb...be7340 )
by Vincent
14:03 queued 17s
created

AssertIncluded::assertResponseContainsInclude()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace VGirol\JsonApiAssert\Laravel\Asserts\Content;
4
5
use Illuminate\Foundation\Testing\TestResponse;
6
7
/**
8
 * This trait adds the ability to test included collection.
9
 */
10
trait AssertIncluded
11
{
12
    /**
13
     * Asserts that an include object contains an expected collection.
14
     *
15
     * @param TestResponse $response
16
     * @param array        $expected
17
     *
18
     * @return void
19
     * @throws \PHPUnit\Framework\ExpectationFailedException
20
     */
21
    public static function assertResponseContainsInclude(TestResponse $response, $expected)
22
    {
23
        // Decode JSON response
24
        $json = $response->json();
0 ignored issues
show
Bug introduced by
The method json() does not exist on Illuminate\Foundation\Testing\TestResponse. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        /** @scrutinizer ignore-call */ 
25
        $json = $response->json();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
26
        static::assertDocumentContainsInclude($expected, $json);
27
    }
28
}
29