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); |
|
|
|
|
53
|
|
|
$client->request('GET', '/api/media'); |
54
|
|
|
$this->assertSame(200, $client->getResponse()->getStatusCode()); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
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.