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

AssertIncluded   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 3
c 1
b 0
f 0
dl 0
loc 17
ccs 0
cts 4
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertResponseContainsInclude() 0 6 1
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