From 962c9dc6e6aa5d6f079f77012b08e1f1f4ae6989 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Sun, 16 Jul 2017 15:45:37 +0200 Subject: [PATCH] Add Kernel::getEnvironment() --- src/Kernel.php | 5 +++++ tests/KernelTest.php | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Kernel.php b/src/Kernel.php index da58191..23dca37 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -76,6 +76,11 @@ public function createContainer() : Container return $containerBuilder->build(); } + public function getEnvironment() : string + { + return $this->environment; + } + /** * Override this method to customize the container builder before it is used. */ diff --git a/tests/KernelTest.php b/tests/KernelTest.php index 34f519b..ed8d170 100644 --- a/tests/KernelTest.php +++ b/tests/KernelTest.php @@ -75,4 +75,12 @@ public function uses_provided_config() $this->assertEquals('biz', $container->get('foo')); $this->assertEquals('bar', $container->get('bar')); } + + /** @test */ + public function exposes_the_environment() + { + $this->kernel = new Kernel; + + $this->assertEquals('prod', $this->kernel->getEnvironment()); + } }