Merge branch '4.7' into 4

This commit is contained in:
Maxime Rainville 2021-01-19 15:33:56 +13:00
commit 0da15f0f27
3 changed files with 17 additions and 8 deletions

View File

@ -270,8 +270,10 @@ class CoreKernel implements Kernel
$databaseConfig = DB::getConfig();
// Gracefully fail if no DB is configured
if (empty($databaseConfig['database'])) {
$msg = 'Silverstripe Framework requires a "database" key in DB::getConfig(). ' .
'Did you forget to set SS_DATABASE_NAME or SS_DATABASE_CHOOSE_NAME in your environment?';
$this->detectLegacyEnvironment();
$this->redirectToInstaller();
$this->redirectToInstaller($msg);
}
}
@ -311,14 +313,17 @@ class CoreKernel implements Kernel
}
/**
* If missing configuration, redirect to install.php
* If missing configuration, redirect to install.php if it exists.
* Otherwise show a server error to the user.
*
* @param string $msg Optional message to show to the user on an installed project (install.php missing).
*/
protected function redirectToInstaller()
protected function redirectToInstaller($msg = '')
{
// Error if installer not available
if (!file_exists(Director::publicFolder() . '/install.php')) {
throw new HTTPResponse_Exception(
'SilverStripe Framework requires database configuration defined via .env',
$msg,
500
);
}

View File

@ -1023,7 +1023,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly
$flush = array_key_exists('flush', $request->getVars());
// Custom application
$app->execute($request, function (HTTPRequest $request) {
$res = $app->execute($request, function (HTTPRequest $request) {
// Start session and execute
$request->getSession()->init($request);
@ -1037,6 +1037,10 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly
$controller->pushCurrent();
$controller->doInit();
}, $flush);
if ($res && $res->isError()) {
throw new LogicException($res->getBody());
}
} else {
// Allow flush from the command line in the absence of HTTPApplication's special sauce
$flush = false;

View File

@ -85,7 +85,7 @@ class CmsUiContext implements Context
}
/**
* @Then /^I should see a "([^"]+)" (\w+) toast$/
* @Then /^I should see a "(.+)" (\w+) toast$/
*/
public function iShouldSeeAToast($notice, $type)
{
@ -93,7 +93,7 @@ class CmsUiContext implements Context
}
/**
* @Then /^I should see a "([^"]+)" (\w+) toast with these actions: (.+)$/
* @Then /^I should see a "(.+)" (\w+) toast with these actions: (.+)$/
*/
public function iShouldSeeAToastWithAction($notice, $type, $actions)
{
@ -110,7 +110,7 @@ class CmsUiContext implements Context
/**
* @param $action
* @When /^I click the "([^"]*)" toast action$/
* @When /^I click the "(.*)" toast action$/
*/
public function stepIClickTheToastAction($action)
{