From fe93f5b7cd1dea1f3bbb5a851b8185e5288f50de Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Thu, 19 May 2022 11:38:45 +0200 Subject: [PATCH] Update sitemap tests and add rss feed tests --- .../Commands/BuildStaticSiteCommandTest.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/Feature/Commands/BuildStaticSiteCommandTest.php b/tests/Feature/Commands/BuildStaticSiteCommandTest.php index 9cecfe37..49e812d6 100644 --- a/tests/Feature/Commands/BuildStaticSiteCommandTest.php +++ b/tests/Feature/Commands/BuildStaticSiteCommandTest.php @@ -112,10 +112,37 @@ public function test_sitemap_is_generated_when_conditions_are_met() unlinkIfExists(Hyde::path('_site/sitemap.xml')); $this->artisan('build') - ->expectsOutput('Generating sitemap.xml') + ->expectsOutput('Generating sitemap...') ->assertExitCode(0); $this->assertFileExists(Hyde::path('_site/sitemap.xml')); + unlink(Hyde::path('_site/sitemap.xml')); + } + + public function test_rss_feed_is_not_generated_when_conditions_are_not_met() + { + config(['hyde.site_url' => '']); + config(['hyde.generateRssFeed' => false]); + + unlinkIfExists(Hyde::path('_site/feed.rss')); + $this->artisan('build') + ->assertExitCode(0); + + $this->assertFileDoesNotExist(Hyde::path('_site/feed.rss')); + } + + public function test_rss_feed_is_generated_when_conditions_are_met() + { + config(['hyde.site_url' => 'https://example.com']); + config(['hyde.generateRssFeed' => true]); + + unlinkIfExists(Hyde::path('_site/feed.rss')); + $this->artisan('build') + ->expectsOutput('Generating RSS feed...') + ->assertExitCode(0); + + $this->assertFileExists(Hyde::path('_site/feed.rss')); + unlink(Hyde::path('_site/feed.rss')); } /**