assertTrue(view()->exists($view), "Expected common view [{$view}] to exist."); } } public function test_authentication_and_settings_views_are_not_duplicated(): void { $this->assertDirectoryDoesNotExist(resource_path('views')); $this->assertDirectoryDoesNotExist(resource_path('themes/admin/views/livewire')); $this->assertDirectoryDoesNotExist(resource_path('themes/welcome/views/livewire')); $commonViews = resource_path('themes/common/views'); foreach ([ 'livewire/auth/login.blade.php', 'livewire/auth/register.blade.php', 'livewire/auth/forgot-password.blade.php', 'livewire/auth/reset-password.blade.php', 'livewire/settings/profile.blade.php', 'livewire/settings/appearance.blade.php', 'livewire/settings/security.blade.php', ] as $relativePath) { $matches = collect(File::allFiles(resource_path('themes'))) ->filter(fn ($file) => str_ends_with( str_replace('\\', '/', $file->getPathname()), '/views/'.$relativePath )); $this->assertCount(1, $matches, "Expected one authoritative view for [{$relativePath}]."); $this->assertStringStartsWith( str_replace('\\', '/', $commonViews), str_replace('\\', '/', $matches->first()->getPathname()) ); } } }