diff --git a/packages/framework/src/Framework/Factories/Concerns/PageDataFactory.php b/packages/framework/src/Framework/Factories/Concerns/PageDataFactory.php index 8c38eb5aa30..9e9a23c7da7 100644 --- a/packages/framework/src/Framework/Factories/Concerns/PageDataFactory.php +++ b/packages/framework/src/Framework/Factories/Concerns/PageDataFactory.php @@ -32,6 +32,8 @@ abstract class PageDataFactory implements Arrayable * Get the generated data as an associative array. * * @return array + * + * @codeCoverageIgnore */ abstract public function toArray(): array; } diff --git a/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php b/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php index 518dbb41796..5b8d28b2a8b 100644 --- a/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php +++ b/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php @@ -17,7 +17,6 @@ class BuildSitemapCommandTest extends TestCase public function testSitemapIsGeneratedWhenConditionsAreMet() { $this->withSiteUrl(); - config(['hyde.generate_sitemap' => true]); $this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml')); @@ -26,4 +25,19 @@ public function testSitemapIsGeneratedWhenConditionsAreMet() Filesystem::unlink('_site/sitemap.xml'); } + + public function testSitemapIsNotGeneratedWhenConditionsAreNotMet() + { + $this->withoutSiteUrl(); + + $this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml')); + + $this->artisan('build:sitemap') + ->expectsOutputToContain('Generating sitemap...') + ->expectsOutputToContain('Skipped') + ->expectsOutput(' > Cannot generate sitemap without a valid base URL') + ->assertExitCode(0); + + $this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml')); + } }