From 6fd6a38949a7ac524defbc917e7ebcca86e10522 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 21 Jul 2017 08:58:19 +1200 Subject: [PATCH] BUG Fix unassigned nestedFrom Fixes #7194 --- src/Core/CoreKernel.php | 1 + tests/php/Core/KernelTest.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/Core/CoreKernel.php b/src/Core/CoreKernel.php index 5db708329..086cfe7e6 100644 --- a/src/Core/CoreKernel.php +++ b/src/Core/CoreKernel.php @@ -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; } diff --git a/tests/php/Core/KernelTest.php b/tests/php/Core/KernelTest.php index 58c98b051..42f05c271 100644 --- a/tests/php/Core/KernelTest.php +++ b/tests/php/Core/KernelTest.php @@ -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());