Skip to content

Commit

Permalink
Change RSS feed default filename to feed.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed May 19, 2022
1 parent 8704692 commit d545b07
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Services/RssFeedService.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected function xmlEscape(string $string): string

public static function getDefaultOutputFilename(): string
{
return config('hyde.rssFilename', 'feed.rss');
return config('hyde.rssFilename', 'feed.xml');
}

public static function generateFeed(): string
Expand Down
14 changes: 7 additions & 7 deletions tests/Feature/Commands/BuildStaticSiteCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,25 @@ 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'));
unlinkIfExists(Hyde::path('_site/feed.xml'));
$this->artisan('build')
->assertExitCode(0);

$this->assertFileDoesNotExist(Hyde::path('_site/feed.rss'));
$this->assertFileDoesNotExist(Hyde::path('_site/feed.xml'));
}

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'));
unlinkIfExists(Hyde::path('_site/feed.xml'));
$this->artisan('build')
->expectsOutput('Generating RSS feed...')
->assertExitCode(0);

$this->assertFileExists(Hyde::path('_site/feed.rss'));
unlink(Hyde::path('_site/feed.rss'));
$this->assertFileExists(Hyde::path('_site/feed.xml'));
unlink(Hyde::path('_site/feed.xml'));
}

public function test_rss_filename_can_be_changed()
Expand All @@ -151,14 +151,14 @@ public function test_rss_filename_can_be_changed()
config(['hyde.generateRssFeed' => true]);
config(['hyde.rssFilename' => 'blog.xml']);

unlinkIfExists(Hyde::path('_site/feed.rss'));
unlinkIfExists(Hyde::path('_site/feed.xml'));
unlinkIfExists(Hyde::path('_site/blog.xml'));

$this->artisan('build')
->expectsOutput('Generating RSS feed...')
->assertExitCode(0);

$this->assertFileDoesNotExist(Hyde::path('_site/feed.rss'));
$this->assertFileDoesNotExist(Hyde::path('_site/feed.xml'));
$this->assertFileExists(Hyde::path('_site/blog.xml'));
unlink(Hyde::path('_site/blog.xml'));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Services/RssFeedServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function test_xml_channel_element_has_additional_elements()
$service = new RssFeedService();
$this->assertObjectHasAttribute('link', $service->feed->channel);
$this->assertEquals('https://example.com', $service->feed->channel->link);
$this->assertEquals('https://example.com/feed.rss',
$this->assertEquals('https://example.com/feed.xml',
$service->feed->channel->children('atom', true)->link->attributes()->href);

$this->assertObjectHasAttribute('language', $service->feed->channel);
Expand Down

0 comments on commit d545b07

Please sign in to comment.