| @@ 23-45 (lines=23) @@ | ||
| 20 | ||
| 21 | class CreateDatabaseDoctrineTest extends \PHPUnit_Framework_TestCase |
|
| 22 | { |
|
| 23 | public function testExecute() |
|
| 24 | { |
|
| 25 | $connectionName = 'default'; |
|
| 26 | $dbName = 'test'; |
|
| 27 | $params = array( |
|
| 28 | 'dbname' => $dbName, |
|
| 29 | 'memory' => true, |
|
| 30 | 'driver' => 'pdo_sqlite' |
|
| 31 | ); |
|
| 32 | ||
| 33 | $application = new Application(); |
|
| 34 | $application->add(new CreateDatabaseDoctrineCommand()); |
|
| 35 | ||
| 36 | $command = $application->find('doctrine:database:create'); |
|
| 37 | $command->setContainer($this->getMockContainer($connectionName, $params)); |
|
| 38 | ||
| 39 | $commandTester = new CommandTester($command); |
|
| 40 | $commandTester->execute( |
|
| 41 | array_merge(array('command' => $command->getName())) |
|
| 42 | ); |
|
| 43 | ||
| 44 | $this->assertContains("Created database \"$dbName\" for connection named $connectionName", $commandTester->getDisplay()); |
|
| 45 | } |
|
| 46 | ||
| 47 | ||
| 48 | /** |
|
| @@ 23-45 (lines=23) @@ | ||
| 20 | ||
| 21 | class DropDatabaseDoctrineTest extends \PHPUnit_Framework_TestCase |
|
| 22 | { |
|
| 23 | public function testExecuteWithoutForce() |
|
| 24 | { |
|
| 25 | $connectionName = 'default'; |
|
| 26 | $dbName = 'test'; |
|
| 27 | $params = array( |
|
| 28 | 'dbname' => $dbName, |
|
| 29 | 'memory' => true, |
|
| 30 | 'driver' => 'pdo_sqlite' |
|
| 31 | ); |
|
| 32 | ||
| 33 | $application = new Application(); |
|
| 34 | $application->add(new DropDatabaseDoctrineCommand()); |
|
| 35 | ||
| 36 | $command = $application->find('doctrine:database:drop'); |
|
| 37 | $command->setContainer($this->getMockContainer($connectionName, $params)); |
|
| 38 | ||
| 39 | $commandTester = new CommandTester($command); |
|
| 40 | $commandTester->execute( |
|
| 41 | array_merge(array('command' => $command->getName())) |
|
| 42 | ); |
|
| 43 | ||
| 44 | $this->assertContains("Please run the operation with --force to execute", $commandTester->getDisplay()); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function testExecute() |
|
| 48 | { |
|
| @@ 47-69 (lines=23) @@ | ||
| 44 | $this->assertContains("Please run the operation with --force to execute", $commandTester->getDisplay()); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function testExecute() |
|
| 48 | { |
|
| 49 | $connectionName = 'default'; |
|
| 50 | $dbName = 'test'; |
|
| 51 | $params = array( |
|
| 52 | 'dbname' => $dbName, |
|
| 53 | 'memory' => true, |
|
| 54 | 'driver' => 'pdo_sqlite' |
|
| 55 | ); |
|
| 56 | ||
| 57 | $application = new Application(); |
|
| 58 | $application->add(new DropDatabaseDoctrineCommand()); |
|
| 59 | ||
| 60 | $command = $application->find('doctrine:database:drop'); |
|
| 61 | $command->setContainer($this->getMockContainer($connectionName, $params)); |
|
| 62 | ||
| 63 | $commandTester = new CommandTester($command); |
|
| 64 | $commandTester->execute( |
|
| 65 | array_merge(array('command' => $command->getName(), '--force' => true)) |
|
| 66 | ); |
|
| 67 | ||
| 68 | $this->assertContains("Dropped database for connection named \"$dbName\"", $commandTester->getDisplay()); |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|