Completed
Pull Request — master (#1691)
by
unknown
10:37 queued 08:04
created

MediaControllerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 8
dl 0
loc 33
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetMediaAction() 0 30 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\MediaBundle\Tests\Functional;
15
16
use Doctrine\Bundle\DoctrineBundle\Command\Proxy\CreateSchemaDoctrineCommand;
17
use Sonata\MediaBundle\Tests\App\AppKernel;
18
use Symfony\Bundle\FrameworkBundle\Client;
19
use Symfony\Bundle\FrameworkBundle\Console\Application;
20
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
21
use Symfony\Component\Console\Input\ArrayInput;
22
use Symfony\Component\Console\Output\ConsoleOutput;
23
24
final class MediaControllerTest extends WebTestCase
25
{
26
    public function testGetMediaAction(): void
27
    {
28
        $kernel = new AppKernel();
29
        $kernel->boot();
30
31
        $application = new Application($kernel);
32
        $application->setAutoExit(false);
33
34
        $application->run(new ArrayInput([
35
            'command' => 'doctrine:database:drop',
36
            '--force' => '1',
37
        ]));
38
39
        $application->run(new ArrayInput([
40
            'command' => 'doctrine:database:create',
41
        ]));
42
43
        $command = new CreateSchemaDoctrineCommand();
44
        $application->add($command);
45
        $input = new ArrayInput([
46
            'command' => 'doctrine:schema:create',
47
        ]);
48
        $input->setInteractive(false);
49
50
        $command->run($input, new ConsoleOutput());
51
52
        $client = new Client($kernel);
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\FrameworkBundle\Client has been deprecated with message: since Symfony 4.3, use KernelBrowser instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
53
        $client->request('GET', '/api/media');
54
        $this->assertSame(200, $client->getResponse()->getStatusCode());
55
    }
56
}
57