ImagesControllerTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testImagePost() 0 13 1
1
<?php
2
3
namespace Tests\KI\CoreBundle\Controller;
4
5
use Symfony\Component\Filesystem\Filesystem;
6
use Symfony\Component\HttpFoundation\File\UploadedFile;
7
use Tests\KI\CoreBundle\WebTestCase;
8
9
class ImagesControllerTest extends WebTestCase
10
{
11
    public function testImagePost()
12
    {
13
        $basePath = __DIR__.'/../../../../web/uploads/tests/';
14
        $fs = new Filesystem();
15
        $fs->copy($basePath.'admissibles.png', $basePath.'admissibles2.png');
16
        $list = new UploadedFile($basePath.'admissibles2.png', 'admissibles2.png');
17
18
        $this->client->request('POST', '/images', [], ['file' => $list]);
19
        $response = $this->client->getResponse();
20
        $this->assertJsonResponse($response, 201);
21
        $response = json_decode($response->getContent(), true);
22
        $this->assertArrayHasKey('filelink', $response);
23
    }
24
}
25