|
@@ 16-45 (lines=30) @@
|
| 13 |
|
* @param string $filePath |
| 14 |
|
* @dataProvider goodDSLProvider |
| 15 |
|
*/ |
| 16 |
|
public function testExecuteGoodDSL($filePath = '') |
| 17 |
|
{ |
| 18 |
|
if ($filePath == '') { |
| 19 |
|
$this->markTestSkipped(); |
| 20 |
|
return; |
| 21 |
|
} |
| 22 |
|
|
| 23 |
|
// Make user migration is not in the db: delete it, ignoring errors |
| 24 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migration', 'migration' => basename($filePath), '--delete' => true, '-n' => true)); |
| 25 |
|
$exitCode = $this->app->run($input, $this->output); |
| 26 |
|
$output = $this->output->fetch(); |
| 27 |
|
|
| 28 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migration', 'migration' => $filePath, '--add' => true, '-n' => true)); |
| 29 |
|
$exitCode = $this->app->run($input, $this->output); |
| 30 |
|
$output = $this->output->fetch(); |
| 31 |
|
$this->assertSame(0, $exitCode); |
| 32 |
|
$this->assertRegexp('?Added migration?', $output); |
| 33 |
|
|
| 34 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migrate', '--path' => array($filePath), '-n' => true)); |
| 35 |
|
$exitCode = $this->app->run($input, $this->output); |
| 36 |
|
$output = $this->output->fetch(); |
| 37 |
|
$this->assertSame(0, $exitCode); |
| 38 |
|
// check that there are no notes after adding the migration |
| 39 |
|
$this->assertRegexp('?\| ' . basename($filePath) . ' +\| +\|?', $output); |
| 40 |
|
|
| 41 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migration', 'migration' => basename($filePath), '--delete' => true, '-n' => true)); |
| 42 |
|
$exitCode = $this->app->run($input, $this->output); |
| 43 |
|
$output = $this->output->fetch(); |
| 44 |
|
$this->assertSame(0, $exitCode); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
/** |
| 48 |
|
* @param string $filePath |
|
@@ 51-80 (lines=30) @@
|
| 48 |
|
* @param string $filePath |
| 49 |
|
* @dataProvider badDSLProvider |
| 50 |
|
*/ |
| 51 |
|
public function testExecuteBadDSL($filePath = '') |
| 52 |
|
{ |
| 53 |
|
if ($filePath == '') { |
| 54 |
|
$this->markTestSkipped(); |
| 55 |
|
return; |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
// Make user migration is not in the db: delete it, ignoring errors |
| 59 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migration', 'migration' => basename($filePath), '--delete' => true, '-n' => true)); |
| 60 |
|
$exitCode = $this->app->run($input, $this->output); |
| 61 |
|
$output = $this->output->fetch(); |
| 62 |
|
|
| 63 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migration', 'migration' => $filePath, '--add' => true, '-n' => true)); |
| 64 |
|
$exitCode = $this->app->run($input, $this->output); |
| 65 |
|
$output = $this->output->fetch(); |
| 66 |
|
$this->assertSame(0, $exitCode); |
| 67 |
|
$this->assertRegexp('?Added migration?', $output); |
| 68 |
|
|
| 69 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migrate', '--path' => array($filePath), '-n' => true)); |
| 70 |
|
$exitCode = $this->app->run($input, $this->output); |
| 71 |
|
$output = $this->output->fetch(); |
| 72 |
|
$this->assertSame(0, $exitCode); |
| 73 |
|
// check that there are no notes after adding the migration |
| 74 |
|
$this->assertRegexp('?Skipping ' . basename($filePath) . '?', $output); |
| 75 |
|
|
| 76 |
|
$input = new ArrayInput(array('command' => 'kaliop:migration:migration', 'migration' => basename($filePath), '--delete' => true, '-n' => true)); |
| 77 |
|
$exitCode = $this->app->run($input, $this->output); |
| 78 |
|
$output = $this->output->fetch(); |
| 79 |
|
$this->assertSame(0, $exitCode); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
public function goodDSLProvider() |
| 83 |
|
{ |