ImagesControllerTest::testImagePost()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 0
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