@@ 14-44 (lines=31) @@ | ||
11 | ||
12 | class DropDatabaseDoctrineTest extends TestCase |
|
13 | { |
|
14 | public function testExecute() : void |
|
15 | { |
|
16 | $connectionName = 'default'; |
|
17 | $dbName = 'test'; |
|
18 | $params = [ |
|
19 | 'url' => 'sqlite:///' . sys_get_temp_dir() . '/test.db', |
|
20 | 'path' => sys_get_temp_dir() . '/' . $dbName, |
|
21 | 'driver' => 'pdo_sqlite', |
|
22 | ]; |
|
23 | ||
24 | $container = $this->getMockContainer($connectionName, $params); |
|
25 | ||
26 | $application = new Application(); |
|
27 | $application->add(new DropDatabaseDoctrineCommand($container->get('doctrine'))); |
|
28 | ||
29 | $command = $application->find('doctrine:database:drop'); |
|
30 | ||
31 | $commandTester = new CommandTester($command); |
|
32 | $commandTester->execute( |
|
33 | array_merge(['command' => $command->getName(), '--force' => true]) |
|
34 | ); |
|
35 | ||
36 | $this->assertContains( |
|
37 | sprintf( |
|
38 | 'Dropped database %s for connection named %s', |
|
39 | sys_get_temp_dir() . '/' . $dbName, |
|
40 | $connectionName |
|
41 | ), |
|
42 | $commandTester->getDisplay() |
|
43 | ); |
|
44 | } |
|
45 | ||
46 | public function testExecuteWithAlias() : void |
|
47 | { |
|
@@ 46-76 (lines=31) @@ | ||
43 | ); |
|
44 | } |
|
45 | ||
46 | public function testExecuteWithAlias() : void |
|
47 | { |
|
48 | $connectionName = 'default'; |
|
49 | $dbName = 'test'; |
|
50 | $params = [ |
|
51 | 'url' => 'sqlite:///' . sys_get_temp_dir() . '/test.db', |
|
52 | 'path' => sys_get_temp_dir() . '/' . $dbName, |
|
53 | 'driver' => 'pdo_sqlite', |
|
54 | ]; |
|
55 | ||
56 | $container = $this->getMockContainer($connectionName, $params); |
|
57 | ||
58 | $application = new Application(); |
|
59 | $application->add(new DropDatabaseDoctrineCommand($container->get('doctrine'))); |
|
60 | ||
61 | $command = $application->find('doctrine:database:drop'); |
|
62 | ||
63 | $commandTester = new CommandTester($command); |
|
64 | $commandTester->execute( |
|
65 | array_merge(['command' => $command->getName(), '-f' => true]) |
|
66 | ); |
|
67 | ||
68 | $this->assertContains( |
|
69 | sprintf( |
|
70 | 'Dropped database %s for connection named %s', |
|
71 | sys_get_temp_dir() . '/' . $dbName, |
|
72 | $connectionName |
|
73 | ), |
|
74 | $commandTester->getDisplay() |
|
75 | ); |
|
76 | } |
|
77 | ||
78 | public function testItThrowsWhenUsingIfExistsWithAnIncompatibleDriver() : void |
|
79 | { |