|
|
|
@ -78,6 +78,22 @@ class MigrateControllerTest extends TestCase
|
|
|
|
|
$this->assertFileContent($expectedFile, $class, $table, $namespace); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Check config namespace but without input namespace |
|
|
|
|
* @param mixed $expectedFile |
|
|
|
|
* @param mixed $migrationName |
|
|
|
|
* @param mixed $table |
|
|
|
|
* @param array $params |
|
|
|
|
*/ |
|
|
|
|
protected function assertCommandCreatedFileWithoutNamespaceInput($expectedFile, $migrationName, $table, $params = []) |
|
|
|
|
{ |
|
|
|
|
$params[0] = $migrationName; |
|
|
|
|
list($config, $namespace, $class) = $this->prepareMigrationNameData($this->migrationNamespace . '\\' . $migrationName); |
|
|
|
|
|
|
|
|
|
$this->runMigrateControllerAction('create', $params, $config); |
|
|
|
|
$this->assertFileContent($expectedFile, $class, $table, $namespace); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function assertFileContentJunction($expectedFile, $class, $junctionTable, $firstTable, $secondTable, $namespace = null) |
|
|
|
|
{ |
|
|
|
|
if ($namespace) { |
|
|
|
@ -101,6 +117,23 @@ class MigrateControllerTest extends TestCase
|
|
|
|
|
$this->assertFileContentJunction($expectedFile, $class, $junctionTable, $firstTable, $secondTable, $namespace); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Check config namespace but without input namespace |
|
|
|
|
* @param mixed $expectedFile |
|
|
|
|
* @param mixed $migrationName |
|
|
|
|
* @param mixed $junctionTable |
|
|
|
|
* @param mixed $firstTable |
|
|
|
|
* @param mixed $secondTable |
|
|
|
|
*/ |
|
|
|
|
protected function assertCommandCreatedJunctionFileWithoutNamespaceInput($expectedFile, $migrationName, $junctionTable, $firstTable, $secondTable) |
|
|
|
|
{ |
|
|
|
|
list($config, $namespace, $class) = $this->prepareMigrationNameData($this->migrationNamespace . '\\' . $migrationName); |
|
|
|
|
|
|
|
|
|
$this->runMigrateControllerAction('create', [$migrationName], $config); |
|
|
|
|
$this->assertSame(ExitCode::OK, $this->getExitCode()); |
|
|
|
|
$this->assertFileContentJunction($expectedFile, $class, $junctionTable, $firstTable, $secondTable, $namespace); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function prepareMigrationNameData($migrationName) |
|
|
|
|
{ |
|
|
|
|
$config = []; |
|
|
|
@ -318,6 +351,7 @@ class MigrateControllerTest extends TestCase
|
|
|
|
|
$table, |
|
|
|
|
$params |
|
|
|
|
); |
|
|
|
|
$this->assertCommandCreatedFileWithoutNamespaceInput($expectedFile, $migrationName, $table, $params); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -369,6 +403,13 @@ class MigrateControllerTest extends TestCase
|
|
|
|
|
$firstTable, |
|
|
|
|
$secondTable |
|
|
|
|
); |
|
|
|
|
$this->assertCommandCreatedJunctionFileWithoutNamespaceInput( |
|
|
|
|
'junction_test', |
|
|
|
|
$migrationName, |
|
|
|
|
$junctionTable, |
|
|
|
|
$firstTable, |
|
|
|
|
$secondTable |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testUpdatingLongNamedMigration() |
|
|
|
|