diff --git a/framework/core/src/Install/DatabaseConfig.php b/framework/core/src/Install/DatabaseConfig.php index b4e666429..60ed3ea5d 100644 --- a/framework/core/src/Install/DatabaseConfig.php +++ b/framework/core/src/Install/DatabaseConfig.php @@ -11,7 +11,9 @@ namespace Flarum\Install; -class DatabaseConfig +use Illuminate\Contracts\Support\Arrayable; + +class DatabaseConfig implements Arrayable { private $driver; private $host; @@ -34,7 +36,7 @@ class DatabaseConfig $this->validate(); } - public function getConfig(): array + public function toArray() { return [ 'driver' => $this->driver, diff --git a/framework/core/src/Install/Steps/ConnectToDatabase.php b/framework/core/src/Install/Steps/ConnectToDatabase.php index 1e48899c0..51696731f 100644 --- a/framework/core/src/Install/Steps/ConnectToDatabase.php +++ b/framework/core/src/Install/Steps/ConnectToDatabase.php @@ -35,7 +35,7 @@ class ConnectToDatabase implements Step public function run() { - $config = $this->dbConfig->getConfig(); + $config = $this->dbConfig->toArray(); $pdo = (new MySqlConnector)->connect($config); $version = $pdo->query('SELECT VERSION()')->fetchColumn(); diff --git a/framework/core/src/Install/Steps/StoreConfig.php b/framework/core/src/Install/Steps/StoreConfig.php index 62d4df77e..757f3e376 100644 --- a/framework/core/src/Install/Steps/StoreConfig.php +++ b/framework/core/src/Install/Steps/StoreConfig.php @@ -56,7 +56,7 @@ class StoreConfig implements Step, ReversibleStep { return [ 'debug' => $this->debugMode, - 'database' => $this->dbConfig->getConfig(), + 'database' => $this->dbConfig->toArray(), 'url' => $this->baseUrl, 'paths' => $this->getPathsConfig(), ]; diff --git a/framework/core/tests/Install/DefaultInstallationTest.php b/framework/core/tests/Install/DefaultInstallationTest.php index 7533a9343..27eac7a42 100644 --- a/framework/core/tests/Install/DefaultInstallationTest.php +++ b/framework/core/tests/Install/DefaultInstallationTest.php @@ -52,7 +52,7 @@ class DefaultInstallationTest extends TestCase { $factory = new ConnectionFactory(app()); - return $factory->make($this->getDatabaseConfiguration()->getConfig()); + return $factory->make($this->getDatabaseConfiguration()->toArray()); } private function getAdmin(): AdminUser diff --git a/framework/core/tests/Test/Concerns/CreatesForum.php b/framework/core/tests/Test/Concerns/CreatesForum.php index 6727510c8..643afe5b1 100644 --- a/framework/core/tests/Test/Concerns/CreatesForum.php +++ b/framework/core/tests/Test/Concerns/CreatesForum.php @@ -107,7 +107,7 @@ trait CreatesForum { return [ 'debug' => true, - 'database' => $this->getDatabaseConfiguration()->getConfig(), + 'database' => $this->getDatabaseConfiguration()->toArray(), 'url' => 'http://flarum.local', 'paths' => [ 'api' => 'api', @@ -122,7 +122,7 @@ trait CreatesForum return; } - $dbConfig = $this->getDatabaseConfiguration()->getConfig(); + $dbConfig = $this->getDatabaseConfiguration()->toArray(); $pdo = (new MySqlConnector)->connect($dbConfig); $db = new MySqlConnection($pdo, $dbConfig['database'], $dbConfig['prefix'], $dbConfig);