Skip to content

Commit 1e4f5cc

Browse files
author
Alexandre
committed
Merge pull request #6 from alwex/stable
Stable
2 parents 74518b1 + be4999b commit 1e4f5cc

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

tests/Command/AbstractCommandTester.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ public function createEnv()
4242
$command = $application->find('migrate:addenv');
4343
$commandTester = new CommandTester($command);
4444

45+
$pdoDrivers = pdo_drivers();
46+
$driverKey = array_search('sqlite', $pdoDrivers);
47+
4548
/* @var $question QuestionHelper */
4649
$question = $command->getHelper('question');
47-
$question->setInputStream(InputStreamUtil::type("testing\n1\ntest.sqlite\n\n\n\n\nchangelog\nvim\n"));
50+
$question->setInputStream(InputStreamUtil::type("testing\n$driverKey\ntest.sqlite\n\n\n\n\nchangelog\nvim\n"));
4851

4952
$commandTester->execute(array('command' => $command->getName()));
5053
}

tests/Command/AddenvCommandTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,21 @@ public function testExecute()
3434
$command = $application->find('migrate:addenv');
3535
$commandTester = new CommandTester($command);
3636

37+
$pdoDrivers = pdo_drivers();
38+
$driverKey = array_search('sqlite', $pdoDrivers);
39+
40+
$driverSelect = '';
41+
foreach ($pdoDrivers as $key => $driver) {
42+
$driverSelect .= " [$key] $driver\n";
43+
}
44+
3745
/* @var $question QuestionHelper */
3846
$question = $command->getHelper('question');
39-
$question->setInputStream(InputStreamUtil::type("testing\n1\nmigrate_test\nlocalhost\n5432\naguidet\naguidet\nchangelog\nvim\n"));
47+
$question->setInputStream(InputStreamUtil::type("testing\n$driverKey\nmigrate_test\nlocalhost\n5432\naguidet\naguidet\nchangelog\nvim\n"));
4048

4149
$commandTester->execute(array('command' => $command->getName()));
4250

43-
$expected = "Please enter the name of the new environment (default dev): Please chose your pdo driver\n [0] pgsql\n [1] sqlite\n > Please enter the database name (or the database file location): Please enter the database host (if needed): Please enter the database port (if needed): Please enter the database user name (if needed): Please enter the database user password (if needed): Please enter the changelog table (default changelog): Please enter the text editor to use by default (default vim): ";
51+
$expected = "Please enter the name of the new environment (default dev): Please chose your pdo driver\n$driverSelect > Please enter the database name (or the database file location): Please enter the database host (if needed): Please enter the database port (if needed): Please enter the database user name (if needed): Please enter the database user password (if needed): Please enter the changelog table (default changelog): Please enter the text editor to use by default (default vim): ";
4452
$this->assertEquals($expected, $commandTester->getDisplay());
4553

4654
$envDir = Directory::getEnvPath();

0 commit comments

Comments
 (0)