Passed
Push — master ( 25046f...2db671 )
by Mattia
03:56
created

JsonControllerTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 1
b 1
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
class JsonControllerTest extends TestCase
6
{
7
    public function setUp(): void
8
    {
9
        parent::setUp();
10
        \DB::beginTransaction();
11
    }
12
13
    public function tearDown(): void
14
    {
15
        \DB::rollBack();
16
        parent::tearDown();
17
    }
18
19
    /**
20
     * @test
21
     */
22
    public function shouldReturnTypeaheadEntries(): void
23
    {
24
        $this->get('/api/v1/typeahead/Cy');
25
        $this->assertJson($this->response->content());
26
    }
27
28
    /**
29
     * @test
30
     */
31
    public function shouldReturnUserDataUsingUuid(): void
32
    {
33
        $this->get('/api/v1/user/d59dcabb30424b978f7201d1a076637f');
34
        $responseContent = $this->response->content();
35
        $this->assertJson($responseContent);
36
        $this->seeJsonStructure(['ok', 'data'], $responseContent);
0 ignored issues
show
Bug introduced by
$responseContent of type string is incompatible with the type array|null expected by parameter $responseData of Laravel\Lumen\Testing\TestCase::seeJsonStructure(). ( Ignorable by Annotation )

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

36
        $this->seeJsonStructure(['ok', 'data'], /** @scrutinizer ignore-type */ $responseContent);
Loading history...
37
    }
38
39
    /**
40
     * @test
41
     */
42
    public function shouldReturnUserDataUsingUsername(): void
43
    {
44
        $this->get('/api/v1/user/_Cyb3r');
45
        $responseContent = $this->response->content();
46
        $this->assertJson($responseContent);
47
        $this->seeJsonStructure(['ok', 'data'], $responseContent);
0 ignored issues
show
Bug introduced by
$responseContent of type string is incompatible with the type array|null expected by parameter $responseData of Laravel\Lumen\Testing\TestCase::seeJsonStructure(). ( Ignorable by Annotation )

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

47
        $this->seeJsonStructure(['ok', 'data'], /** @scrutinizer ignore-type */ $responseContent);
Loading history...
48
    }
49
}
50