|
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\NotificationBundle\Tests\Functional\Api; |
|
15
|
|
|
|
|
16
|
|
|
use Doctrine\Bundle\DoctrineBundle\Command\Proxy\CreateSchemaDoctrineCommand; |
|
17
|
|
|
use Sonata\NotificationBundle\Tests\App\AppKernel; |
|
18
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application; |
|
19
|
|
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser; |
|
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 ApiControllerTest extends WebTestCase |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* @var KernelBrowser |
|
28
|
|
|
*/ |
|
29
|
|
|
private $client; |
|
30
|
|
|
|
|
31
|
|
|
protected function setUp(): void |
|
32
|
|
|
{ |
|
33
|
|
|
$kernel = new AppKernel(); |
|
34
|
|
|
$kernel->boot(); |
|
35
|
|
|
|
|
36
|
|
|
$application = new Application($kernel); |
|
37
|
|
|
$application->setAutoExit(false); |
|
38
|
|
|
|
|
39
|
|
|
$application->run(new ArrayInput([ |
|
40
|
|
|
'command' => 'doctrine:database:drop', |
|
41
|
|
|
'--force' => '1', |
|
42
|
|
|
])); |
|
43
|
|
|
|
|
44
|
|
|
$application->run(new ArrayInput([ |
|
45
|
|
|
'command' => 'doctrine:database:create', |
|
46
|
|
|
])); |
|
47
|
|
|
|
|
48
|
|
|
$command = new CreateSchemaDoctrineCommand(); |
|
49
|
|
|
$application->add($command); |
|
50
|
|
|
$input = new ArrayInput([ |
|
51
|
|
|
'command' => 'doctrine:schema:create', |
|
52
|
|
|
]); |
|
53
|
|
|
$input->setInteractive(false); |
|
54
|
|
|
|
|
55
|
|
|
$command->run($input, new ConsoleOutput()); |
|
56
|
|
|
|
|
57
|
|
|
$this->client = new KernelBrowser($kernel); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function testSetDatabase(): void |
|
61
|
|
|
{ |
|
62
|
|
|
$this->assertSame(true, true); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|