Skip to content

Commit 8f02441

Browse files
author
Alexandre Guidet
committed
Merge branch 'hotfix-3.7.1'
2 parents db2dce4 + ed5f5d6 commit 8f02441

4 files changed

Lines changed: 21 additions & 12 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Symfony\Component\Console\Command\Command;
1111

1212

13-
class AbstractComand extends Command {
13+
class AbstractCommand extends Command {
1414

1515
protected $mainDir;
1616
protected $environmentDir;

Migrate/Command/AbstractEnvCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Console\Input\InputInterface;
1616
use Symfony\Component\Console\Output\OutputInterface;
1717

18-
class AbstractEnvCommand extends AbstractComand
18+
class AbstractEnvCommand extends AbstractCommand
1919
{
2020

2121
protected static $progressBarFormat = '%current%/%max% [%bar%] %percent% % [%message%]';
@@ -283,7 +283,7 @@ protected function filterMigrationsToExecute(InputInterface $input, OutputInterf
283283
$to = $input->getOption('to');
284284
if ($to !== null) {
285285
if (! array_key_exists($to, $toExecute)) {
286-
throw new \RuntimeException("Target migration $to does not exists or has already been executed/downed!");
286+
throw new \RuntimeException("Target migration $to does not exist or has already been executed/downed!");
287287
}
288288

289289
$temp = $toExecute;

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ in `./.php-database-migration/environments/[env].yml`.
7878
Initialization
7979
--------------
8080
Once the environment is added, you have to initialize it. This verifies that the database connection works, and
81-
create a new database table for tracking the current database changes:
81+
creates a new database table for tracking the current database changes:
8282

8383
```
8484
$ ./bin/migrate migrate:init [env]
@@ -116,7 +116,8 @@ $ ./bin/migrate migrate:status [env]
116116

117117
Up and down
118118
-----------
119-
You can now up all the pending migrations. If you decided to down a migration, the last one will be downed alone to prevent from mistake. You will be asked to confirm the downgrade of your database before runing the real SQL script.
119+
You can now up all the pending migrations. If you decide to down a migration, the last one will be downed alone to
120+
prevent mistakes. You will be asked to confirm the downgrade of your database before running the real SQL script.
120121

121122
```
122123
$ ./bin/migrate migrate:up [env]
@@ -128,13 +129,13 @@ You can mark migrations as applied without executing SQL (e.g. if you switched f
128129
$ ./bin/migrate migrate:up [env] --changelog-only
129130
```
130131

131-
For developement purpose, it is also possible to up a single migration without taking care of the other ones:
132+
For development purposes, it is also possible to up a single migration without taking care of the other ones:
132133

133134
```
134135
$ ./bin/migrate migrate:up [env] --only=[migrationid]
135136
```
136137

137-
or migrate to specific migration (it will run all migrations including specified migration)
138+
or migrate to specific migration (it will run all migrations, including the specified migration)
138139

139140
```
140141
$ ./bin/migrate migrate:up [env] --to=[migrationid]

tests/Command/UpDownCommandTest.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,26 +224,34 @@ public function testDownOnly()
224224
$command = self::$application->find('migrate:status');
225225
$commandTester = new CommandTester($command);
226226

227-
$currentDate = date('Y-m-d H:i:s');
227+
$currentTime = time();
228+
$validDates = array();
229+
foreach (range(-1, 1) as $i) {
230+
$validDates[] = date('Y-m-d H:i:s', $currentTime + $i);
231+
}
232+
$dateRegex = '(' . implode('|', $validDates) . ') *';
228233

229234
$commandTester->execute(array(
230235
'command' => $command->getName(),
231236
'env' => 'testing'
232237
));
233238

234-
$expected =<<<EXPECTED
239+
$expected =<<<'EXPECTED'
235240
connected
236241
+----+---------+---------------------+-------------+
237242
| id | version | applied at | description |
238243
+----+---------+---------------------+-------------+
239-
| 0 | | $currentDate | migration |
244+
| 0 | | DATE_REGEX | migration |
240245
| 1 | | | migration |
241-
| 2 | | $currentDate | migration |
246+
| 2 | | DATE_REGEX | migration |
242247
+----+---------+---------------------+-------------+
243248

244249
EXPECTED;
245250

246-
$this->assertEquals($expected, $commandTester->getDisplay());
251+
$pattern = '/^' . preg_quote($expected, '/') . '$/';
252+
$pattern = preg_replace('/DATE_REGEX */', $dateRegex, $pattern);
253+
254+
$this->assertRegExp($pattern, $commandTester->getDisplay());
247255

248256
}
249257

0 commit comments

Comments
 (0)