mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '4.7' into 4
This commit is contained in:
commit
0da15f0f27
@ -270,8 +270,10 @@ class CoreKernel implements Kernel
|
|||||||
$databaseConfig = DB::getConfig();
|
$databaseConfig = DB::getConfig();
|
||||||
// Gracefully fail if no DB is configured
|
// Gracefully fail if no DB is configured
|
||||||
if (empty($databaseConfig['database'])) {
|
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->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
|
// Error if installer not available
|
||||||
if (!file_exists(Director::publicFolder() . '/install.php')) {
|
if (!file_exists(Director::publicFolder() . '/install.php')) {
|
||||||
throw new HTTPResponse_Exception(
|
throw new HTTPResponse_Exception(
|
||||||
'SilverStripe Framework requires database configuration defined via .env',
|
$msg,
|
||||||
500
|
500
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly
|
|||||||
$flush = array_key_exists('flush', $request->getVars());
|
$flush = array_key_exists('flush', $request->getVars());
|
||||||
|
|
||||||
// Custom application
|
// Custom application
|
||||||
$app->execute($request, function (HTTPRequest $request) {
|
$res = $app->execute($request, function (HTTPRequest $request) {
|
||||||
// Start session and execute
|
// Start session and execute
|
||||||
$request->getSession()->init($request);
|
$request->getSession()->init($request);
|
||||||
|
|
||||||
@ -1037,6 +1037,10 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly
|
|||||||
$controller->pushCurrent();
|
$controller->pushCurrent();
|
||||||
$controller->doInit();
|
$controller->doInit();
|
||||||
}, $flush);
|
}, $flush);
|
||||||
|
|
||||||
|
if ($res && $res->isError()) {
|
||||||
|
throw new LogicException($res->getBody());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Allow flush from the command line in the absence of HTTPApplication's special sauce
|
// Allow flush from the command line in the absence of HTTPApplication's special sauce
|
||||||
$flush = false;
|
$flush = false;
|
||||||
|
@ -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)
|
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)
|
public function iShouldSeeAToastWithAction($notice, $type, $actions)
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ class CmsUiContext implements Context
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $action
|
* @param $action
|
||||||
* @When /^I click the "([^"]*)" toast action$/
|
* @When /^I click the "(.*)" toast action$/
|
||||||
*/
|
*/
|
||||||
public function stepIClickTheToastAction($action)
|
public function stepIClickTheToastAction($action)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user