Skip to content

Commit

Permalink
Corrected tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnylot committed Apr 22, 2024
1 parent 7060f2b commit be862c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/Illuminate/View/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -334,7 +334,7 @@ public function getEngineFromPath($path)

$this->setPathEngine($path, $this->engines->resolve($engine));

return $this->pathEngines[$path];
return $this->getPathEngine($path);
}

/**
Expand Down Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions tests/View/ViewFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down

0 comments on commit be862c7

Please sign in to comment.