\Drupal\Core\Database\Driver\mysql\Install\Tasks::connect
will attempt to create the database if it doesn't already exist. To do this, it rebuilds the connection info without the database, connects and then attempts to create it.
However, on success, it doesn't add the database back into the connection details. While this appears not to be an issue for a normal install where the database gets written to and then read from settings.php, for BrowserTestBase, it continues to use the connection details stored in memory. When it gets to \Drupal\Tests\BrowserTestBase::cleanupEnvironment
, it attempts to clean up the database, which runs through to \Drupal\Core\Database\Driver\mysql\Schema::getPrefixInfo
which tried $this->connection->getConnectionOptions()['database']
. This throws a warning and therefore PHPUnit fails the test.