From d6d1d5e0e64d11ef19abf75da2ac0ddb13c38ce4 Mon Sep 17 00:00:00 2001 From: Justin Obara Date: Wed, 22 Nov 2023 11:35:14 -0500 Subject: [PATCH] fix: robots and sitemap served at /storage path (resolves #1998) (#2000) fix: robots and sitemap served at /storage path --- .gitignore | 2 ++ config/filesystems.php | 2 ++ tests/Feature/Console/DeployLocalTest.php | 27 ------------------- tests/Feature/Console/GenerateSitemapTest.php | 2 +- 4 files changed, 5 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index be86bc1e4..2547844b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ /node_modules /public/hot /public/storage +/public/robots.txt +/public/sitemap.xml /storage/*.key /vendor .DS_Store diff --git a/config/filesystems.php b/config/filesystems.php index 136c4a5a1..9e349af68 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -82,6 +82,8 @@ 'links' => [ public_path('storage') => storage_path('app/public'), + public_path('sitemap.xml') => storage_path('app/public/sitemap.xml'), + public_path('robots.txt') => storage_path('app/public/robots.txt'), ], ]; diff --git a/tests/Feature/Console/DeployLocalTest.php b/tests/Feature/Console/DeployLocalTest.php index 183185992..2cb57ae40 100644 --- a/tests/Feature/Console/DeployLocalTest.php +++ b/tests/Feature/Console/DeployLocalTest.php @@ -2,37 +2,10 @@ use function Pest\Laravel\artisan; -beforeEach(function () { - $this->disk = Storage::disk('public'); - $this->robots = 'robots.txt'; - $this->robotsOriginal = 'robots.original.txt'; - $this->sitemap = 'sitemap.xml'; - $this->sitemapOriginal = 'sitemap.original.xml'; - - if ($this->disk->fileExists($this->robots)) { - Storage::disk('public')->move($this->robots, $this->robotsOriginal); - } - - if ($this->disk->fileExists($this->sitemap)) { - Storage::disk('public')->move($this->sitemap, $this->sitemapOriginal); - } -}); - afterEach(function () { artisan('optimize:clear'); artisan('icons:clear'); artisan('event:clear'); - - Storage::disk('public')->delete($this->robots); - Storage::disk('public')->delete($this->sitemap); - - if ($this->disk->fileExists($this->robotsOriginal)) { - Storage::disk('public')->move($this->robotsOriginal, $this->robots); - } - - if ($this->disk->fileExists($this->sitemapOriginal)) { - Storage::disk('public')->move($this->sitemapOriginal, $this->sitemap); - } }); test('Completes successfully', function () { diff --git a/tests/Feature/Console/GenerateSitemapTest.php b/tests/Feature/Console/GenerateSitemapTest.php index cc43fba70..d385bf426 100644 --- a/tests/Feature/Console/GenerateSitemapTest.php +++ b/tests/Feature/Console/GenerateSitemapTest.php @@ -35,7 +35,7 @@ $this->disk->assertExists($this->sitemap); - artisan('seo:generate')->assertSuccessful(); + artisan('seo:generate-sitemap')->assertSuccessful(); $this->disk->assertExists($this->sitemap); });