diff --git a/src/Illuminate/View/Factory.php b/src/Illuminate/View/Factory.php index 8bafc6749d09..d2973b2e45e3 100755 --- a/src/Illuminate/View/Factory.php +++ b/src/Illuminate/View/Factory.php @@ -323,7 +323,7 @@ public function exists($view) public function getEngineFromPath($path) { if ($this->hasPathEngine($path)) { - return $this->pathEngines[$path]; + return $this->getPathEngine($path); } if (! $extension = $this->getExtension($path)) { @@ -334,7 +334,7 @@ public function getEngineFromPath($path) $this->setPathEngine($path, $this->engines->resolve($engine)); - return $this->pathEngines[$path]; + return $this->getPathEngine($path); } /** @@ -503,6 +503,11 @@ public function setPathEngine($path, $engine) $this->pathEngines[$path] = $engine; } + public function getPathEngine($path) + { + return $this->pathEngines[$path]; + } + public function hasPathEngine($path) { return isset($this->pathEngines[$path]); diff --git a/tests/View/ViewFactoryTest.php b/tests/View/ViewFactoryTest.php index bbbf0e555204..cbb74405fd9c 100755 --- a/tests/View/ViewFactoryTest.php +++ b/tests/View/ViewFactoryTest.php @@ -842,7 +842,7 @@ public function testMakeWithSlashAndDot() { $factory = $this->getFactory(); $factory->getFinder()->shouldReceive('find')->twice()->with('foo.bar')->andReturn('path.php'); - $factory->getEngineResolver()->shouldReceive('resolve')->twice()->with('php')->andReturn(m::mock(Engine::class)); + $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('php')->andReturn(m::mock(Engine::class)); $factory->getDispatcher()->shouldReceive('hasListeners')->andReturn(false); $factory->make('foo/bar'); $factory->make('foo.bar'); @@ -852,7 +852,7 @@ public function testNamespacedViewNamesAreNormalizedProperly() { $factory = $this->getFactory(); $factory->getFinder()->shouldReceive('find')->twice()->with('vendor/package::foo.bar')->andReturn('path.php'); - $factory->getEngineResolver()->shouldReceive('resolve')->twice()->with('php')->andReturn(m::mock(Engine::class)); + $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('php')->andReturn(m::mock(Engine::class)); $factory->getDispatcher()->shouldReceive('hasListeners')->andReturn(false); $factory->make('vendor/package::foo/bar'); $factory->make('vendor/package::foo.bar');