From f578855047113c3181c9869f1ec9d4d521c3bd62 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 22 May 2022 21:47:06 +0200 Subject: [PATCH] Use the snake_case config format --- src/Commands/HydeBuildStaticSiteCommand.php | 2 +- .../Feature/Concerns/HasPageMetadataTest.php | 4 +-- tests/Feature/Services/SitemapServiceTest.php | 4 +-- .../Unit/FileHelperPageLinkPrettyUrlTest.php | 26 +++++++++---------- tests/Unit/FileHelperRelativeLinkTest.php | 12 ++++----- tests/Unit/MarkdownPostHelpersTest.php | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Commands/HydeBuildStaticSiteCommand.php b/src/Commands/HydeBuildStaticSiteCommand.php index a9e0fa83..9d78b9be 100644 --- a/src/Commands/HydeBuildStaticSiteCommand.php +++ b/src/Commands/HydeBuildStaticSiteCommand.php @@ -106,7 +106,7 @@ protected function runPreBuildActions(): void if ($this->option('pretty-urls')) { $this->info('Generating site with pretty URLs'); $this->newLine(); - Config::set(['hyde.prettyUrls' => true]); + Config::set(['hyde.pretty_urls' => true]); } } diff --git a/tests/Feature/Concerns/HasPageMetadataTest.php b/tests/Feature/Concerns/HasPageMetadataTest.php index d423e783..ffcf0cd1 100644 --- a/tests/Feature/Concerns/HasPageMetadataTest.php +++ b/tests/Feature/Concerns/HasPageMetadataTest.php @@ -20,7 +20,7 @@ protected function setUp(): void config(['hyde.meta' => []]); config(['hyde.site_url' => null]); - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); config(['hyde.generateSitemap' => false]); } @@ -46,7 +46,7 @@ public function test_get_canonical_url_returns_pretty_url_for_top_level_page() public string $slug = 'foo'; }; config(['hyde.site_url' => 'https://example.com']); - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('https://example.com/foo', $page->getCanonicalUrl()); } diff --git a/tests/Feature/Services/SitemapServiceTest.php b/tests/Feature/Services/SitemapServiceTest.php index 98f700df..1eee71aa 100644 --- a/tests/Feature/Services/SitemapServiceTest.php +++ b/tests/Feature/Services/SitemapServiceTest.php @@ -112,7 +112,7 @@ public function test_can_generate_sitemap_helper_returns_false_if_sitemaps_are_d public function test_url_item_is_generated_correctly() { - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); config(['hyde.site_url' => 'https://example.com']); touch(Hyde::path('_pages/0-test.blade.php')); @@ -129,7 +129,7 @@ public function test_url_item_is_generated_correctly() public function test_url_item_is_generated_with_pretty_ur_ls_if_enabled() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); config(['hyde.site_url' => 'https://example.com']); touch(Hyde::path('_pages/0-test.blade.php')); diff --git a/tests/Unit/FileHelperPageLinkPrettyUrlTest.php b/tests/Unit/FileHelperPageLinkPrettyUrlTest.php index 6255ce4c..d4c1a6bb 100644 --- a/tests/Unit/FileHelperPageLinkPrettyUrlTest.php +++ b/tests/Unit/FileHelperPageLinkPrettyUrlTest.php @@ -14,82 +14,82 @@ class FileHelperPageLinkPrettyUrlTest extends TestCase { public function test_helper_returns_string_as_is_if_pretty_urls_is_not_true() { - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); $this->assertEquals('foo/bar.html', Hyde::pageLink('foo/bar.html')); } public function test_helper_returns_pretty_url_if_pretty_urls_is_true() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('foo/bar', Hyde::pageLink('foo/bar.html')); } public function test_non_pretty_urls_is_default_value_when_config_is_not_set() { - config(['hyde.prettyUrls' => null]); + config(['hyde.pretty_urls' => null]); $this->assertEquals('foo/bar.html', Hyde::pageLink('foo/bar.html')); } public function test_helper_respects_absolute_urls() { - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); $this->assertEquals('/foo/bar.html', Hyde::pageLink('/foo/bar.html')); } public function test_helper_respects_pretty_absolute_urls() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('/foo/bar', Hyde::pageLink('/foo/bar.html')); } public function test_helper_respects_relative_urls() { - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); $this->assertEquals('../foo/bar.html', Hyde::pageLink('../foo/bar.html')); } public function test_helper_respects_pretty_relative_urls() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('../foo/bar', Hyde::pageLink('../foo/bar.html')); } public function test_non_html_links_are_not_modified() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('/foo/bar.jpg', Hyde::pageLink('/foo/bar.jpg')); } public function test_helper_respects_absolute_urls_with_pretty_urls_enabled() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('/foo/bar.jpg', Hyde::pageLink('/foo/bar.jpg')); } public function test_helper_rewrites_index_when_using_pretty_urls() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('/', Hyde::pageLink('index.html')); } public function test_helper_does_not_rewrite_index_when_not_using_pretty_urls() { - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); $this->assertEquals('index.html', Hyde::pageLink('index.html')); } public function test_helper_rewrites_documentation_page_index_when_using_pretty_urls() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('docs/', Hyde::pageLink('docs/index.html')); } public function test_helper_does_not_rewrite_documentation_page_index_when_not_using_pretty_urls() { - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); $this->assertEquals('docs/index.html', Hyde::pageLink('docs/index.html')); } } diff --git a/tests/Unit/FileHelperRelativeLinkTest.php b/tests/Unit/FileHelperRelativeLinkTest.php index acb93485..07b4a7e9 100644 --- a/tests/Unit/FileHelperRelativeLinkTest.php +++ b/tests/Unit/FileHelperRelativeLinkTest.php @@ -66,27 +66,27 @@ public function test_helper_handles_different_file_extensions() // Test helper returns pretty URL if enabled and destination is a HTML file public function test_helper_returns_pretty_url_if_enabled_and_destination_is_a_html_file() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('../foo', Hyde::relativeLink('foo.html', 'foo/bar.html')); } // Test helper method does not require current path to be HTML to use pretty URLs public function test_helper_method_does_not_require_current_path_to_be_html_to_use_pretty_urls() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('../foo', Hyde::relativeLink('foo.html', 'foo/bar')); } // Test helper returns does not return pretty URL if when enabled but and destination is not a HTML file public function test_helper_returns_does_not_return_pretty_url_if_when_enabled_but_and_destination_is_not_a_html_file() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('../foo.png', Hyde::relativeLink('foo.png', 'foo/bar.html')); } public function test_helper_rewrites_index_when_using_pretty_urls() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('/', Hyde::relativeLink('index.html', 'foo.html')); $this->assertEquals('../', Hyde::relativeLink('index.html', 'foo/bar.html')); $this->assertEquals('../../', Hyde::relativeLink('index.html', 'foo/bar/baz.html')); @@ -94,7 +94,7 @@ public function test_helper_rewrites_index_when_using_pretty_urls() public function test_helper_does_not_rewrite_index_when_not_using_pretty_urls() { - config(['hyde.prettyUrls' => false]); + config(['hyde.pretty_urls' => false]); $this->assertEquals('index.html', Hyde::relativeLink('index.html', 'foo.html')); $this->assertEquals('../index.html', Hyde::relativeLink('index.html', 'foo/bar.html')); $this->assertEquals('../../index.html', Hyde::relativeLink('index.html', 'foo/bar/baz.html')); @@ -102,7 +102,7 @@ public function test_helper_does_not_rewrite_index_when_not_using_pretty_urls() public function test_helper_rewrites_documentation_page_index_when_using_pretty_urls() { - config(['hyde.prettyUrls' => true]); + config(['hyde.pretty_urls' => true]); $this->assertEquals('docs/', Hyde::relativeLink('docs/index.html', 'foo.html')); $this->assertEquals('docs/', Hyde::relativeLink('docs/index.html', 'docs.html')); $this->assertEquals('../docs/', Hyde::relativeLink('docs/index.html', 'foo/bar.html')); diff --git a/tests/Unit/MarkdownPostHelpersTest.php b/tests/Unit/MarkdownPostHelpersTest.php index 24577721..f8de62b1 100644 --- a/tests/Unit/MarkdownPostHelpersTest.php +++ b/tests/Unit/MarkdownPostHelpersTest.php @@ -25,7 +25,7 @@ public function test_get_canonical_link_returns_canonical_uri_path_for_post_slug public function test_get_canonical_link_returns_pretty_url_when_enabled() { - config(['hyde.site_url' => 'https://example.com', 'hyde.prettyUrls' => true]); + config(['hyde.site_url' => 'https://example.com', 'hyde.pretty_urls' => true]); $post = new MarkdownPost([], '', '', 'foo-bar'); $this->assertEquals('https://example.com/posts/foo-bar', $post->getCanonicalLink()); }