@@ -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'
235240connected
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
244249EXPECTED;
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