Code Duplication    Length = 31-33 lines in 2 locations

Tests/Command/DropDatabaseDoctrineTest.php 2 locations

@@ 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()
47
    {
@@ 78-110 (lines=33) @@
75
        );
76
    }
77
78
    public function testExecuteWithExistAliasButNotSupported()
79
    {
80
        $connectionName = 'default';
81
        $dbName         = 'test';
82
        $params         = [
83
            'url' => 'sqlite:///' . sys_get_temp_dir() . '/test.db',
84
            'path' => sys_get_temp_dir() . '/' . $dbName,
85
            'driver' => 'pdo_sqlite',
86
        ];
87
88
        $container = $this->getMockContainer($connectionName, $params);
89
90
        $application = new Application();
91
        $application->add(new DropDatabaseDoctrineCommand($container->get('doctrine')));
92
93
        $command = $application->find('doctrine:database:drop');
94
95
        $commandTester = new CommandTester($command);
96
97
        static::expectException(DBALException::class);
98
        $commandTester->execute(
99
            array_merge(['command' => $command->getName(), '-f' => true, '-e' => true])
100
        );
101
102
        $this->assertContains(
103
            sprintf(
104
                'Dropped database %s for connection named %s',
105
                sys_get_temp_dir() . '/' . $dbName,
106
                $connectionName
107
            ),
108
            $commandTester->getDisplay()
109
        );
110
    }
111
112
    public function testExecuteWithoutOptionForceWillFailWithAttentionMessage() : void
113
    {