X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FKernel%2FScripts%2FDbCommandBaseTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FKernel%2FScripts%2FDbCommandBaseTest.php;h=3bee38d1abf2525af750a163c362081bc1dcdece;hp=cb7f5eb7c4e1320523def9e5d867160d3af8c6b7;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php b/web/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php index cb7f5eb7c..3bee38d1a 100644 --- a/web/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php +++ b/web/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php @@ -35,7 +35,7 @@ class DbCommandBaseTest extends KernelTestBase { Database::addConnectionInfo('magic_db', 'default', Database::getConnectionInfo('default')['default']); $command_tester->execute([ - '--database' => 'magic_db' + '--database' => 'magic_db', ]); $this->assertEquals('magic_db', $command->getDatabaseConnection($command_tester->getInput())->getKey(), 'Special db key is returned'); @@ -48,7 +48,7 @@ class DbCommandBaseTest extends KernelTestBase { $command = new DbCommandBaseTester(); $command_tester = new CommandTester($command); $command_tester->execute([ - '--database' => 'dne' + '--database' => 'dne', ]); $this->setExpectedException(ConnectionNotDefinedException::class); $command->getDatabaseConnection($command_tester->getInput()); @@ -58,18 +58,16 @@ class DbCommandBaseTest extends KernelTestBase { * Test supplying database connection as a url. */ public function testSpecifyDbUrl() { - $connection_info = Database::getConnectionInfo('default')['default']; - $command = new DbCommandBaseTester(); $command_tester = new CommandTester($command); $command_tester->execute([ - '-db-url' => $connection_info['driver'] . '://' . $connection_info['username'] . ':' . $connection_info['password'] . '@' . $connection_info['host'] . '/' . $connection_info['database'] + '-db-url' => Database::getConnectionInfoAsUrl(), ]); $this->assertEquals('db-tools', $command->getDatabaseConnection($command_tester->getInput())->getKey()); Database::removeConnection('db-tools'); $command_tester->execute([ - '--database-url' => $connection_info['driver'] . '://' . $connection_info['username'] . ':' . $connection_info['password'] . '@' . $connection_info['host'] . '/' . $connection_info['database'] + '--database-url' => Database::getConnectionInfoAsUrl(), ]); $this->assertEquals('db-tools', $command->getDatabaseConnection($command_tester->getInput())->getKey()); } @@ -91,9 +89,8 @@ class DbCommandBaseTest extends KernelTestBase { ]); $this->assertEquals('extra', $command->getDatabaseConnection($command_tester->getInput())->tablePrefix()); - $connection_info = Database::getConnectionInfo('default')['default']; $command_tester->execute([ - '-db-url' => $connection_info['driver'] . '://' . $connection_info['username'] . ':' . $connection_info['password'] . '@' . $connection_info['host'] . '/' . $connection_info['database'], + '-db-url' => Database::getConnectionInfoAsUrl(), '--prefix' => 'extra2', ]); $this->assertEquals('extra2', $command->getDatabaseConnection($command_tester->getInput())->tablePrefix());