Skip to content

Commit

Permalink
2.x Fix: Adjust config setting to make sure it does not cause other e…
Browse files Browse the repository at this point in the history
…rrors (#300)

* Adjust config setting to make sure it does not cause other errors

* Also check for all features to still be able to make the view finder
  • Loading branch information
ArlonAntonius committed May 12, 2024
1 parent b10d92b commit 8feca65
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Affects/Views/Events/ConfigureViews.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function addNamespace(string $path, string $namespace = 'tenant'): static
public function addPath(string $path, bool $replace = false): static
{
if ($replace) {
config(['view.paths' => $path]);
config(['view.paths' => [$path]]);
$finder = $this->view->getFinder();

$finder->prependLocation($path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace Tenancy\Tests\Affects\Views\Feature;

use Illuminate\Contracts\View\Factory;
use Illuminate\View\ViewFinderInterface;
use Tenancy\Affects\Views\Provider;
use Tenancy\Identification\Contracts\Tenant;
use Tenancy\Tests\Affects\AffectsFeatureTestCase;
Expand All @@ -33,6 +34,6 @@ protected function isAffected(Tenant $tenant): bool
/** @var Factory $views */
$views = $this->app->make(Factory::class);

return $views->exists('tenant::test');
return $views->exists('tenant::test') && $this->app->make('view.finder') instanceof ViewFinderInterface;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace Tenancy\Tests\Affects\Views\Feature;

use Illuminate\Contracts\View\Factory;
use Illuminate\View\ViewFinderInterface;
use Tenancy\Affects\Views\Provider;
use Tenancy\Identification\Contracts\Tenant;
use Tenancy\Tests\Affects\AffectsFeatureTestCase;
Expand All @@ -33,6 +34,6 @@ protected function isAffected(Tenant $tenant): bool
/** @var Factory $views */
$views = $this->app->make(Factory::class);

return $views->exists('test') && $views->exists('welcome');
return $views->exists('test') && $views->exists('welcome') && $this->app->make('view.finder') instanceof ViewFinderInterface;
}
}
3 changes: 2 additions & 1 deletion tests/Affects/Views/Feature/ConfigureViewsPathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace Tenancy\Tests\Affects\Views\Feature;

use Illuminate\Contracts\View\Factory;
use Illuminate\View\ViewFinderInterface;
use Tenancy\Affects\Views\Provider;
use Tenancy\Identification\Contracts\Tenant;
use Tenancy\Tests\Affects\AffectsFeatureTestCase;
Expand All @@ -33,6 +34,6 @@ protected function isAffected(Tenant $tenant): bool
/** @var Factory $views */
$views = $this->app->make(Factory::class);

return $views->exists('test');
return $views->exists('test') && $this->app->make('view.finder') instanceof ViewFinderInterface;
}
}

0 comments on commit 8feca65

Please sign in to comment.