Skip to content

Commit

Permalink
Merge branch '4.x' into 4.next
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 19, 2024
2 parents a3f90b9 + 3518c48 commit ef65019
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Migration/ManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public function createConfig(): ConfigInterface
if (!$connectionConfig) {
throw new RuntimeException("Could not find connection `{$connectionName}`");
}
if (!isset($connectionConfig['database'])) {
throw new RuntimeException("The `{$connectionName}` connection has no `database` key defined.");
}

/** @var array<string, string> $connectionConfig */
$adapter = $connectionConfig['scheme'] ?? null;
Expand Down
13 changes: 13 additions & 0 deletions tests/TestCase/Command/MigrateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function tearDown(): void
foreach ($this->createdFiles as $file) {
unlink($file);
}
ConnectionManager::drop('invalid');
}

public function testHelp()
Expand Down Expand Up @@ -72,6 +73,18 @@ public function testMigrateNoMigrationSource(): void
$this->assertFileDoesNotExist($dumpFile);
}

/**
* Test that source parameter defaults to Migrations
*/
public function testMigrateInvalidConnection(): void
{
ConnectionManager::setConfig('invalid', [
'database' => null,
]);
$this->expectExceptionMessage('has no `database` key defined');
$this->exec('migrations migrate -c invalid');
}

/**
* Test that source parameter defaults to Migrations
*/
Expand Down

0 comments on commit ef65019

Please sign in to comment.