BUG Fix unassigned nestedFrom

Fixes #7194
This commit is contained in:
Damian Mooyman 2017-07-21 08:58:19 +12:00
parent e77c7fe04c
commit 6fd6a38949
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
2 changed files with 4 additions and 0 deletions

View File

@ -550,6 +550,7 @@ class CoreKernel implements Kernel
$kernel = clone $this;
$kernel->setConfigLoader($this->configLoader->nest());
$kernel->setInjectorLoader($this->injectorLoader->nest());
$kernel->nestedFrom = $this;
return $kernel;
}

View File

@ -6,6 +6,7 @@ use BadMethodCallException;
use SilverStripe\Control\Director;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Config\ConfigLoader;
use SilverStripe\Core\CoreKernel;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Injector\InjectorLoader;
use SilverStripe\Core\Kernel;
@ -18,8 +19,10 @@ class KernelTest extends SapphireTest
/** @var Kernel $kernel */
$kernel = Injector::inst()->get(Kernel::class);
/** @var CoreKernel $nested1 */
$nested1 = $kernel->nest();
Director::config()->set('alternate_base_url', '/mysite/');
$this->assertEquals($kernel, $nested1->getNestedFrom());
$this->assertEquals($nested1->getConfigLoader(), ConfigLoader::inst());
$this->assertEquals($nested1->getInjectorLoader(), InjectorLoader::inst());
$this->assertEquals(1, ConfigLoader::inst()->countManifests());