diff --git a/tests/Feature/Actions/CreatesNewPageSourceFileTest.php b/tests/Feature/Actions/CreatesNewPageSourceFileTest.php index 67cf466d..0748dbfa 100644 --- a/tests/Feature/Actions/CreatesNewPageSourceFileTest.php +++ b/tests/Feature/Actions/CreatesNewPageSourceFileTest.php @@ -18,7 +18,7 @@ */ class CreatesNewPageSourceFileTest extends TestCase { - public function test_class_can_be_instantiated() + public function testClassCanBeInstantiated() { $this->assertInstanceOf( CreatesNewPageSourceFile::class, @@ -26,7 +26,7 @@ public function test_class_can_be_instantiated() ); } - public function test_that_an_exception_is_thrown_for_invalid_page_type() + public function testThatAnExceptionIsThrownForInvalidPageType() { $this->expectException(UnsupportedPageTypeException::class); $this->expectExceptionMessage('The page type must be either "markdown", "blade", or "documentation"'); @@ -34,7 +34,7 @@ public function test_that_an_exception_is_thrown_for_invalid_page_type() (new CreatesNewPageSourceFile('Test Page', 'invalid'))->save(); } - public function test_that_an_exception_is_thrown_if_file_already_exists_and_overwrite_is_false() + public function testThatAnExceptionIsThrownIfFileAlreadyExistsAndOverwriteIsFalse() { $this->file('_pages/foo.md', 'foo'); @@ -47,7 +47,7 @@ public function test_that_an_exception_is_thrown_if_file_already_exists_and_over Filesystem::unlink('_pages/foo.md'); } - public function test_that_can_save_file_returns_true_if_file_already_exists_and_overwrite_is_true() + public function testThatCanSaveFileReturnsTrueIfFileAlreadyExistsAndOverwriteIsTrue() { $this->file('_pages/foo.md', 'foo'); @@ -56,7 +56,7 @@ public function test_that_can_save_file_returns_true_if_file_already_exists_and_ Filesystem::unlink('_pages/foo.md'); } - public function test_exception_is_thrown_for_conflicting_blade_pages() + public function testExceptionIsThrownForConflictingBladePages() { $this->file('_pages/foo.blade.php', 'foo'); @@ -69,7 +69,7 @@ public function test_exception_is_thrown_for_conflicting_blade_pages() Filesystem::unlink('_pages/foo.blade.php'); } - public function test_exception_is_thrown_for_conflicting_documentation_pages() + public function testExceptionIsThrownForConflictingDocumentationPages() { $this->file('_docs/foo.md', 'foo'); @@ -82,7 +82,7 @@ public function test_exception_is_thrown_for_conflicting_documentation_pages() Filesystem::unlink('_docs/foo.md'); } - public function test_that_a_markdown_file_can_be_created_and_contains_expected_content() + public function testThatAMarkdownFileCanBeCreatedAndContainsExpectedContent() { (new CreatesNewPageSourceFile('Test Page'))->save(); @@ -95,7 +95,7 @@ public function test_that_a_markdown_file_can_be_created_and_contains_expected_c Filesystem::unlink('_pages/test-page.md'); } - public function test_that_a_blade_file_can_be_created_and_contains_expected_content() + public function testThatABladeFileCanBeCreatedAndContainsExpectedContent() { (new CreatesNewPageSourceFile('Test Page', BladePage::class))->save(); @@ -119,7 +119,7 @@ public function test_that_a_blade_file_can_be_created_and_contains_expected_cont Filesystem::unlink('_pages/test-page.blade.php'); } - public function test_that_a_documentation_file_can_be_created_and_contains_expected_content() + public function testThatADocumentationFileCanBeCreatedAndContainsExpectedContent() { (new CreatesNewPageSourceFile('Test Page', DocumentationPage::class))->save(); @@ -133,7 +133,7 @@ public function test_that_a_documentation_file_can_be_created_and_contains_expec Filesystem::unlink('_docs/test-page.md'); } - public function test_that_a_markdown_file_can_be_created_with_custom_content() + public function testThatAMarkdownFileCanBeCreatedWithCustomContent() { (new CreatesNewPageSourceFile('Test Page', customContent: 'Hello World!'))->save(); @@ -156,7 +156,7 @@ public function test_that_a_markdown_file_can_be_created_with_custom_content() Filesystem::unlink('_pages/test-page.md'); } - public function test_that_a_blade_file_can_be_created_with_custom_content() + public function testThatABladeFileCanBeCreatedWithCustomContent() { (new CreatesNewPageSourceFile('Test Page', BladePage::class, customContent: 'Hello World!'))->save(); @@ -184,7 +184,7 @@ public function test_that_a_blade_file_can_be_created_with_custom_content() Filesystem::unlink('_pages/test-page.blade.php'); } - public function test_that_the_file_path_can_be_returned() + public function testThatTheFilePathCanBeReturned() { $this->assertSame( Hyde::path('_pages/test-page.md'), @@ -200,21 +200,21 @@ public function test_that_the_file_path_can_be_returned() Filesystem::unlink('_pages/test-page.blade.php'); } - public function test_file_is_created_using_slug_generated_from_title() + public function testFileIsCreatedUsingSlugGeneratedFromTitle() { (new CreatesNewPageSourceFile('Foo Bar'))->save(); $this->assertFileExists(Hyde::path('_pages/foo-bar.md')); Filesystem::unlink('_pages/foo-bar.md'); } - public function test_action_can_generate_nested_pages() + public function testActionCanGenerateNestedPages() { (new CreatesNewPageSourceFile('foo/bar'))->save(); $this->assertFileExists(Hyde::path('_pages/foo/bar.md')); Filesystem::deleteDirectory('_pages/foo'); } - public function test_can_create_deeply_nested_pages() + public function testCanCreateDeeplyNestedPages() { (new CreatesNewPageSourceFile('/foo/bar/Foo Bar'))->save(); $this->assertFileExists(Hyde::path('_pages/foo/bar/foo-bar.md')); diff --git a/tests/Feature/AssetServiceTest.php b/tests/Feature/AssetServiceTest.php index 0f36c294..b45d4d7b 100644 --- a/tests/Feature/AssetServiceTest.php +++ b/tests/Feature/AssetServiceTest.php @@ -15,14 +15,14 @@ */ class AssetServiceTest extends TestCase { - public function test_media_link_returns_media_path_with_cache_key() + public function testMediaLinkReturnsMediaPathWithCacheKey() { $service = new AssetService(); $this->assertIsString($path = $service->mediaLink('app.css')); $this->assertEquals('media/app.css?v='.md5_file(Hyde::path('_media/app.css')), $path); } - public function test_media_link_returns_media_path_without_cache_key_if_cache_busting_is_disabled() + public function testMediaLinkReturnsMediaPathWithoutCacheKeyIfCacheBustingIsDisabled() { config(['hyde.enable_cache_busting' => false]); $service = new AssetService(); @@ -30,7 +30,7 @@ public function test_media_link_returns_media_path_without_cache_key_if_cache_bu $this->assertEquals('media/app.css', $path); } - public function test_media_link_supports_custom_media_directories() + public function testMediaLinkSupportsCustomMediaDirectories() { $this->directory('_assets'); $this->file('_assets/app.css'); diff --git a/tests/Feature/AuthorPostsIntegrationTest.php b/tests/Feature/AuthorPostsIntegrationTest.php index dedfcdcd..bea078f5 100644 --- a/tests/Feature/AuthorPostsIntegrationTest.php +++ b/tests/Feature/AuthorPostsIntegrationTest.php @@ -33,7 +33,7 @@ protected function setUp(): void * Check that the author was not defined. * We do this by building the static site and inspecting the DOM. */ - public function test_create_post_with_undefined_author() + public function testCreatePostWithUndefinedAuthor() { // Create a new post (new CreatesNewMarkdownPostFile( @@ -66,7 +66,7 @@ public function test_create_post_with_undefined_author() /** * Test that a defined author has its name injected into the DOM. */ - public function test_create_post_with_defined_author_with_name() + public function testCreatePostWithDefinedAuthorWithName() { // Create a new post (new CreatesNewMarkdownPostFile( @@ -104,7 +104,7 @@ public function test_create_post_with_defined_author_with_name() /** * Test that a defined author with website has its site linked. */ - public function test_create_post_with_defined_author_with_website() + public function testCreatePostWithDefinedAuthorWithWebsite() { // Create a new post (new CreatesNewMarkdownPostFile( diff --git a/tests/Feature/BladeMatterParserTest.php b/tests/Feature/BladeMatterParserTest.php index bc5300c8..d10deb88 100644 --- a/tests/Feature/BladeMatterParserTest.php +++ b/tests/Feature/BladeMatterParserTest.php @@ -13,14 +13,14 @@ */ class BladeMatterParserTest extends TestCase { - public function test_can_parse_front_matter() + public function testCanParseFrontMatter() { $parser = new BladeMatterParser('@php($foo = "bar")'); $parser->parse(); $this->assertEquals(['foo' => 'bar'], $parser->get()); } - public function test_parse_string_helper_method() + public function testParseStringHelperMethod() { $this->assertSame( (new BladeMatterParser('foo'))->parse()->get(), @@ -28,7 +28,7 @@ public function test_parse_string_helper_method() ); } - public function test_parse_file_helper_method() + public function testParseFileHelperMethod() { $this->file('foo', 'foo'); $this->assertSame( @@ -37,7 +37,7 @@ public function test_parse_file_helper_method() ); } - public function test_can_parse_multiple_front_matter_lines() + public function testCanParseMultipleFrontMatterLines() { $document = <<<'BLADE' @php($foo = 'bar') @@ -47,7 +47,7 @@ public function test_can_parse_multiple_front_matter_lines() $this->assertEquals(['foo' => 'bar', 'bar' => 'baz', 'baz' => 'qux'], BladeMatterParser::parseString($document)); } - public function test_can_parse_front_matter_with_various_formats() + public function testCanParseFrontMatterWithVariousFormats() { $matrix = [ '@php($foo = "bar")' => ['foo' => 'bar'], @@ -61,41 +61,41 @@ public function test_can_parse_front_matter_with_various_formats() } } - public function test_can_parse_front_matter_with_array() + public function testCanParseFrontMatterWithArray() { $document = "@php(\$foo = ['bar' => 'baz'])"; $this->assertEquals(['foo' => ['bar' => 'baz']], BladeMatterParser::parseString($document)); } - public function test_line_matches_front_matter() + public function testLineMatchesFrontMatter() { $this->assertTrue(ParserTestClass::lineMatchesFrontMatter('@php($foo = "bar")')); $this->assertFalse(ParserTestClass::lineMatchesFrontMatter('foo bar')); } - public function test_directive_cannot_have_leading_whitespace() + public function testDirectiveCannotHaveLeadingWhitespace() { $this->assertFalse(ParserTestClass::lineMatchesFrontMatter(' @php($foo = "bar")')); } - public function test_directive_signature_cannot_contain_whitespace() + public function testDirectiveSignatureCannotContainWhitespace() { $this->assertFalse(ParserTestClass::lineMatchesFrontMatter('@php( $foo = "bar")')); $this->assertFalse(ParserTestClass::lineMatchesFrontMatter('@ php($foo = "bar")')); $this->assertFalse(ParserTestClass::lineMatchesFrontMatter('@ php ($foo = "bar")')); } - public function test_extract_key() + public function testExtractKey() { $this->assertSame('foo', ParserTestClass::extractKey('@php($foo = "bar")')); } - public function test_extract_value() + public function testExtractValue() { $this->assertSame('bar', ParserTestClass::extractValue('@php($foo = "bar")')); } - public function test_get_value_with_type() + public function testGetValueWithType() { $this->assertSame('string', ParserTestClass::getValueWithType('string')); $this->assertSame('string', ParserTestClass::getValueWithType('string')); @@ -110,7 +110,7 @@ public function test_get_value_with_type() $this->assertSame(['foo' => 'bar'], ParserTestClass::getValueWithType("['foo' => 'bar']")); } - public function test_parse_array_string() + public function testParseArrayString() { $this->assertSame(['foo' => 'bar'], ParserTestClass::parseArrayString('["foo" => "bar"]')); $this->assertSame(['foo' => 'bar'], ParserTestClass::parseArrayString('["foo" => "bar"]')); @@ -123,13 +123,13 @@ public function test_parse_array_string() $this->assertSame(['foo' => 1], ParserTestClass::parseArrayString('["foo" => 1]')); } - public function test_parse_invalid_array_string() + public function testParseInvalidArrayString() { $this->expectException(RuntimeException::class); ParserTestClass::parseArrayString('foo'); } - public function test_parse_multidimensional_array_string() + public function testParseMultidimensionalArrayString() { $this->expectException(RuntimeException::class); ParserTestClass::parseArrayString('["foo" => ["bar" => "baz"]]'); diff --git a/tests/Feature/Commands/BuildRssFeedCommandTest.php b/tests/Feature/Commands/BuildRssFeedCommandTest.php index c24051fb..1575896a 100644 --- a/tests/Feature/Commands/BuildRssFeedCommandTest.php +++ b/tests/Feature/Commands/BuildRssFeedCommandTest.php @@ -14,7 +14,7 @@ */ class BuildRssFeedCommandTest extends TestCase { - public function test_rss_feed_is_generated_when_conditions_are_met() + public function testRssFeedIsGeneratedWhenConditionsAreMet() { config(['hyde.url' => 'https://example.com']); config(['hyde.rss.enabled' => true]); @@ -27,7 +27,7 @@ public function test_rss_feed_is_generated_when_conditions_are_met() Filesystem::unlink('_site/feed.xml'); } - public function test_rss_filename_can_be_changed() + public function testRssFilenameCanBeChanged() { config(['hyde.url' => 'https://example.com']); config(['hyde.rss.enabled' => true]); diff --git a/tests/Feature/Commands/BuildSearchCommandTest.php b/tests/Feature/Commands/BuildSearchCommandTest.php index d8dc55a2..8fa0345c 100644 --- a/tests/Feature/Commands/BuildSearchCommandTest.php +++ b/tests/Feature/Commands/BuildSearchCommandTest.php @@ -16,7 +16,7 @@ */ class BuildSearchCommandTest extends TestCase { - public function test_it_creates_the_search_json_file() + public function testItCreatesTheSearchJsonFile() { $this->assertFileDoesNotExist(Hyde::path('_site/docs/search.json')); @@ -27,7 +27,7 @@ public function test_it_creates_the_search_json_file() Filesystem::unlink('_site/docs/search.html'); } - public function test_it_creates_the_search_page() + public function testItCreatesTheSearchPage() { $this->assertFileDoesNotExist(Hyde::path('_site/docs/search.html')); @@ -38,7 +38,7 @@ public function test_it_creates_the_search_page() Filesystem::unlink('_site/docs/search.html'); } - public function test_it_does_not_create_the_search_page_if_disabled() + public function testItDoesNotCreateTheSearchPageIfDisabled() { config(['docs.create_search_page' => false]); @@ -48,7 +48,7 @@ public function test_it_does_not_create_the_search_page_if_disabled() Filesystem::unlink('_site/docs/search.json'); } - public function test_it_does_not_display_the_estimation_message_when_it_is_less_than_1_second() + public function testItDoesNotDisplayTheEstimationMessageWhenItIsLessThan1Second() { $this->artisan('build:search') ->doesntExpectOutputToContain('> This will take an estimated') @@ -58,7 +58,7 @@ public function test_it_does_not_display_the_estimation_message_when_it_is_less_ Filesystem::unlink('_site/docs/search.html'); } - public function test_search_files_can_be_generated_for_custom_docs_output_directory() + public function testSearchFilesCanBeGeneratedForCustomDocsOutputDirectory() { DocumentationPage::setOutputDirectory('foo'); @@ -69,7 +69,7 @@ public function test_search_files_can_be_generated_for_custom_docs_output_direct Filesystem::deleteDirectory('_site/foo'); } - public function test_search_files_can_be_generated_for_custom_site_output_directory() + public function testSearchFilesCanBeGeneratedForCustomSiteOutputDirectory() { Hyde::setOutputDirectory('foo'); @@ -80,7 +80,7 @@ public function test_search_files_can_be_generated_for_custom_site_output_direct Filesystem::deleteDirectory('foo'); } - public function test_search_files_can_be_generated_for_custom_site_and_docs_output_directories() + public function testSearchFilesCanBeGeneratedForCustomSiteAndDocsOutputDirectories() { Hyde::setOutputDirectory('foo'); DocumentationPage::setOutputDirectory('bar'); @@ -92,7 +92,7 @@ public function test_search_files_can_be_generated_for_custom_site_and_docs_outp Filesystem::deleteDirectory('foo'); } - public function test_search_files_can_be_generated_for_custom_site_and_nested_docs_output_directories() + public function testSearchFilesCanBeGeneratedForCustomSiteAndNestedDocsOutputDirectories() { Hyde::setOutputDirectory('foo/bar'); DocumentationPage::setOutputDirectory('baz'); diff --git a/tests/Feature/Commands/BuildSitemapCommandTest.php b/tests/Feature/Commands/BuildSitemapCommandTest.php index 56dd2b17..af77486f 100644 --- a/tests/Feature/Commands/BuildSitemapCommandTest.php +++ b/tests/Feature/Commands/BuildSitemapCommandTest.php @@ -14,7 +14,7 @@ */ class BuildSitemapCommandTest extends TestCase { - public function test_sitemap_is_generated_when_conditions_are_met() + public function testSitemapIsGeneratedWhenConditionsAreMet() { config(['hyde.url' => 'https://example.com']); config(['hyde.generate_sitemap' => true]); diff --git a/tests/Feature/Commands/ChangeSourceDirectoryCommandTest.php b/tests/Feature/Commands/ChangeSourceDirectoryCommandTest.php index fc107f89..5a0fc3ce 100644 --- a/tests/Feature/Commands/ChangeSourceDirectoryCommandTest.php +++ b/tests/Feature/Commands/ChangeSourceDirectoryCommandTest.php @@ -13,7 +13,7 @@ */ class ChangeSourceDirectoryCommandTest extends TestCase { - public function test_command_moves_source_directories_to_new_supplied_directory_and_updates_the_configuration_file() + public function testCommandMovesSourceDirectoriesToNewSuppliedDirectoryAndUpdatesTheConfigurationFile() { $this->file('_pages/tracker.txt', 'This should be moved to the new location'); @@ -51,7 +51,7 @@ public function test_command_moves_source_directories_to_new_supplied_directory_ Filesystem::putContents('config/hyde.php', $config); } - public function test_with_missing_config_search_string() + public function testWithMissingConfigSearchString() { $this->file('_pages/tracker.txt', 'This should be moved to the new location'); @@ -90,14 +90,14 @@ public function test_with_missing_config_search_string() Filesystem::putContents('config/hyde.php', $config); } - public function test_with_name_matching_current_value() + public function testWithNameMatchingCurrentValue() { $this->artisan('change:sourceDirectory /') ->expectsOutput("The directory '/' is already set as the project source root!") ->assertExitCode(409); } - public function test_with_existing_directory() + public function testWithExistingDirectory() { $this->directory('test'); $this->directory('test/_pages'); @@ -108,7 +108,7 @@ public function test_with_existing_directory() ->assertExitCode(409); } - public function test_with_target_containing_subdirectory_file() + public function testWithTargetContainingSubdirectoryFile() { $this->directory('test'); $this->file('test/_pages'); @@ -118,7 +118,7 @@ public function test_with_target_containing_subdirectory_file() ->assertExitCode(409); } - public function test_with_target_being_file() + public function testWithTargetBeingFile() { $this->file('test'); diff --git a/tests/Feature/Commands/DebugCommandTest.php b/tests/Feature/Commands/DebugCommandTest.php index 938a0caf..5cd341b0 100644 --- a/tests/Feature/Commands/DebugCommandTest.php +++ b/tests/Feature/Commands/DebugCommandTest.php @@ -18,12 +18,12 @@ protected function setUp(): void $this->app->bind('git.version', fn () => 'foo'); } - public function test_debug_command_can_run() + public function testDebugCommandCanRun() { $this->artisan('debug')->assertExitCode(0); } - public function test_it_prints_debug_information() + public function testItPrintsDebugInformation() { $this->artisan('debug') ->expectsOutput('HydePHP Debug Screen') @@ -36,7 +36,7 @@ public function test_it_prints_debug_information() ->assertExitCode(0); } - public function test_it_prints_verbose_debug_information() + public function testItPrintsVerboseDebugInformation() { $this->artisan('debug --verbose') ->expectsOutput('HydePHP Debug Screen') diff --git a/tests/Feature/Commands/MakePageCommandTest.php b/tests/Feature/Commands/MakePageCommandTest.php index bae51389..182c3850 100644 --- a/tests/Feature/Commands/MakePageCommandTest.php +++ b/tests/Feature/Commands/MakePageCommandTest.php @@ -40,12 +40,12 @@ protected function tearDown(): void parent::tearDown(); } - public function test_command_can_run() + public function testCommandCanRun() { $this->artisan('make:page "foo test page"')->assertExitCode(0); } - public function test_command_output() + public function testCommandOutput() { $this->artisan('make:page "foo test page"') ->expectsOutputToContain('Creating a new page!') @@ -53,19 +53,19 @@ public function test_command_output() ->assertExitCode(0); } - public function test_command_allows_user_to_specify_page_type() + public function testCommandAllowsUserToSpecifyPageType() { $this->artisan('make:page "foo test page" --type=markdown')->assertExitCode(0); $this->artisan('make:page "foo test page" --type=blade')->assertExitCode(0); } - public function test_type_option_is_case_insensitive() + public function testTypeOptionIsCaseInsensitive() { $this->artisan('make:page "foo test page" --type=Markdown')->assertExitCode(0); $this->artisan('make:page "foo test page" --type=Blade')->assertExitCode(0); } - public function test_command_fails_if_user_specifies_invalid_page_type() + public function testCommandFailsIfUserSpecifiesInvalidPageType() { $this->expectException(Exception::class); $this->expectExceptionMessage('The page type [invalid] is not supported.'); @@ -73,21 +73,21 @@ public function test_command_fails_if_user_specifies_invalid_page_type() $this->artisan('make:page "foo test page" --type=invalid')->assertExitCode(400); } - public function test_command_creates_markdown_file() + public function testCommandCreatesMarkdownFile() { $this->artisan('make:page "foo test page"')->assertExitCode(0); $this->assertFileExists($this->markdownPath); } - public function test_command_creates_blade_file() + public function testCommandCreatesBladeFile() { $this->artisan('make:page "foo test page" --type="blade"')->assertExitCode(0); $this->assertFileExists($this->bladePath); } - public function test_command_creates_documentation_file() + public function testCommandCreatesDocumentationFile() { $this->artisan('make:page "foo test page" --type="documentation"')->assertExitCode(0); @@ -95,7 +95,7 @@ public function test_command_creates_documentation_file() Filesystem::unlink('_docs/foo-test-page.md'); } - public function test_command_fails_if_file_already_exists() + public function testCommandFailsIfFileAlreadyExists() { file_put_contents($this->markdownPath, 'This should not be overwritten'); @@ -107,7 +107,7 @@ public function test_command_fails_if_file_already_exists() $this->assertEquals('This should not be overwritten', file_get_contents($this->markdownPath)); } - public function test_command_overwrites_existing_files_when_force_option_is_used() + public function testCommandOverwritesExistingFilesWhenForceOptionIsUsed() { file_put_contents($this->markdownPath, 'This should be overwritten'); @@ -116,7 +116,7 @@ public function test_command_overwrites_existing_files_when_force_option_is_used $this->assertNotEquals('This should be overwritten', file_get_contents($this->markdownPath)); } - public function test_command_prompts_for_title_if_it_was_not_specified() + public function testCommandPromptsForTitleIfItWasNotSpecified() { $this->artisan('make:page') ->expectsQuestion('What is the title of the page?', 'Test Page') @@ -126,7 +126,7 @@ public function test_command_prompts_for_title_if_it_was_not_specified() Filesystem::unlink('_pages/test-page.md'); } - public function test_command_falls_back_to_default_title_if_user_enters_nothing() + public function testCommandFallsBackToDefaultTitleIfUserEntersNothing() { $this->artisan('make:page') ->expectsQuestion('What is the title of the page?', null) @@ -136,7 +136,7 @@ public function test_command_falls_back_to_default_title_if_user_enters_nothing( Filesystem::unlink('_pages/my-new-page.md'); } - public function test_page_type_shorthand_can_be_used_to_create_blade_pages() + public function testPageTypeShorthandCanBeUsedToCreateBladePages() { $this->artisan('make:page "foo test page" --blade') ->expectsOutput("Creating a new Blade page with title: foo test page\n") @@ -145,7 +145,7 @@ public function test_page_type_shorthand_can_be_used_to_create_blade_pages() $this->assertFileExists($this->bladePath); } - public function test_page_type_shorthand_can_be_used_to_create_documentation_pages() + public function testPageTypeShorthandCanBeUsedToCreateDocumentationPages() { $this->artisan('make:page "foo test page" --docs') ->expectsOutput("Creating a new Documentation page with title: foo test page\n") diff --git a/tests/Feature/Commands/MakePostCommandTest.php b/tests/Feature/Commands/MakePostCommandTest.php index f275a9e0..86dee067 100644 --- a/tests/Feature/Commands/MakePostCommandTest.php +++ b/tests/Feature/Commands/MakePostCommandTest.php @@ -14,7 +14,7 @@ */ class MakePostCommandTest extends TestCase { - public function test_command_has_expected_output_and_creates_valid_file() + public function testCommandHasExpectedOutputAndCreatesValidFile() { // Assert that no old file exists which would cause issues $this->assertFileDoesNotExist(Hyde::path('_posts/test-post.md')); @@ -46,7 +46,7 @@ public function test_command_has_expected_output_and_creates_valid_file() Filesystem::unlink('_posts/test-post.md'); } - public function test_that_files_are_not_overwritten_when_force_flag_is_not_set() + public function testThatFilesAreNotOverwrittenWhenForceFlagIsNotSet() { file_put_contents(Hyde::path('_posts/test-post.md'), 'This should not be overwritten'); $this->artisan('make:post') @@ -69,7 +69,7 @@ public function test_that_files_are_not_overwritten_when_force_flag_is_not_set() Filesystem::unlink('_posts/test-post.md'); } - public function test_that_files_are_overwritten_when_force_flag_is_set() + public function testThatFilesAreOverwrittenWhenForceFlagIsSet() { file_put_contents(Hyde::path('_posts/test-post.md'), 'This should be overwritten'); $this->artisan('make:post --force') @@ -94,7 +94,7 @@ public function test_that_files_are_overwritten_when_force_flag_is_set() Filesystem::unlink('_posts/test-post.md'); } - public function test_that_title_can_be_specified_in_command_signature() + public function testThatTitleCanBeSpecifiedInCommandSignature() { $this->artisan('make:post "Test Post"') ->expectsOutputToContain('Selected title: Test Post') @@ -108,7 +108,7 @@ public function test_that_title_can_be_specified_in_command_signature() Filesystem::unlink('_posts/test-post.md'); } - public function test_that_command_can_be_canceled() + public function testThatCommandCanBeCanceled() { $this->artisan('make:post "Test Post"') ->expectsOutputToContain('Selected title: Test Post') diff --git a/tests/Feature/Commands/PackageDiscoverCommandTest.php b/tests/Feature/Commands/PackageDiscoverCommandTest.php index 0ece3ba6..e25bed1a 100644 --- a/tests/Feature/Commands/PackageDiscoverCommandTest.php +++ b/tests/Feature/Commands/PackageDiscoverCommandTest.php @@ -13,7 +13,7 @@ */ class PackageDiscoverCommandTest extends TestCase { - public function test_package_discover_command_registers_manifest_path() + public function testPackageDiscoverCommandRegistersManifestPath() { $this->artisan('package:discover')->assertExitCode(0); diff --git a/tests/Feature/Commands/PublishConfigsCommandTest.php b/tests/Feature/Commands/PublishConfigsCommandTest.php index 4547367c..e2b32d65 100644 --- a/tests/Feature/Commands/PublishConfigsCommandTest.php +++ b/tests/Feature/Commands/PublishConfigsCommandTest.php @@ -30,7 +30,7 @@ public function tearDown(): void parent::tearDown(); } - public function test_command_has_expected_output() + public function testCommandHasExpectedOutput() { $this->artisan('publish:configs') ->expectsChoice('Which configuration files do you want to publish?', 'All configs', $this->expectedOptions()) @@ -38,7 +38,7 @@ public function test_command_has_expected_output() ->assertExitCode(0); } - public function test_config_files_are_published() + public function testConfigFilesArePublished() { $this->assertDirectoryDoesNotExist(Hyde::path('config')); @@ -51,7 +51,7 @@ public function test_config_files_are_published() $this->assertDirectoryExists(Hyde::path('config')); } - public function test_command_overwrites_existing_files() + public function testCommandOverwritesExistingFiles() { File::makeDirectory(Hyde::path('config')); File::put(Hyde::path('config/hyde.php'), 'foo'); diff --git a/tests/Feature/Commands/PublishHomepageCommandTest.php b/tests/Feature/Commands/PublishHomepageCommandTest.php index 6bf15b2b..bd0bdfc0 100644 --- a/tests/Feature/Commands/PublishHomepageCommandTest.php +++ b/tests/Feature/Commands/PublishHomepageCommandTest.php @@ -28,12 +28,12 @@ protected function tearDown(): void parent::tearDown(); } - public function test_there_are_no_default_pages() + public function testThereAreNoDefaultPages() { $this->assertFileDoesNotExist(Hyde::path('_pages/index.blade.php')); } - public function test_command_returns_expected_output() + public function testCommandReturnsExpectedOutput() { $this->artisan('publish:homepage welcome') ->expectsConfirmation('Would you like to rebuild the site?') @@ -42,7 +42,7 @@ public function test_command_returns_expected_output() $this->assertFileExistsThenDeleteIt(); } - public function test_command_returns_expected_output_with_rebuild() + public function testCommandReturnsExpectedOutputWithRebuild() { $this->artisan('publish:homepage welcome') ->expectsConfirmation('Would you like to rebuild the site?', 'yes') @@ -54,7 +54,7 @@ public function test_command_returns_expected_output_with_rebuild() $this->resetSite(); } - public function test_command_prompts_for_output() + public function testCommandPromptsForOutput() { $this->artisan('publish:homepage') ->expectsQuestion( @@ -68,7 +68,7 @@ public function test_command_prompts_for_output() $this->assertFileExistsThenDeleteIt(); } - public function test_command_shows_feedback_output_when_supplying_a_homepage_name() + public function testCommandShowsFeedbackOutputWhenSupplyingAHomepageName() { $this->artisan('publish:homepage welcome') ->expectsOutput('Published page [welcome]') @@ -78,7 +78,7 @@ public function test_command_shows_feedback_output_when_supplying_a_homepage_nam $this->assertFileExistsThenDeleteIt(); } - public function test_command_handles_error_code_404() + public function testCommandHandlesErrorCode404() { $this->artisan('publish:homepage invalid-page') ->assertExitCode(404); @@ -86,7 +86,7 @@ public function test_command_handles_error_code_404() $this->assertFileDoesNotExist(Hyde::path('_pages/index.blade.php')); } - public function test_command_does_not_overwrite_modified_files_without_force_flag() + public function testCommandDoesNotOverwriteModifiedFilesWithoutForceFlag() { file_put_contents(Hyde::path('_pages/index.blade.php'), 'foo'); @@ -98,7 +98,7 @@ public function test_command_does_not_overwrite_modified_files_without_force_fla $this->assertFileExistsThenDeleteIt(); } - public function test_command_overwrites_modified_files_if_force_flag_is_set() + public function testCommandOverwritesModifiedFilesIfForceFlagIsSet() { file_put_contents(Hyde::path('_pages/index.blade.php'), 'foo'); @@ -110,7 +110,7 @@ public function test_command_overwrites_modified_files_if_force_flag_is_set() $this->assertFileExistsThenDeleteIt(); } - public function test_command_does_not_return_409_if_the_current_file_is_a_default_file() + public function testCommandDoesNotReturn409IfTheCurrentFileIsADefaultFile() { copy(Hyde::vendorPath('resources/views/layouts/app.blade.php'), Hyde::path('_pages/index.blade.php')); diff --git a/tests/Feature/Commands/PublishViewsCommandTest.php b/tests/Feature/Commands/PublishViewsCommandTest.php index 7a05866e..15391833 100644 --- a/tests/Feature/Commands/PublishViewsCommandTest.php +++ b/tests/Feature/Commands/PublishViewsCommandTest.php @@ -15,7 +15,7 @@ */ class PublishViewsCommandTest extends TestCase { - public function test_command_publishes_views() + public function testCommandPublishesViews() { $path = str_replace('\\', '/', Hyde::pathToRelative(realpath(Hyde::vendorPath('resources/views/pages/404.blade.php')))); $this->artisan('publish:views') @@ -30,7 +30,7 @@ public function test_command_publishes_views() } } - public function test_can_select_view() + public function testCanSelectView() { $path = str_replace('\\', '/', Hyde::pathToRelative(realpath(Hyde::vendorPath('resources/views/pages/404.blade.php')))); $this->artisan('publish:views page-404') @@ -44,7 +44,7 @@ public function test_can_select_view() } } - public function test_with_invalid_supplied_tag() + public function testWithInvalidSuppliedTag() { $this->artisan('publish:views invalid') ->expectsOutputToContain('No publishable resources for tag [invalid].') diff --git a/tests/Feature/Commands/RebuildPageCommandTest.php b/tests/Feature/Commands/RebuildPageCommandTest.php index bae858b4..5a44f082 100644 --- a/tests/Feature/Commands/RebuildPageCommandTest.php +++ b/tests/Feature/Commands/RebuildPageCommandTest.php @@ -12,7 +12,7 @@ */ class RebuildPageCommandTest extends TestCase { - public function test_handle_is_successful_with_valid_path() + public function testHandleIsSuccessfulWithValidPath() { $this->file('_pages/test-page.md', 'foo'); @@ -23,7 +23,7 @@ public function test_handle_is_successful_with_valid_path() $this->resetSite(); } - public function test_media_files_can_be_transferred() + public function testMediaFilesCanBeTransferred() { $this->directory(Hyde::path('_site/media')); $this->file('_media/test.jpg'); @@ -33,21 +33,21 @@ public function test_media_files_can_be_transferred() $this->assertFileExists(Hyde::path('_site/media/test.jpg')); } - public function test_validate_catches_bad_source_directory() + public function testValidateCatchesBadSourceDirectory() { $this->artisan('rebuild foo/bar') ->expectsOutput('Path [foo/bar] is not in a valid source directory.') ->assertExitCode(400); } - public function test_validate_catches_missing_file() + public function testValidateCatchesMissingFile() { $this->artisan('rebuild _pages/foo.md') ->expectsOutput('File [_pages/foo.md] not found.') ->assertExitCode(404); } - public function test_rebuild_documentation_page() + public function testRebuildDocumentationPage() { $this->file('_docs/foo.md'); @@ -58,7 +58,7 @@ public function test_rebuild_documentation_page() $this->resetSite(); } - public function test_rebuild_blog_post() + public function testRebuildBlogPost() { $this->file('_posts/foo.md'); diff --git a/tests/Feature/Commands/ServeCommandTest.php b/tests/Feature/Commands/ServeCommandTest.php index 7aa1cd8d..aee04191 100644 --- a/tests/Feature/Commands/ServeCommandTest.php +++ b/tests/Feature/Commands/ServeCommandTest.php @@ -25,7 +25,7 @@ protected function setUp(): void Process::fake(); } - public function test_hyde_serve_command() + public function testHydeServeCommand() { $this->artisan('serve --no-ansi') ->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop') @@ -34,7 +34,7 @@ public function test_hyde_serve_command() Process::assertRan("php -S localhost:8080 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_port_option() + public function testHydeServeCommandWithPortOption() { $this->artisan('serve --no-ansi --port=8081') ->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop') @@ -43,7 +43,7 @@ public function test_hyde_serve_command_with_port_option() Process::assertRan("php -S localhost:8081 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_host_option() + public function testHydeServeCommandWithHostOption() { $this->artisan('serve --no-ansi --host=foo') ->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop') @@ -52,7 +52,7 @@ public function test_hyde_serve_command_with_host_option() Process::assertRan("php -S foo:8080 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_port_and_host_option() + public function testHydeServeCommandWithPortAndHostOption() { $this->artisan('serve --no-ansi --port=8081 --host=foo') ->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop') @@ -61,7 +61,7 @@ public function test_hyde_serve_command_with_port_and_host_option() Process::assertRan("php -S foo:8081 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_port_defined_in_config() + public function testHydeServeCommandWithPortDefinedInConfig() { config(['hyde.server.port' => 8081]); @@ -72,7 +72,7 @@ public function test_hyde_serve_command_with_port_defined_in_config() Process::assertRan("php -S localhost:8081 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_port_defined_in_config_and_port_option() + public function testHydeServeCommandWithPortDefinedInConfigAndPortOption() { config(['hyde.server.port' => 8081]); @@ -83,7 +83,7 @@ public function test_hyde_serve_command_with_port_defined_in_config_and_port_opt Process::assertRan("php -S localhost:8082 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_port_missing_in_config_and_port_option() + public function testHydeServeCommandWithPortMissingInConfigAndPortOption() { config(['hyde.server.port' => null]); @@ -94,7 +94,7 @@ public function test_hyde_serve_command_with_port_missing_in_config_and_port_opt Process::assertRan("php -S localhost:8081 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_host_defined_in_config() + public function testHydeServeCommandWithHostDefinedInConfig() { config(['hyde.server.host' => 'foo']); @@ -105,7 +105,7 @@ public function test_hyde_serve_command_with_host_defined_in_config() Process::assertRan("php -S foo:8080 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_host_defined_in_config_and_host_option() + public function testHydeServeCommandWithHostDefinedInConfigAndHostOption() { config(['hyde.server.host' => 'foo']); @@ -116,7 +116,7 @@ public function test_hyde_serve_command_with_host_defined_in_config_and_host_opt Process::assertRan("php -S bar:8080 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_host_missing_in_config_and_host_option() + public function testHydeServeCommandWithHostMissingInConfigAndHostOption() { config(['hyde.server.host' => null]); @@ -127,7 +127,7 @@ public function test_hyde_serve_command_with_host_missing_in_config_and_host_opt Process::assertRan("php -S foo:8080 {$this->binaryPath()}"); } - public function test_hyde_serve_command_with_invalid_config_value() + public function testHydeServeCommandWithInvalidConfigValue() { $this->expectException(TypeError::class); config(['hyde.server.port' => 'foo']); @@ -137,7 +137,7 @@ public function test_hyde_serve_command_with_invalid_config_value() ->assertExitCode(0); } - public function test_hyde_serve_command_passes_through_process_output() + public function testHydeServeCommandPassesThroughProcessOutput() { Process::shouldReceive('forever') ->once() diff --git a/tests/Feature/Commands/ValidateCommandTest.php b/tests/Feature/Commands/ValidateCommandTest.php index ac462594..523f83a3 100644 --- a/tests/Feature/Commands/ValidateCommandTest.php +++ b/tests/Feature/Commands/ValidateCommandTest.php @@ -15,7 +15,7 @@ */ class ValidateCommandTest extends TestCase { - public function test_validate_command_can_run() + public function testValidateCommandCanRun() { // Ensure the environment is clean to prevent false positives config(['torchlight.token' => null]); @@ -28,7 +28,7 @@ public function test_validate_command_can_run() ->assertExitCode(0); } - public function test_validate_command_can_run_with_skips() + public function testValidateCommandCanRunWithSkips() { // Trigger skipping of Torchlight and documentation index check config(['hyde.features' => []]); diff --git a/tests/Feature/Commands/VendorPublishCommandTest.php b/tests/Feature/Commands/VendorPublishCommandTest.php index a772c5fe..dfeab8cc 100644 --- a/tests/Feature/Commands/VendorPublishCommandTest.php +++ b/tests/Feature/Commands/VendorPublishCommandTest.php @@ -33,7 +33,7 @@ protected function tearDown(): void parent::tearDown(); } - public function test_command_prompts_for_provider_or_tag() + public function testCommandPromptsForProviderOrTag() { ServiceProvider::$publishes = [ 'ExampleProvider' => '', @@ -51,7 +51,7 @@ public function test_command_prompts_for_provider_or_tag() ->assertExitCode(0); } - public function test_unhelpful_publishers_are_removed() + public function testUnhelpfulPublishersAreRemoved() { ServiceProvider::$publishes = [ LaravelConsoleSummaryServiceProvider::class => '', @@ -64,7 +64,7 @@ public function test_unhelpful_publishers_are_removed() ])->assertExitCode(0); } - public function test_config_group_is_renamed_to_be_more_helpful() + public function testConfigGroupIsRenamedToBeMoreHelpful() { ServiceProvider::$publishes = []; ServiceProvider::$publishGroups = [ @@ -78,7 +78,7 @@ public function test_config_group_is_renamed_to_be_more_helpful() ])->assertExitCode(0); } - public function test_can_select_default() + public function testCanSelectDefault() { ServiceProvider::$publishes = []; ServiceProvider::$publishGroups = []; @@ -89,7 +89,7 @@ public function test_can_select_default() ])->assertExitCode(0); } - public function test_status_method() + public function testStatusMethod() { $command = new StatusMethodTestClass($this->createMock(Filesystem::class)); diff --git a/tests/Feature/ConfigurableFeaturesTest.php b/tests/Feature/ConfigurableFeaturesTest.php index 6c1cf367..897236a5 100644 --- a/tests/Feature/ConfigurableFeaturesTest.php +++ b/tests/Feature/ConfigurableFeaturesTest.php @@ -13,7 +13,7 @@ */ class ConfigurableFeaturesTest extends TestCase { - public function test_has_feature_returns_false_when_feature_is_not_enabled() + public function testHasFeatureReturnsFalseWhenFeatureIsNotEnabled() { Config::set('hyde.features', []); // Foreach method in Features class that begins with "has" @@ -25,7 +25,7 @@ public function test_has_feature_returns_false_when_feature_is_not_enabled() } } - public function test_has_feature_returns_true_when_feature_is_enabled() + public function testHasFeatureReturnsTrueWhenFeatureIsEnabled() { $features = []; foreach (get_class_methods(Features::class) as $method) { @@ -41,26 +41,26 @@ public function test_has_feature_returns_true_when_feature_is_enabled() } } - public function test_can_generate_sitemap_helper_returns_true_if_hyde_has_base_url() + public function testCanGenerateSitemapHelperReturnsTrueIfHydeHasBaseUrl() { config(['hyde.url' => 'foo']); $this->assertTrue(Features::sitemap()); } - public function test_can_generate_sitemap_helper_returns_false_if_hyde_does_not_have_base_url() + public function testCanGenerateSitemapHelperReturnsFalseIfHydeDoesNotHaveBaseUrl() { config(['hyde.url' => '']); $this->assertFalse(Features::sitemap()); } - public function test_can_generate_sitemap_helper_returns_false_if_sitemaps_are_disabled_in_config() + public function testCanGenerateSitemapHelperReturnsFalseIfSitemapsAreDisabledInConfig() { config(['hyde.url' => 'foo']); config(['hyde.generate_sitemap' => false]); $this->assertFalse(Features::sitemap()); } - public function test_to_array_method_returns_method_array() + public function testToArrayMethodReturnsMethodArray() { $array = (new Features)->toArray(); $this->assertIsArray($array); @@ -72,7 +72,7 @@ public function test_to_array_method_returns_method_array() } } - public function test_to_array_method_contains_all_settings() + public function testToArrayMethodContainsAllSettings() { $array = (new Features)->toArray(); @@ -88,7 +88,7 @@ public function test_to_array_method_contains_all_settings() $this->assertCount(8, $array); } - public function test_features_can_be_mocked() + public function testFeaturesCanBeMocked() { Features::mock('darkmode', true); $this->assertTrue(Features::hasDarkmode()); @@ -97,7 +97,7 @@ public function test_features_can_be_mocked() $this->assertFalse(Features::hasDarkmode()); } - public function test_dynamic_features_can_be_mocked() + public function testDynamicFeaturesCanBeMocked() { Features::mock('rss', true); $this->assertTrue(Features::rss()); @@ -106,7 +106,7 @@ public function test_dynamic_features_can_be_mocked() $this->assertFalse(Features::rss()); } - public function test_multiple_features_can_be_mocked() + public function testMultipleFeaturesCanBeMocked() { Features::mock([ 'rss' => true, diff --git a/tests/Feature/ConfigurableSourceRootsFeatureTest.php b/tests/Feature/ConfigurableSourceRootsFeatureTest.php index 0d2a4e62..1fa0cd67 100644 --- a/tests/Feature/ConfigurableSourceRootsFeatureTest.php +++ b/tests/Feature/ConfigurableSourceRootsFeatureTest.php @@ -26,12 +26,12 @@ */ class ConfigurableSourceRootsFeatureTest extends TestCase { - public function test_default_config_value_is_empty_string() + public function testDefaultConfigValueIsEmptyString() { $this->assertSame('', config('hyde.source_root')); } - public function test_files_in_custom_source_root_can_be_discovered() + public function testFilesInCustomSourceRootCanBeDiscovered() { $this->setupCustomSourceRoot(); @@ -41,7 +41,7 @@ public function test_files_in_custom_source_root_can_be_discovered() File::deleteDirectory(Hyde::path('custom')); } - public function test_files_in_custom_source_root_can_be_compiled() + public function testFilesInCustomSourceRootCanBeCompiled() { $this->setupCustomSourceRoot(); @@ -53,7 +53,7 @@ public function test_files_in_custom_source_root_can_be_compiled() File::deleteDirectory(Hyde::path('_site')); } - public function test_hyde_page_path_method_supports_custom_source_roots() + public function testHydePagePathMethodSupportsCustomSourceRoots() { config(['hyde.source_root' => 'custom']); (new HydeServiceProvider(app()))->register(); diff --git a/tests/Feature/ConvertsArrayToFrontMatterTest.php b/tests/Feature/ConvertsArrayToFrontMatterTest.php index 346b493e..77e6810f 100644 --- a/tests/Feature/ConvertsArrayToFrontMatterTest.php +++ b/tests/Feature/ConvertsArrayToFrontMatterTest.php @@ -12,7 +12,7 @@ */ class ConvertsArrayToFrontMatterTest extends TestCase { - public function test_action_converts_an_array_to_front_matter() + public function testActionConvertsAnArrayToFrontMatter() { $array = [ 'key' => 'value', @@ -39,7 +39,7 @@ public function test_action_converts_an_array_to_front_matter() $this->assertEquals(str_replace("\r", '', $expected), (new ConvertsArrayToFrontMatter)->execute($array)); } - public function test_action_returns_empty_string_if_array_is_empty() + public function testActionReturnsEmptyStringIfArrayIsEmpty() { $this->assertEquals('', (new ConvertsArrayToFrontMatter)->execute([])); } diff --git a/tests/Feature/DarkmodeFeatureTest.php b/tests/Feature/DarkmodeFeatureTest.php index d1f16c24..a1d710d2 100644 --- a/tests/Feature/DarkmodeFeatureTest.php +++ b/tests/Feature/DarkmodeFeatureTest.php @@ -23,7 +23,7 @@ protected function setUp(): void $this->mockPage(); } - public function test_has_darkmode() + public function testHasDarkmode() { Config::set('hyde.features', []); @@ -36,7 +36,7 @@ public function test_has_darkmode() $this->assertTrue(Features::hasDarkmode()); } - public function test_layout_has_toggle_button_and_script_when_enabled() + public function testLayoutHasToggleButtonAndScriptWhenEnabled() { Config::set('hyde.features', [ Features::markdownPages(), @@ -54,7 +54,7 @@ public function test_layout_has_toggle_button_and_script_when_enabled() $this->assertStringContainsString(''; $service = new MarkdownService($markdown); @@ -91,7 +91,7 @@ public function test_raw_html_tags_are_stripped_by_default() $this->assertEquals("

foo

<style>bar</style><script>hat</script>\n", $html); } - public function test_raw_html_tags_are_not_stripped_when_explicitly_enabled() + public function testRawHtmlTagsAreNotStrippedWhenExplicitlyEnabled() { config(['markdown.allow_html' => true]); $markdown = '

foo

'; @@ -100,21 +100,21 @@ public function test_raw_html_tags_are_not_stripped_when_explicitly_enabled() $this->assertEquals("

foo

\n", $html); } - public function test_has_features_array() + public function testHasFeaturesArray() { $service = $this->makeService(); $this->assertIsArray($service->features); } - public function test_the_features_array_is_empty_by_default() + public function testTheFeaturesArrayIsEmptyByDefault() { $service = $this->makeService(); $this->assertEmpty($service->features); } - public function test_features_can_be_added_to_the_array() + public function testFeaturesCanBeAddedToTheArray() { $service = $this->makeService(); @@ -122,7 +122,7 @@ public function test_features_can_be_added_to_the_array() $this->assertContains('test', $service->features); } - public function test_features_can_be_removed_from_the_array() + public function testFeaturesCanBeRemovedFromTheArray() { $service = $this->makeService(); @@ -131,7 +131,7 @@ public function test_features_can_be_removed_from_the_array() $this->assertNotContains('test', $service->features); } - public function test_method_chaining_can_be_used_to_programmatically_add_features_to_the_array() + public function testMethodChainingCanBeUsedToProgrammaticallyAddFeaturesToTheArray() { $service = $this->makeService(); @@ -140,7 +140,7 @@ public function test_method_chaining_can_be_used_to_programmatically_add_feature $this->assertContains('test2', $service->features); } - public function test_method_chaining_can_be_used_to_programmatically_remove_features_from_the_array() + public function testMethodChainingCanBeUsedToProgrammaticallyRemoveFeaturesFromTheArray() { $service = $this->makeService(); @@ -149,7 +149,7 @@ public function test_method_chaining_can_be_used_to_programmatically_remove_feat $this->assertContains('test2', $service->features); } - public function test_method_with_table_of_contents_method_chain_adds_the_table_of_contents_feature() + public function testMethodWithTableOfContentsMethodChainAddsTheTableOfContentsFeature() { $service = $this->makeService(); @@ -157,7 +157,7 @@ public function test_method_with_table_of_contents_method_chain_adds_the_table_o $this->assertContains('table-of-contents', $service->features); } - public function test_method_with_permalinks_method_chain_adds_the_permalinks_feature() + public function testMethodWithPermalinksMethodChainAddsThePermalinksFeature() { $service = $this->makeService(); @@ -165,7 +165,7 @@ public function test_method_with_permalinks_method_chain_adds_the_permalinks_fea $this->assertContains('permalinks', $service->features); } - public function test_has_feature_returns_true_if_the_feature_is_in_the_array() + public function testHasFeatureReturnsTrueIfTheFeatureIsInTheArray() { $service = $this->makeService(); @@ -173,14 +173,14 @@ public function test_has_feature_returns_true_if_the_feature_is_in_the_array() $this->assertTrue($service->hasFeature('test')); } - public function test_has_feature_returns_false_if_the_feature_is_not_in_the_array() + public function testHasFeatureReturnsFalseIfTheFeatureIsNotInTheArray() { $service = $this->makeService(); $this->assertFalse($service->hasFeature('test')); } - public function test_method_can_enable_permalinks_returns_true_if_the_permalinks_feature_is_in_the_array() + public function testMethodCanEnablePermalinksReturnsTrueIfThePermalinksFeatureIsInTheArray() { $service = $this->makeService(); @@ -188,7 +188,7 @@ public function test_method_can_enable_permalinks_returns_true_if_the_permalinks $this->assertTrue($service->canEnablePermalinks()); } - public function test_method_can_enable_permalinks_is_automatically_for_documentation_pages() + public function testMethodCanEnablePermalinksIsAutomaticallyForDocumentationPages() { $service = new MarkdownServiceTestClass(pageClass: DocumentationPage::class); @@ -197,14 +197,14 @@ public function test_method_can_enable_permalinks_is_automatically_for_documenta $this->assertTrue($service->canEnablePermalinks()); } - public function test_method_can_enable_permalinks_returns_false_if_the_permalinks_feature_is_not_in_the_array() + public function testMethodCanEnablePermalinksReturnsFalseIfThePermalinksFeatureIsNotInTheArray() { $service = $this->makeService(); $this->assertFalse($service->canEnablePermalinks()); } - public function test_method_can_enable_torchlight_returns_true_if_the_torchlight_feature_is_in_the_array() + public function testMethodCanEnableTorchlightReturnsTrueIfTheTorchlightFeatureIsInTheArray() { $service = $this->makeService(); @@ -212,14 +212,14 @@ public function test_method_can_enable_torchlight_returns_true_if_the_torchlight $this->assertTrue($service->canEnableTorchlight()); } - public function test_method_can_enable_torchlight_returns_false_if_the_torchlight_feature_is_not_in_the_array() + public function testMethodCanEnableTorchlightReturnsFalseIfTheTorchlightFeatureIsNotInTheArray() { $service = $this->makeService(); $this->assertFalse($service->canEnableTorchlight()); } - public function test_stripIndentation_method_with_unindented_markdown() + public function testStripIndentationMethodWithUnindentedMarkdown() { $service = $this->makeService(); @@ -227,7 +227,7 @@ public function test_stripIndentation_method_with_unindented_markdown() $this->assertSame($markdown, $service->normalizeIndentationLevel($markdown)); } - public function test_stripIndentation_method_with_indented_markdown() + public function testStripIndentationMethodWithIndentedMarkdown() { $service = $this->makeService(); @@ -241,7 +241,7 @@ public function test_stripIndentation_method_with_indented_markdown() $this->assertSame("foo\nbar\nbaz", $service->normalizeIndentationLevel($markdown)); } - public function test_stripIndentation_method_with_tab_indented_markdown() + public function testStripIndentationMethodWithTabIndentedMarkdown() { $service = $this->makeService(); @@ -249,7 +249,7 @@ public function test_stripIndentation_method_with_tab_indented_markdown() $this->assertSame("foo\nbar\nbaz", $service->normalizeIndentationLevel($markdown)); } - public function test_stripIndentation_method_with_carriage_return_line_feed() + public function testStripIndentationMethodWithCarriageReturnLineFeed() { $service = $this->makeService(); @@ -257,7 +257,7 @@ public function test_stripIndentation_method_with_carriage_return_line_feed() $this->assertSame("foo\nbar\nbaz", $service->normalizeIndentationLevel($markdown)); } - public function test_stripIndentation_method_with_code_indentation() + public function testStripIndentationMethodWithCodeIndentation() { $service = $this->makeService(); @@ -265,7 +265,7 @@ public function test_stripIndentation_method_with_code_indentation() $this->assertSame("foo\nbar\n baz", $service->normalizeIndentationLevel($markdown)); } - public function test_stripIndentation_method_with_empty_newlines() + public function testStripIndentationMethodWithEmptyNewlines() { $service = $this->makeService(); @@ -276,7 +276,7 @@ public function test_stripIndentation_method_with_empty_newlines() $this->assertSame("foo\n \nbar\nbaz", $service->normalizeIndentationLevel($markdown)); } - public function test_stripIndentation_method_with_trailing_newline() + public function testStripIndentationMethodWithTrailingNewline() { $service = $this->makeService(); diff --git a/tests/Feature/MetadataHelperTest.php b/tests/Feature/MetadataHelperTest.php index 462bfad3..c7ac9c70 100644 --- a/tests/Feature/MetadataHelperTest.php +++ b/tests/Feature/MetadataHelperTest.php @@ -21,7 +21,7 @@ protected function setUp(): void config(['hyde.url' => null]); } - public function test_name_method_returns_a_valid_html_meta_string() + public function testNameMethodReturnsAValidHtmlMetaString() { $this->assertEquals( '', @@ -29,7 +29,7 @@ public function test_name_method_returns_a_valid_html_meta_string() ); } - public function test_property_method_returns_a_valid_html_meta_string() + public function testPropertyMethodReturnsAValidHtmlMetaString() { $this->assertEquals( '', @@ -37,7 +37,7 @@ public function test_property_method_returns_a_valid_html_meta_string() ); } - public function test_property_method_accepts_property_with_og_prefix() + public function testPropertyMethodAcceptsPropertyWithOgPrefix() { $this->assertEquals( '', @@ -45,7 +45,7 @@ public function test_property_method_accepts_property_with_og_prefix() ); } - public function test_property_method_accepts_property_without_og_prefix() + public function testPropertyMethodAcceptsPropertyWithoutOgPrefix() { $this->assertEquals( '', @@ -53,7 +53,7 @@ public function test_property_method_accepts_property_without_og_prefix() ); } - public function test_link_method_returns_a_valid_html_link_string() + public function testLinkMethodReturnsAValidHtmlLinkString() { $this->assertEquals( '', @@ -61,7 +61,7 @@ public function test_link_method_returns_a_valid_html_link_string() ); } - public function test_link_method_returns_a_valid_html_link_string_with_attributes() + public function testLinkMethodReturnsAValidHtmlLinkStringWithAttributes() { $this->assertEquals( '', @@ -69,7 +69,7 @@ public function test_link_method_returns_a_valid_html_link_string_with_attribute ); } - public function test_link_method_returns_a_valid_html_link_string_with_multiple_attributes() + public function testLinkMethodReturnsAValidHtmlLinkStringWithMultipleAttributes() { $this->assertEquals( '', @@ -77,12 +77,12 @@ public function test_link_method_returns_a_valid_html_link_string_with_multiple_ ); } - public function test_get_method_returns_global_metadata_bag() + public function testGetMethodReturnsGlobalMetadataBag() { $this->assertEquals(Meta::get(), GlobalMetadataBag::make()); } - public function test_render_method_renders_global_metadata_bag() + public function testRenderMethodRendersGlobalMetadataBag() { $this->assertSame(Meta::render(), GlobalMetadataBag::make()->render()); } diff --git a/tests/Feature/MetadataTest.php b/tests/Feature/MetadataTest.php index 1dc4d557..c7b3c7ce 100644 --- a/tests/Feature/MetadataTest.php +++ b/tests/Feature/MetadataTest.php @@ -51,7 +51,7 @@ protected function assertPageDoesNotHaveMetadata(HydePage $page, string $metadat ); } - public function test_metadata_object_is_generated_automatically() + public function testMetadataObjectIsGeneratedAutomatically() { $page = new MarkdownPage(); @@ -60,7 +60,7 @@ public function test_metadata_object_is_generated_automatically() $this->assertEquals([], $page->metadata->get()); } - public function test_link_item_model() + public function testLinkItemModel() { $item = new LinkElement('rel', 'href'); $this->assertEquals('rel', $item->uniqueKey()); @@ -70,14 +70,14 @@ public function test_link_item_model() $this->assertEquals('', (string) $item); } - public function test_metadata_item_model() + public function testMetadataItemModel() { $item = new MetadataElement('name', 'content'); $this->assertEquals('name', $item->uniqueKey()); $this->assertEquals('', (string) $item); } - public function test_open_graph_item_model() + public function testOpenGraphItemModel() { $item = new OpenGraphElement('property', 'content'); $this->assertEquals('property', $item->uniqueKey()); @@ -87,7 +87,7 @@ public function test_open_graph_item_model() $this->assertEquals('', (string) $item); } - public function test_link_item_can_be_added() + public function testLinkItemCanBeAdded() { $page = new MarkdownPage(); $page->metadata->add(Meta::link('foo', 'bar')); @@ -97,7 +97,7 @@ public function test_link_item_can_be_added() ], $page->metadata->get()); } - public function test_metadata_item_can_be_added() + public function testMetadataItemCanBeAdded() { $page = new MarkdownPage(); $page->metadata->add(Meta::name('foo', 'bar')); @@ -107,7 +107,7 @@ public function test_metadata_item_can_be_added() ], $page->metadata->get()); } - public function test_open_graph_item_can_be_added() + public function testOpenGraphItemCanBeAdded() { $page = new MarkdownPage(); $page->metadata->add(Meta::property('foo', 'bar')); @@ -117,7 +117,7 @@ public function test_open_graph_item_can_be_added() ], $page->metadata->get()); } - public function test_generic_item_can_be_added() + public function testGenericItemCanBeAdded() { $page = new MarkdownPage(); $page->metadata->add('foo'); @@ -127,7 +127,7 @@ public function test_generic_item_can_be_added() ], $page->metadata->get()); } - public function test_multiple_items_can_be_accessed_with_get_method() + public function testMultipleItemsCanBeAccessedWithGetMethod() { $page = new MarkdownPage(); $page->metadata->add(Meta::link('foo', 'bar')); @@ -143,7 +143,7 @@ public function test_multiple_items_can_be_accessed_with_get_method() ], $page->metadata->get()); } - public function test_multiple_items_of_same_key_and_type_only_keeps_latest() + public function testMultipleItemsOfSameKeyAndTypeOnlyKeepsLatest() { $page = new MarkdownPage(); $page->metadata->add(Meta::link('foo', 'bar')); @@ -154,7 +154,7 @@ public function test_multiple_items_of_same_key_and_type_only_keeps_latest() ], $page->metadata->get()); } - public function test_render_returns_html_string_of_imploded_metadata_arrays() + public function testRenderReturnsHtmlStringOfImplodedMetadataArrays() { $page = new MarkdownPage(); $page->metadata->add(Meta::link('foo', 'bar')); @@ -171,7 +171,7 @@ public function test_render_returns_html_string_of_imploded_metadata_arrays() $page->metadata->render()); } - public function test_custom_metadata_overrides_config_defined_metadata() + public function testCustomMetadataOverridesConfigDefinedMetadata() { config(['hyde.meta' => [ Meta::name('foo', 'bar'), @@ -183,7 +183,7 @@ public function test_custom_metadata_overrides_config_defined_metadata() ], $page->metadata->get()); } - public function test_dynamic_metadata_overrides_config_defined_metadata() + public function testDynamicMetadataOverridesConfigDefinedMetadata() { config(['hyde.meta' => [ Meta::name('twitter:title', 'bar'), @@ -196,7 +196,7 @@ public function test_dynamic_metadata_overrides_config_defined_metadata() ], $page->metadata->get()); } - public function test_does_not_add_canonical_link_when_base_url_is_not_set() + public function testDoesNotAddCanonicalLinkWhenBaseUrlIsNotSet() { config(['hyde.url' => null]); $page = MarkdownPage::make('bar'); @@ -204,7 +204,7 @@ public function test_does_not_add_canonical_link_when_base_url_is_not_set() $this->assertStringNotContainsString('metadata->render()); } - public function test_does_not_add_canonical_link_when_identifier_is_not_set() + public function testDoesNotAddCanonicalLinkWhenIdentifierIsNotSet() { config(['hyde.url' => 'foo']); $page = MarkdownPage::make(); @@ -212,7 +212,7 @@ public function test_does_not_add_canonical_link_when_identifier_is_not_set() $this->assertStringNotContainsString('metadata->render()); } - public function test_adds_canonical_link_when_base_url_and_identifier_is_set() + public function testAddsCanonicalLinkWhenBaseUrlAndIdentifierIsSet() { config(['hyde.url' => 'foo']); $page = MarkdownPage::make('bar'); @@ -220,7 +220,7 @@ public function test_adds_canonical_link_when_base_url_and_identifier_is_set() $this->assertStringContainsString('', $page->metadata->render()); } - public function test_canonical_link_uses_clean_url_setting() + public function testCanonicalLinkUsesCleanUrlSetting() { config(['hyde.url' => 'foo']); config(['hyde.pretty_urls' => true]); @@ -229,7 +229,7 @@ public function test_canonical_link_uses_clean_url_setting() $this->assertStringContainsString('', $page->metadata->render()); } - public function test_can_override_canonical_link_with_front_matter() + public function testCanOverrideCanonicalLinkWithFrontMatter() { config(['hyde.url' => 'foo']); $page = MarkdownPage::make('bar', [ @@ -238,7 +238,7 @@ public function test_can_override_canonical_link_with_front_matter() $this->assertStringContainsString('', $page->metadata->render()); } - public function test_adds_twitter_and_open_graph_title_when_title_is_set() + public function testAddsTwitterAndOpenGraphTitleWhenTitleIsSet() { $page = MarkdownPage::make(matter: ['title' => 'Foo Bar']); @@ -249,7 +249,7 @@ public function test_adds_twitter_and_open_graph_title_when_title_is_set() ); } - public function test_does_not_add_twitter_and_open_graph_title_when_no_title_is_set() + public function testDoesNotAddTwitterAndOpenGraphTitleWhenNoTitleIsSet() { $page = MarkdownPage::make(matter: ['title' => null]); @@ -258,109 +258,109 @@ public function test_does_not_add_twitter_and_open_graph_title_when_no_title_is_ ); } - public function test_adds_description_when_description_is_set_in_post() + public function testAddsDescriptionWhenDescriptionIsSetInPost() { $page = MarkdownPost::make(matter: ['description' => 'My Description']); $this->assertPageHasMetadata($page, ''); } - public function test_does_not_add_description_when_description_is_not_set_in_post() + public function testDoesNotAddDescriptionWhenDescriptionIsNotSetInPost() { $page = new MarkdownPost(); $this->assertPageDoesNotHaveMetadata($page, ''); } - public function test_adds_author_when_author_is_set_in_post() + public function testAddsAuthorWhenAuthorIsSetInPost() { $page = MarkdownPost::make(matter: ['author' => 'My Author']); $this->assertPageHasMetadata($page, ''); } - public function test_does_not_add_author_when_author_is_not_set_in_post() + public function testDoesNotAddAuthorWhenAuthorIsNotSetInPost() { $page = new MarkdownPost(); $this->assertPageDoesNotHaveMetadata($page, ''); } - public function test_adds_keywords_when_category_is_set_in_post() + public function testAddsKeywordsWhenCategoryIsSetInPost() { $page = MarkdownPost::make(matter: ['category' => 'My Category']); $this->assertPageHasMetadata($page, ''); } - public function test_does_not_add_keywords_when_category_is_not_set_in_post() + public function testDoesNotAddKeywordsWhenCategoryIsNotSetInPost() { $page = new MarkdownPost(); $this->assertPageDoesNotHaveMetadata($page, ''); } - public function test_adds_url_property_when_canonical_url_is_set_in_post() + public function testAddsUrlPropertyWhenCanonicalUrlIsSetInPost() { $page = MarkdownPost::make(matter: ['canonicalUrl' => 'example.html']); $this->assertPageHasMetadata($page, ''); } - public function test_does_not_add_url_property_when_canonical_url_is_not_set_in_post() + public function testDoesNotAddUrlPropertyWhenCanonicalUrlIsNotSetInPost() { $page = new MarkdownPost(); $this->assertPageDoesNotHaveMetadata($page, ''); } - public function test_does_not_add_url_property_when_canonical_url_is_null() + public function testDoesNotAddUrlPropertyWhenCanonicalUrlIsNull() { $page = MarkdownPost::make(matter: ['canonicalUrl' => null]); $this->assertPageDoesNotHaveMetadata($page, ''); } - public function test_adds_title_property_when_title_is_set_in_post() + public function testAddsTitlePropertyWhenTitleIsSetInPost() { $page = MarkdownPost::make(matter: ['title' => 'My Title']); $this->assertPageHasMetadata($page, ''); } - public function test_does_not_add_title_property_when_title_is_not_set_in_post() + public function testDoesNotAddTitlePropertyWhenTitleIsNotSetInPost() { $page = new MarkdownPost(); $this->assertPageDoesNotHaveMetadata($page, ' '2022-01-01']); $this->assertPageHasMetadata($page, ''); } - public function test_does_not_add_published_time_property_when_date_is_not_set_in_post() + public function testDoesNotAddPublishedTimePropertyWhenDateIsNotSetInPost() { $page = new MarkdownPost(); $this->assertPageDoesNotHaveMetadata($page, ''); } - public function test_adds_image_property_when_image_is_set_in_post() + public function testAddsImagePropertyWhenImageIsSetInPost() { $page = MarkdownPost::make(matter: ['image' => 'image.jpg']); $this->assertPageHasMetadata($page, ''); } - public function test_does_not_add_image_property_when_image_is_not_set_in_post() + public function testDoesNotAddImagePropertyWhenImageIsNotSetInPost() { $page = new MarkdownPost(); $this->assertPageDoesNotHaveMetadata($page, ''); } - public function test_adds_type_property_automatically() + public function testAddsTypePropertyAutomatically() { $page = MarkdownPost::make(); $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_returns_base_array_when_initialized_with_empty_front_matter() + public function testDynamicPostMetaPropertiesReturnsBaseArrayWhenInitializedWithEmptyFrontMatter() { $page = MarkdownPost::make(); $this->assertEquals('', $page->metadata->render()); } - public function test_dynamic_post_meta_properties_contains_image_metadata_when_featured_image_set_to_string() + public function testDynamicPostMetaPropertiesContainsImageMetadataWhenFeaturedImageSetToString() { $page = MarkdownPost::make(matter: [ 'image' => 'foo.jpg', @@ -369,7 +369,7 @@ public function test_dynamic_post_meta_properties_contains_image_metadata_when_f $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_contains_image_link_that_is_always_relative() + public function testDynamicPostMetaPropertiesContainsImageLinkThatIsAlwaysRelative() { $page = MarkdownPost::make(matter: [ 'image' => 'foo.jpg', @@ -378,7 +378,7 @@ public function test_dynamic_post_meta_properties_contains_image_link_that_is_al $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_contains_image_link_that_is_always_relative_for_nested_posts() + public function testDynamicPostMetaPropertiesContainsImageLinkThatIsAlwaysRelativeForNestedPosts() { $page = MarkdownPost::make('foo/bar', matter: [ 'image' => 'foo.jpg', @@ -387,7 +387,7 @@ public function test_dynamic_post_meta_properties_contains_image_link_that_is_al $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_contains_image_link_that_is_always_relative_for_nested_output_directories() + public function testDynamicPostMetaPropertiesContainsImageLinkThatIsAlwaysRelativeForNestedOutputDirectories() { MarkdownPost::setOutputDirectory('_posts/foo'); $page = MarkdownPost::make(matter: [ @@ -397,7 +397,7 @@ public function test_dynamic_post_meta_properties_contains_image_link_that_is_al $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_contains_image_link_that_is_always_relative_for_nested_posts_and_nested_output_directories() + public function testDynamicPostMetaPropertiesContainsImageLinkThatIsAlwaysRelativeForNestedPostsAndNestedOutputDirectories() { MarkdownPost::setOutputDirectory('_posts/foo'); $page = MarkdownPost::make('bar/baz', matter: [ @@ -407,7 +407,7 @@ public function test_dynamic_post_meta_properties_contains_image_link_that_is_al $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_contains_image_link_that_uses_the_configured_media_directory() + public function testDynamicPostMetaPropertiesContainsImageLinkThatUsesTheConfiguredMediaDirectory() { Hyde::setMediaDirectory('assets'); $page = MarkdownPost::make(matter: [ @@ -417,7 +417,7 @@ public function test_dynamic_post_meta_properties_contains_image_link_that_uses_ $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_contains_image_metadata_when_featured_image_set_to_array_with_path() + public function testDynamicPostMetaPropertiesContainsImageMetadataWhenFeaturedImageSetToArrayWithPath() { $page = MarkdownPost::make(matter: [ 'image' => [ @@ -428,7 +428,7 @@ public function test_dynamic_post_meta_properties_contains_image_metadata_when_f $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_meta_properties_contains_image_metadata_when_featured_image_set_to_array_with_url() + public function testDynamicPostMetaPropertiesContainsImageMetadataWhenFeaturedImageSetToArrayWithUrl() { $page = MarkdownPost::make(matter: [ 'image' => [ @@ -439,7 +439,7 @@ public function test_dynamic_post_meta_properties_contains_image_metadata_when_f $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_author_returns_author_name_when_author_set_to_array_using_username() + public function testDynamicPostAuthorReturnsAuthorNameWhenAuthorSetToArrayUsingUsername() { $page = MarkdownPost::make(matter: [ 'author' => [ @@ -449,7 +449,7 @@ public function test_dynamic_post_author_returns_author_name_when_author_set_to_ $this->assertPageHasMetadata($page, ''); } - public function test_dynamic_post_author_returns_author_name_when_author_set_to_array_using_name() + public function testDynamicPostAuthorReturnsAuthorNameWhenAuthorSetToArrayUsingName() { $page = MarkdownPost::make(matter: [ 'author' => [ @@ -460,7 +460,7 @@ public function test_dynamic_post_author_returns_author_name_when_author_set_to_ $this->assertPageHasMetadata($page, ''); } - public function test_no_author_is_set_when_author_set_to_array_without_name_or_username() + public function testNoAuthorIsSetWhenAuthorSetToArrayWithoutNameOrUsername() { $page = MarkdownPost::make(matter: [ 'author' => [], diff --git a/tests/Feature/MetadataViewTest.php b/tests/Feature/MetadataViewTest.php index cd636625..40d79186 100644 --- a/tests/Feature/MetadataViewTest.php +++ b/tests/Feature/MetadataViewTest.php @@ -85,7 +85,7 @@ protected function getDefaultTags(): array ]; } - public function test_metadata_tags_in_empty_blade_page() + public function testMetadataTagsInEmptyBladePage() { $this->file('_pages/test.blade.php', '@extends(\'hyde::layouts.app\')'); $this->build('_pages/test.blade.php'); @@ -101,7 +101,7 @@ public function test_metadata_tags_in_empty_blade_page() $this->assertAllTagsWereCovered('test', $assertions); } - public function test_metadata_tags_in_empty_markdown_page() + public function testMetadataTagsInEmptyMarkdownPage() { $this->markdown('_pages/test.md'); $this->build('_pages/test.md'); @@ -117,7 +117,7 @@ public function test_metadata_tags_in_empty_markdown_page() $this->assertAllTagsWereCovered('test', $assertions); } - public function test_metadata_tags_in_empty_documentation_page() + public function testMetadataTagsInEmptyDocumentationPage() { $this->markdown('_docs/test.md'); $this->build('_docs/test.md'); @@ -133,7 +133,7 @@ public function test_metadata_tags_in_empty_documentation_page() $this->assertAllTagsWereCovered('docs/test', $assertions); } - public function test_metadata_tags_in_empty_markdown_post() + public function testMetadataTagsInEmptyMarkdownPost() { $this->markdown('_posts/test.md'); $this->build('_posts/test.md'); @@ -155,7 +155,7 @@ public function test_metadata_tags_in_empty_markdown_post() $this->assertAllTagsWereCovered('posts/test', $assertions); } - public function test_metadata_tags_in_markdown_post_with_flat_front_matter() + public function testMetadataTagsInMarkdownPostWithFlatFrontMatter() { // Run the test above, but with all front matter properties (without array notation) $this->file('_posts/test.md', <<<'MARKDOWN' diff --git a/tests/Feature/NavigationDataTest.php b/tests/Feature/NavigationDataTest.php index d2c3ccc7..510040db 100644 --- a/tests/Feature/NavigationDataTest.php +++ b/tests/Feature/NavigationDataTest.php @@ -29,7 +29,7 @@ public function testClassMatchesSchema() ); } - public function test__construct() + public function testConstruct() { $navigationData = new NavigationData('label', 1, true, 'group'); diff --git a/tests/Feature/NavigationMenuTest.php b/tests/Feature/NavigationMenuTest.php index bd2fcebf..a6c2a185 100644 --- a/tests/Feature/NavigationMenuTest.php +++ b/tests/Feature/NavigationMenuTest.php @@ -26,22 +26,22 @@ */ class NavigationMenuTest extends TestCase { - public function test_constructor() + public function testConstructor() { $this->assertInstanceOf(NavigationMenu::class, NavigationMenu::create()); } - public function test_generate_method_creates_collection_of_nav_items() + public function testGenerateMethodCreatesCollectionOfNavItems() { $this->assertInstanceOf(Collection::class, NavigationMenu::create()->items); } - public function test_get_items_returns_items() + public function testGetItemsReturnsItems() { $this->assertEquals(NavigationMenu::create()->items, NavigationMenu::create()->getItems()); } - public function test_items_are_sorted_by_priority() + public function testItemsAreSortedByPriority() { Routes::addRoute(new Route(new MarkdownPage('foo', ['navigation.priority' => 1]))); Routes::addRoute(new Route(new MarkdownPage('bar', ['navigation.priority' => 2]))); @@ -50,7 +50,7 @@ public function test_items_are_sorted_by_priority() $this->assertSame(['Home', 'Foo', 'Bar', 'Baz'], NavigationMenu::create()->items->pluck('label')->toArray()); } - public function test_items_with_hidden_property_set_to_true_are_not_added() + public function testItemsWithHiddenPropertySetToTrueAreNotAdded() { Routes::addRoute(new Route(new MarkdownPage('foo', ['navigation.hidden' => true]))); Routes::addRoute(new Route(new MarkdownPage('bar', ['navigation.hidden' => false]))); @@ -58,7 +58,7 @@ public function test_items_with_hidden_property_set_to_true_are_not_added() $this->assertSame(['Home', 'Bar'], NavigationMenu::create()->items->pluck('label')->toArray()); } - public function test_created_collection_is_sorted_by_navigation_menu_priority() + public function testCreatedCollectionIsSortedByNavigationMenuPriority() { $this->file('_pages/foo.md'); $this->file('_docs/index.md'); @@ -75,7 +75,7 @@ public function test_created_collection_is_sorted_by_navigation_menu_priority() $this->assertEquals($expected, $menu->items); } - public function test_is_sorted_automatically_when_using_navigation_menu_create() + public function testIsSortedAutomaticallyWhenUsingNavigationMenuCreate() { $this->file('_pages/foo.md'); @@ -90,12 +90,12 @@ public function test_is_sorted_automatically_when_using_navigation_menu_create() $this->assertEquals($expected, $menu->items); } - public function test_collection_only_contains_nav_items() + public function testCollectionOnlyContainsNavItems() { $this->assertContainsOnlyInstancesOf(NavItem::class, NavigationMenu::create()->items); } - public function test_external_link_can_be_added_in_config() + public function testExternalLinkCanBeAddedInConfig() { config(['hyde.navigation.custom' => [NavItem::forLink('https://example.com', 'foo')]]); @@ -110,7 +110,7 @@ public function test_external_link_can_be_added_in_config() $this->assertEquals($expected, $menu->items); } - public function test_path_link_can_be_added_in_config() + public function testPathLinkCanBeAddedInConfig() { config(['hyde.navigation.custom' => [NavItem::forLink('foo', 'foo')]]); @@ -125,7 +125,7 @@ public function test_path_link_can_be_added_in_config() $this->assertEquals($expected, $menu->items); } - public function test_duplicates_are_removed_when_adding_in_config() + public function testDuplicatesAreRemovedWhenAddingInConfig() { config(['hyde.navigation.custom' => [ NavItem::forLink('foo', 'foo'), @@ -143,7 +143,7 @@ public function test_duplicates_are_removed_when_adding_in_config() $this->assertEquals($expected, $menu->items); } - public function test_duplicates_are_removed_when_adding_in_config_regardless_of_destination() + public function testDuplicatesAreRemovedWhenAddingInConfigRegardlessOfDestination() { config(['hyde.navigation.custom' => [ NavItem::forLink('foo', 'foo'), @@ -161,7 +161,7 @@ public function test_duplicates_are_removed_when_adding_in_config_regardless_of_ $this->assertEquals($expected, $menu->items); } - public function test_config_items_take_precedence_over_generated_items() + public function testConfigItemsTakePrecedenceOverGeneratedItems() { $this->file('_pages/foo.md'); @@ -178,7 +178,7 @@ public function test_config_items_take_precedence_over_generated_items() $this->assertEquals($expected, $menu->items); } - public function test_documentation_pages_that_are_not_index_are_not_added_to_the_menu() + public function testDocumentationPagesThatAreNotIndexAreNotAddedToTheMenu() { $this->file('_docs/foo.md'); $this->file('_docs/index.md'); @@ -194,7 +194,7 @@ public function test_documentation_pages_that_are_not_index_are_not_added_to_the $this->assertEquals($expected, $menu->items); } - public function test_pages_in_subdirectories_are_not_added_to_the_navigation_menu() + public function testPagesInSubdirectoriesAreNotAddedToTheNavigationMenu() { $this->directory('_pages/foo'); $this->file('_pages/foo/bar.md'); @@ -206,7 +206,7 @@ public function test_pages_in_subdirectories_are_not_added_to_the_navigation_men $this->assertEquals($expected, $menu->items); } - public function test_pages_in_subdirectories_can_be_added_to_the_navigation_menu_with_config_flat_setting() + public function testPagesInSubdirectoriesCanBeAddedToTheNavigationMenuWithConfigFlatSetting() { config(['hyde.navigation.subdirectories' => 'flat']); $this->directory('_pages/foo'); @@ -222,7 +222,7 @@ public function test_pages_in_subdirectories_can_be_added_to_the_navigation_menu $this->assertEquals($expected, $menu->items); } - public function test_pages_in_subdirectories_are_not_added_to_the_navigation_menu_with_config_dropdown_setting() + public function testPagesInSubdirectoriesAreNotAddedToTheNavigationMenuWithConfigDropdownSetting() { config(['hyde.navigation.subdirectories' => 'dropdown']); $this->directory('_pages/foo'); @@ -240,14 +240,14 @@ public function test_pages_in_subdirectories_are_not_added_to_the_navigation_men $this->assertEquals($expected, $menu->items); } - public function test_has_dropdowns_returns_false_when_there_are_no_dropdowns() + public function testHasDropdownsReturnsFalseWhenThereAreNoDropdowns() { config(['hyde.navigation.subdirectories' => 'dropdown']); $menu = NavigationMenu::create(); $this->assertFalse($menu->hasDropdowns()); } - public function test_has_dropdowns_returns_true_when_there_are_dropdowns() + public function testHasDropdownsReturnsTrueWhenThereAreDropdowns() { config(['hyde.navigation.subdirectories' => 'dropdown']); Routes::addRoute((new MarkdownPage('foo/bar'))->getRoute()); @@ -255,13 +255,13 @@ public function test_has_dropdowns_returns_true_when_there_are_dropdowns() $this->assertTrue($menu->hasDropdowns()); } - public function test_has_dropdowns_always_returns_false_when_dropdowns_are_disabled() + public function testHasDropdownsAlwaysReturnsFalseWhenDropdownsAreDisabled() { Routes::addRoute((new MarkdownPage('foo/bar'))->getRoute()); $this->assertFalse(NavigationMenu::create()->hasDropdowns()); } - public function test_get_dropdowns_returns_empty_array_there_are_no_dropdowns() + public function testGetDropdownsReturnsEmptyArrayThereAreNoDropdowns() { config(['hyde.navigation.subdirectories' => 'dropdown']); $menu = NavigationMenu::create(); @@ -269,7 +269,7 @@ public function test_get_dropdowns_returns_empty_array_there_are_no_dropdowns() $this->assertSame([], $menu->getDropdowns()); } - public function test_get_dropdowns_returns_correct_array_when_there_are_dropdowns() + public function testGetDropdownsReturnsCorrectArrayWhenThereAreDropdowns() { config(['hyde.navigation.subdirectories' => 'dropdown']); Routes::addRoute((new MarkdownPage('foo/bar'))->getRoute()); @@ -282,7 +282,7 @@ public function test_get_dropdowns_returns_correct_array_when_there_are_dropdown ]), ], $menu->getDropdowns()); } - public function test_get_dropdowns_with_multiple_items() + public function testGetDropdownsWithMultipleItems() { config(['hyde.navigation.subdirectories' => 'dropdown']); @@ -300,7 +300,7 @@ public function test_get_dropdowns_with_multiple_items() ], $menu->getDropdowns()); } - public function test_get_dropdowns_with_multiple_dropdowns() + public function testGetDropdownsWithMultipleDropdowns() { config(['hyde.navigation.subdirectories' => 'dropdown']); @@ -323,7 +323,7 @@ public function test_get_dropdowns_with_multiple_dropdowns() ], $menu->getDropdowns()); } - public function test_get_dropdowns_throws_exception_when_disabled() + public function testGetDropdownsThrowsExceptionWhenDisabled() { $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('Dropdowns are not enabled. Enable it by setting `hyde.navigation.subdirectories` to `dropdown`.'); @@ -332,7 +332,7 @@ public function test_get_dropdowns_throws_exception_when_disabled() $menu->getDropdowns(); } - public function test_documentation_pages_do_not_get_added_to_dropdowns() + public function testDocumentationPagesDoNotGetAddedToDropdowns() { config(['hyde.navigation.subdirectories' => 'dropdown']); @@ -344,7 +344,7 @@ public function test_documentation_pages_do_not_get_added_to_dropdowns() $this->assertCount(0, $menu->getDropdowns()); } - public function test_blog_posts_do_not_get_added_to_dropdowns() + public function testBlogPostsDoNotGetAddedToDropdowns() { config(['hyde.navigation.subdirectories' => 'dropdown']); @@ -356,7 +356,7 @@ public function test_blog_posts_do_not_get_added_to_dropdowns() $this->assertCount(0, $menu->getDropdowns()); } - public function test_pages_in_dropdowns_do_not_get_added_to_the_main_navigation() + public function testPagesInDropdownsDoNotGetAddedToTheMainNavigation() { config(['hyde.navigation.subdirectories' => 'dropdown']); @@ -374,7 +374,7 @@ public function test_pages_in_dropdowns_do_not_get_added_to_the_main_navigation( ], $menu->items->all()); } - public function test_dropdown_menu_items_are_sorted_by_priority() + public function testDropdownMenuItemsAreSortedByPriority() { config(['hyde.navigation.subdirectories' => 'dropdown']); diff --git a/tests/Feature/PageCollectionTest.php b/tests/Feature/PageCollectionTest.php index 19a961b7..bf5d3c54 100644 --- a/tests/Feature/PageCollectionTest.php +++ b/tests/Feature/PageCollectionTest.php @@ -24,7 +24,7 @@ */ class PageCollectionTest extends TestCase { - public function test_boot_method_creates_new_page_collection_and_discovers_pages_automatically() + public function testBootMethodCreatesNewPageCollectionAndDiscoversPagesAutomatically() { $collection = PageCollection::init(Hyde::getInstance())->boot(); $this->assertInstanceOf(PageCollection::class, $collection); @@ -36,7 +36,7 @@ public function test_boot_method_creates_new_page_collection_and_discovers_pages ], $collection->all()); } - public function test_blade_pages_are_discovered() + public function testBladePagesAreDiscovered() { $this->file('_pages/foo.blade.php'); $collection = PageCollection::init(Hyde::getInstance())->boot(); @@ -45,7 +45,7 @@ public function test_blade_pages_are_discovered() $this->assertEquals(new BladePage('foo'), $collection->get('_pages/foo.blade.php')); } - public function test_markdown_pages_are_discovered() + public function testMarkdownPagesAreDiscovered() { $this->file('_pages/foo.md'); $collection = PageCollection::init(Hyde::getInstance())->boot(); @@ -54,7 +54,7 @@ public function test_markdown_pages_are_discovered() $this->assertEquals(new MarkdownPage('foo'), $collection->get('_pages/foo.md')); } - public function test_markdown_posts_are_discovered() + public function testMarkdownPostsAreDiscovered() { $this->file('_posts/foo.md'); $collection = PageCollection::init(Hyde::getInstance())->boot(); @@ -63,7 +63,7 @@ public function test_markdown_posts_are_discovered() $this->assertEquals(new MarkdownPost('foo'), $collection->get('_posts/foo.md')); } - public function test_documentation_pages_are_discovered() + public function testDocumentationPagesAreDiscovered() { $this->file('_docs/foo.md'); $collection = PageCollection::init(Hyde::getInstance())->boot(); @@ -71,13 +71,13 @@ public function test_documentation_pages_are_discovered() $this->assertEquals(new DocumentationPage('foo'), $collection->get('_docs/foo.md')); } - public function test_get_page_returns_parsed_page_object_for_given_source_path() + public function testGetPageReturnsParsedPageObjectForGivenSourcePath() { $this->file('_pages/foo.blade.php'); $this->assertEquals(new BladePage('foo'), Pages::getPage('_pages/foo.blade.php')); } - public function test_get_pages_returns_collection_of_pages_of_given_class() + public function testGetPagesReturnsCollectionOfPagesOfGivenClass() { $this->withoutDefaultPages(); @@ -105,7 +105,7 @@ public function test_get_pages_returns_collection_of_pages_of_given_class() $this->restoreDefaultPages(); } - public function test_get_pages_returns_all_pages_when_not_supplied_with_class_string() + public function testGetPagesReturnsAllPagesWhenNotSuppliedWithClassString() { $this->withoutDefaultPages(); @@ -127,14 +127,14 @@ public function test_get_pages_returns_all_pages_when_not_supplied_with_class_st $this->restoreDefaultPages(); } - public function test_get_pages_returns_empty_collection_when_no_pages_are_discovered() + public function testGetPagesReturnsEmptyCollectionWhenNoPagesAreDiscovered() { $this->withoutDefaultPages(); $this->assertEmpty(Pages::getPages()); $this->restoreDefaultPages(); } - public function test_pages_are_not_discovered_for_disabled_features() + public function testPagesAreNotDiscoveredForDisabledFeatures() { config(['hyde.features' => []]); @@ -153,7 +153,7 @@ public function test_pages_are_not_discovered_for_disabled_features() unlink('_docs/doc.md'); } - public function test_pages_with_custom_source_directories_are_discovered_properly() + public function testPagesWithCustomSourceDirectoriesAreDiscoveredProperly() { BladePage::setSourceDirectory('.source/pages'); MarkdownPage::setSourceDirectory('.source/pages'); @@ -179,7 +179,7 @@ public function test_pages_with_custom_source_directories_are_discovered_properl $this->assertEquals(new DocumentationPage('foo'), $collection->get('.source/docs/foo.md')); } - public function test_get_file_throws_exception_when_file_is_not_found() + public function testGetFileThrowsExceptionWhenFileIsNotFound() { $this->expectException(FileNotFoundException::class); $this->expectExceptionMessage('File [_pages/foo.blade.php] not found'); diff --git a/tests/Feature/PageModelConstructorsTest.php b/tests/Feature/PageModelConstructorsTest.php index a49f6cac..c98d2988 100644 --- a/tests/Feature/PageModelConstructorsTest.php +++ b/tests/Feature/PageModelConstructorsTest.php @@ -21,14 +21,14 @@ */ class PageModelConstructorsTest extends TestCase { - public function test_dynamic_data_constructor_can_find_title_from_front_matter() + public function testDynamicDataConstructorCanFindTitleFromFrontMatter() { $this->markdown('_pages/foo.md', '# Foo Bar', ['title' => 'My Title']); $page = MarkdownPage::parse('foo'); $this->assertEquals('My Title', $page->title); } - public function test_dynamic_data_constructor_can_find_title_from_h1_tag() + public function testDynamicDataConstructorCanFindTitleFromH1Tag() { $this->markdown('_pages/foo.md', '# Foo Bar'); $page = MarkdownPage::parse('foo'); @@ -36,7 +36,7 @@ public function test_dynamic_data_constructor_can_find_title_from_h1_tag() $this->assertEquals('Foo Bar', $page->title); } - public function test_dynamic_data_constructor_can_find_title_from_slug() + public function testDynamicDataConstructorCanFindTitleFromSlug() { $this->markdown('_pages/foo-bar.md'); $page = MarkdownPage::parse('foo-bar'); @@ -44,7 +44,7 @@ public function test_dynamic_data_constructor_can_find_title_from_slug() $this->assertEquals('Foo Bar', $page->title); } - public function test_documentation_page_parser_can_get_group_from_front_matter() + public function testDocumentationPageParserCanGetGroupFromFrontMatter() { $this->markdown('_docs/foo.md', '# Foo Bar', ['navigation.group' => 'foo']); @@ -52,7 +52,7 @@ public function test_documentation_page_parser_can_get_group_from_front_matter() $this->assertEquals('foo', $page->navigationMenuGroup()); } - public function test_documentation_page_parser_can_get_group_automatically_from_nested_page() + public function testDocumentationPageParserCanGetGroupAutomaticallyFromNestedPage() { mkdir(Hyde::path('_docs/foo')); touch(Hyde::path('_docs/foo/bar.md')); diff --git a/tests/Feature/PaginatorTest.php b/tests/Feature/PaginatorTest.php index ddb04fee..cf4c1007 100644 --- a/tests/Feature/PaginatorTest.php +++ b/tests/Feature/PaginatorTest.php @@ -15,7 +15,7 @@ */ class PaginatorTest extends TestCase { - public function test_it_can_be_instantiated(): void + public function testItCanBeInstantiated(): void { $this->assertInstanceOf(Paginator::class, new Paginator()); } diff --git a/tests/Feature/PharSupportTest.php b/tests/Feature/PharSupportTest.php index f6e46f32..8047239f 100644 --- a/tests/Feature/PharSupportTest.php +++ b/tests/Feature/PharSupportTest.php @@ -48,7 +48,7 @@ public function testMockHasVendorDirectory() $this->assertFalse(PharSupport::hasVendorDirectory()); } - public function test_vendor_path_can_run_in_phar() + public function testVendorPathCanRunInPhar() { PharSupport::mock('running', true); PharSupport::mock('hasVendorDirectory', false); @@ -56,7 +56,7 @@ public function test_vendor_path_can_run_in_phar() $this->assertEquals($this->replaceSlashes(Hyde::path("{$this->getBaseVendorPath()}/framework")), Hyde::vendorPath()); } - public function test_vendor_path_can_run_in_phar_with_path_argument() + public function testVendorPathCanRunInPharWithPathArgument() { PharSupport::mock('running', true); PharSupport::mock('hasVendorDirectory', false); diff --git a/tests/Feature/ReadingTimeTest.php b/tests/Feature/ReadingTimeTest.php index 58a9075a..93dbe654 100644 --- a/tests/Feature/ReadingTimeTest.php +++ b/tests/Feature/ReadingTimeTest.php @@ -20,17 +20,17 @@ public static function setUpBeforeClass(): void self::setupKernel(); } - public function test___construct() + public function testConstruct() { $this->assertInstanceOf(ReadingTime::class, new ReadingTime('Hello world')); } - public function test__toString() + public function testToString() { $this->assertSame('1min, 0sec', (string) new ReadingTime('Hello world')); } - public function test_getWordCount() + public function testGetWordCount() { $this->assertSame(0, (new ReadingTime($this->words(0)))->getWordCount()); $this->assertSame(120, (new ReadingTime($this->words(120)))->getWordCount()); @@ -38,7 +38,7 @@ public function test_getWordCount() $this->assertSame(360, (new ReadingTime($this->words(360)))->getWordCount()); } - public function test_getMinutes() + public function testGetMinutes() { $this->assertSame(0, (new ReadingTime($this->words(0)))->getMinutes()); $this->assertSame(0, (new ReadingTime($this->words(120)))->getMinutes()); @@ -46,7 +46,7 @@ public function test_getMinutes() $this->assertSame(1, (new ReadingTime($this->words(360)))->getMinutes()); } - public function test_getSeconds() + public function testGetSeconds() { $this->assertSame(0, (new ReadingTime($this->words(0)))->getSeconds()); $this->assertSame(30, (new ReadingTime($this->words(120)))->getSeconds()); @@ -54,7 +54,7 @@ public function test_getSeconds() $this->assertSame(90, (new ReadingTime($this->words(360)))->getSeconds()); } - public function test_getSecondsOver() + public function testGetSecondsOver() { $this->assertSame(0, (new ReadingTime($this->words(0)))->getSecondsOver()); $this->assertSame(30, (new ReadingTime($this->words(120)))->getSecondsOver()); @@ -62,7 +62,7 @@ public function test_getSecondsOver() $this->assertSame(30, (new ReadingTime($this->words(360)))->getSecondsOver()); } - public function test_getFormatted() + public function testGetFormatted() { $this->assertSame('1min, 0sec', (new ReadingTime($this->words(0)))->getFormatted()); $this->assertSame('1min, 0sec', (new ReadingTime($this->words(120)))->getFormatted()); @@ -70,7 +70,7 @@ public function test_getFormatted() $this->assertSame('1min, 30sec', (new ReadingTime($this->words(360)))->getFormatted()); } - public function test_getFormattedWithCustomFormatting() + public function testGetFormattedWithCustomFormatting() { $this->assertSame('1:00', (new ReadingTime($this->words(0)))->getFormatted('%d:%02d')); $this->assertSame('1:00', (new ReadingTime($this->words(120)))->getFormatted('%d:%02d')); @@ -78,7 +78,7 @@ public function test_getFormattedWithCustomFormatting() $this->assertSame('1:30', (new ReadingTime($this->words(360)))->getFormatted('%d:%02d')); } - public function test_getFormattedFormatsUpToOneMinuteWhenRoundUpIsSet() + public function testGetFormattedFormatsUpToOneMinuteWhenRoundUpIsSet() { $this->assertSame('1min, 0sec', (new ReadingTime($this->words(0)))->getFormatted()); $this->assertSame('1min, 0sec', (new ReadingTime($this->words(120)))->getFormatted()); @@ -86,7 +86,7 @@ public function test_getFormattedFormatsUpToOneMinuteWhenRoundUpIsSet() $this->assertSame('1min, 30sec', (new ReadingTime($this->words(360)))->getFormatted()); } - public function test_formatUsingClosure() + public function testFormatUsingClosure() { /** * @param int $minutes @@ -103,13 +103,13 @@ public function test_formatUsingClosure() $this->assertSame('1 minutes, 30 seconds', (new ReadingTime($this->words(360)))->formatUsingClosure($closure)); } - public function test_fromString() + public function testFromString() { $this->assertInstanceOf(ReadingTime::class, ReadingTime::fromString('Hello world')); $this->assertEquals(new ReadingTime('Hello world'), ReadingTime::fromString('Hello world')); } - public function test_fromFile() + public function testFromFile() { app()->instance(Filesystem::class, Mockery::mock(Filesystem::class)->shouldReceive('get')->with(Hyde::path('foo.md'), false)->andReturn('Hello world')->getMock()); diff --git a/tests/Feature/RedirectTest.php b/tests/Feature/RedirectTest.php index 21238156..e1ef8633 100644 --- a/tests/Feature/RedirectTest.php +++ b/tests/Feature/RedirectTest.php @@ -15,7 +15,7 @@ */ class RedirectTest extends TestCase { - public function test_can_create_a_redirect() + public function testCanCreateARedirect() { $redirect = Redirect::create('foo', 'bar'); @@ -48,7 +48,7 @@ public function test_can_create_a_redirect() Filesystem::unlink('_site/foo.html'); } - public function test_path_parameter_is_normalized() + public function testPathParameterIsNormalized() { $redirect = Redirect::create('foo.html', 'bar'); @@ -57,7 +57,7 @@ public function test_path_parameter_is_normalized() Filesystem::unlink('_site/foo.html'); } - public function test_text_can_be_disabled() + public function testTextCanBeDisabled() { $redirect = Redirect::create('foo', 'bar'); $this->assertStringContainsString('Redirecting to boot(); @@ -37,7 +37,7 @@ public function test_boot_method_discovers_all_pages() ], $collection->all()); } - public function test_boot_method_discovers_all_page_types() + public function testBootMethodDiscoversAllPageTypes() { $this->withoutDefaultPages(); @@ -63,7 +63,7 @@ public function test_boot_method_discovers_all_page_types() $this->restoreDefaultPages(); } - public function test_get_routes_returns_all_routes() + public function testGetRoutesReturnsAllRoutes() { $this->file('_pages/blade.blade.php'); $this->file('_pages/markdown.md'); @@ -74,7 +74,7 @@ public function test_get_routes_returns_all_routes() $this->assertSame(Hyde::routes(), Routes::getRoutes()); } - public function test_get_routes_for_model_returns_collection_of_routes_of_given_class() + public function testGetRoutesForModelReturnsCollectionOfRoutesOfGivenClass() { $this->withoutDefaultPages(); @@ -96,7 +96,7 @@ public function test_get_routes_for_model_returns_collection_of_routes_of_given_ $this->restoreDefaultPages(); } - public function test_add_route_adds_new_route() + public function testAddRouteAddsNewRoute() { $collection = Hyde::routes(); $this->assertCount(2, $collection); @@ -105,12 +105,12 @@ public function test_add_route_adds_new_route() $this->assertEquals(new Route(new BladePage('new')), $collection->last()); } - public function test_get_route() + public function testGetRoute() { $this->assertEquals(new Route(new BladePage('index')), Routes::getRoute('index')); } - public function test_get_route_with_non_existing_route() + public function testGetRouteWithNonExistingRoute() { $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route [non-existing] not found'); diff --git a/tests/Feature/Services/BladeDownProcessorTest.php b/tests/Feature/Services/BladeDownProcessorTest.php index f7d26d27..797e22d2 100644 --- a/tests/Feature/Services/BladeDownProcessorTest.php +++ b/tests/Feature/Services/BladeDownProcessorTest.php @@ -14,12 +14,12 @@ */ class BladeDownProcessorTest extends TestCase { - public function test_it_renders_blade_echo_syntax() + public function testItRendersBladeEchoSyntax() { $this->assertEquals('Hello World!', BladeDownProcessor::render('[Blade]: {{ "Hello World!" }}')); } - public function test_it_renders_blade_within_multiline_markdown() + public function testItRendersBladeWithinMultilineMarkdown() { $this->assertEquals( "Foo\nHello World!\nBar", @@ -28,7 +28,7 @@ public function test_it_renders_blade_within_multiline_markdown() ); } - public function test_it_renders_blade_views() + public function testItRendersBladeViews() { if (! file_exists(resource_path('views'))) { mkdir(resource_path('views')); @@ -43,23 +43,23 @@ public function test_it_renders_blade_views() unlink(resource_path('views/hello.blade.php')); } - public function test_directive_is_case_insensitive() + public function testDirectiveIsCaseInsensitive() { $this->assertEquals('Hello World!', BladeDownProcessor::render('[blade]: {{ "Hello World!" }}')); } - public function test_directive_is_ignored_if_it_is_not_at_the_start_of_a_line() + public function testDirectiveIsIgnoredIfItIsNotAtTheStartOfALine() { $this->assertEquals('Example: [Blade]: {{ "Hello World!" }}', BladeDownProcessor::render('Example: [Blade]: {{ "Hello World!" }}')); } - public function test_it_renders_blade_echo_syntax_with_variables() + public function testItRendersBladeEchoSyntaxWithVariables() { $this->assertEquals('Hello World!', BladeDownProcessor::render('[Blade]: {{ $foo }}', ['foo' => 'Hello World!'])); } - public function test_it_renders_blade_views_with_variables() + public function testItRendersBladeViewsWithVariables() { file_put_contents(resource_path( 'views/hello.blade.php' @@ -70,12 +70,12 @@ public function test_it_renders_blade_views_with_variables() unlink(resource_path('views/hello.blade.php')); } - public function test_preprocess_method_expands_shortcode() + public function testPreprocessMethodExpandsShortcode() { $this->assertEquals('', BladeDownProcessor::preprocess('[Blade]: {{ $foo }}')); } - public function test_process_method_renders_shortcode() + public function testProcessMethodRendersShortcode() { $this->assertEquals('Hello World!', BladeDownProcessor::postprocess('', ['foo' => 'Hello World!'])); } diff --git a/tests/Feature/Services/BuildTaskServiceTest.php b/tests/Feature/Services/BuildTaskServiceTest.php index 0260d37a..c2718e30 100644 --- a/tests/Feature/Services/BuildTaskServiceTest.php +++ b/tests/Feature/Services/BuildTaskServiceTest.php @@ -28,7 +28,7 @@ class BuildTaskServiceTest extends TestCase /** * @covers \Hyde\Console\Commands\BuildSiteCommand::runPostBuildActions */ - public function test_build_command_can_run_build_tasks() + public function testBuildCommandCanRunBuildTasks() { $this->artisan('build') ->expectsOutputToContain('Removing all files from build directory') @@ -39,7 +39,7 @@ public function test_build_command_can_run_build_tasks() File::cleanDirectory(Hyde::path('_site')); } - public function test_run_post_build_tasks_runs_configured_tasks_does_nothing_if_no_tasks_are_configured() + public function testRunPostBuildTasksRunsConfiguredTasksDoesNothingIfNoTasksAreConfigured() { $service = $this->makeService(); $service->runPostBuildTasks(); @@ -47,7 +47,7 @@ public function test_run_post_build_tasks_runs_configured_tasks_does_nothing_if_ $this->expectOutputString(''); } - public function test_get_post_build_tasks_returns_array_merged_with_config() + public function testGetPostBuildTasksReturnsArrayMergedWithConfig() { config(['hyde.build_tasks' => [SecondBuildTask::class]]); @@ -57,7 +57,7 @@ public function test_get_post_build_tasks_returns_array_merged_with_config() $this->assertEquals(1, count(array_keys($tasks, SecondBuildTask::class))); } - public function test_get_post_build_tasks_merges_duplicate_keys() + public function testGetPostBuildTasksMergesDuplicateKeys() { app(BuildTaskService::class)->registerTask(TestBuildTask::class); config(['hyde.build_tasks' => [TestBuildTask::class]]); @@ -68,7 +68,7 @@ public function test_get_post_build_tasks_merges_duplicate_keys() $this->assertEquals(1, count(array_keys($tasks, TestBuildTask::class))); } - public function test_run_post_build_tasks_runs_configured_tasks() + public function testRunPostBuildTasksRunsConfiguredTasks() { $task = $this->makeTask(); @@ -80,7 +80,7 @@ public function test_run_post_build_tasks_runs_configured_tasks() $this->expectOutputString('BuildTask'); } - public function test_exception_handler_shows_error_message_and_exits_with_code_1_without_throwing_exception() + public function testExceptionHandlerShowsErrorMessageAndExitsWithCode1WithoutThrowingException() { $return = (new class extends BuildTask { @@ -93,7 +93,7 @@ public function handle(): void $this->assertEquals(1, $return); } - public function test_find_tasks_in_app_directory_method_discovers_tasks_in_app_directory() + public function testFindTasksInAppDirectoryMethodDiscoversTasksInAppDirectory() { $this->directory('app/Actions'); $this->file('app/Actions/FooBuildTask.php', $this->classFileStub()); @@ -101,7 +101,7 @@ public function test_find_tasks_in_app_directory_method_discovers_tasks_in_app_d $this->assertContains('App\Actions\FooBuildTask', (new BuildTaskService())->getRegisteredTasks()); } - public function test_automatically_discovered_tasks_can_be_executed() + public function testAutomaticallyDiscoveredTasksCanBeExecuted() { $this->directory('app/Actions'); $this->file('app/Actions/FooBuildTask.php', $this->classFileStub()); diff --git a/tests/Feature/Services/DocumentationSearchServiceTest.php b/tests/Feature/Services/DocumentationSearchServiceTest.php index 0689b466..4df28f2c 100644 --- a/tests/Feature/Services/DocumentationSearchServiceTest.php +++ b/tests/Feature/Services/DocumentationSearchServiceTest.php @@ -28,7 +28,7 @@ protected function tearDown(): void $this->cleanUpFilesystem(); } - public function test_it_generates_a_json_file_with_a_search_index() + public function testItGeneratesAJsonFileWithASearchIndex() { $this->file('_docs/foo.md'); @@ -42,7 +42,7 @@ public function test_it_generates_a_json_file_with_a_search_index() ]]), file_get_contents('_site/docs/search.json')); } - public function test_it_adds_all_files_to_search_index() + public function testItAddsAllFilesToSearchIndex() { $this->file('_docs/foo.md'); $this->file('_docs/bar.md'); @@ -51,7 +51,7 @@ public function test_it_adds_all_files_to_search_index() $this->assertCount(3, $this->getArray()); } - public function test_it_handles_generation_even_when_there_are_no_pages() + public function testItHandlesGenerationEvenWhenThereAreNoPages() { GeneratesDocumentationSearchIndex::handle(); @@ -60,7 +60,7 @@ public function test_it_handles_generation_even_when_there_are_no_pages() Filesystem::unlink('_site/docs/search.json'); } - public function test_save_method_saves_the_file_to_the_correct_location() + public function testSaveMethodSavesTheFileToTheCorrectLocation() { GeneratesDocumentationSearchIndex::handle(); @@ -69,7 +69,7 @@ public function test_save_method_saves_the_file_to_the_correct_location() Filesystem::unlink('_site/docs/search.json'); } - public function test_it_generates_a_valid_JSON() + public function testItGeneratesAValidJSON() { $this->file('_docs/foo.md', "# Bar\nHello World"); $this->file('_docs/bar.md', "# Foo\n\nHello World"); @@ -82,7 +82,7 @@ public function test_it_generates_a_valid_JSON() ); } - public function test_it_strips_markdown() + public function testItStripsMarkdown() { $this->file('_docs/foo.md', "# Foo Bar\n**Hello** _World_"); @@ -92,7 +92,7 @@ public function test_it_strips_markdown() ); } - public function test_get_destination_for_slug_returns_empty_string_for_index_when_pretty_url_is_enabled() + public function testGetDestinationForSlugReturnsEmptyStringForIndexWhenPrettyUrlIsEnabled() { self::mockConfig(['hyde.pretty_urls' => true]); $this->file('_docs/index.md'); @@ -102,7 +102,7 @@ public function test_get_destination_for_slug_returns_empty_string_for_index_whe ); } - public function test_get_destination_for_slug_returns_pretty_url_when_enabled() + public function testGetDestinationForSlugReturnsPrettyUrlWhenEnabled() { self::mockConfig(['hyde.pretty_urls' => true]); $this->file('_docs/foo.md'); @@ -112,7 +112,7 @@ public function test_get_destination_for_slug_returns_pretty_url_when_enabled() ); } - public function test_excluded_pages_are_not_present_in_the_search_index() + public function testExcludedPagesAreNotPresentInTheSearchIndex() { $this->file('_docs/excluded.md'); self::mockConfig(['docs.exclude_from_search' => ['excluded']]); @@ -122,7 +122,7 @@ public function test_excluded_pages_are_not_present_in_the_search_index() ); } - public function test_nested_source_files_do_not_retain_directory_name_in_search_index() + public function testNestedSourceFilesDoNotRetainDirectoryNameInSearchIndex() { $this->directory(Hyde::path('_docs/foo')); $this->file('_docs/foo/bar.md'); diff --git a/tests/Feature/Services/DocumentationSidebarTest.php b/tests/Feature/Services/DocumentationSidebarTest.php index 5562c1ec..54290a8e 100644 --- a/tests/Feature/Services/DocumentationSidebarTest.php +++ b/tests/Feature/Services/DocumentationSidebarTest.php @@ -38,14 +38,14 @@ protected function tearDown(): void parent::tearDown(); } - public function test_sidebar_can_be_created() + public function testSidebarCanBeCreated() { $sidebar = DocumentationSidebar::create(); $this->assertInstanceOf(DocumentationSidebar::class, $sidebar); } - public function test_sidebar_items_are_added_automatically() + public function testSidebarItemsAreAddedAutomatically() { $this->createTestFiles(); @@ -54,7 +54,7 @@ public function test_sidebar_items_are_added_automatically() $this->assertCount(5, $sidebar->items); } - public function test_index_page_is_removed_from_sidebar() + public function testIndexPageIsRemovedFromSidebar() { $this->createTestFiles(); Filesystem::touch('_docs/index.md'); @@ -63,7 +63,7 @@ public function test_index_page_is_removed_from_sidebar() $this->assertCount(5, $sidebar->items); } - public function test_files_with_front_matter_hidden_set_to_true_are_removed_from_sidebar() + public function testFilesWithFrontMatterHiddenSetToTrueAreRemovedFromSidebar() { $this->createTestFiles(); File::put(Hyde::path('_docs/test.md'), "---\nnavigation:\n hidden: true\n---\n\n# Foo"); @@ -72,7 +72,7 @@ public function test_files_with_front_matter_hidden_set_to_true_are_removed_from $this->assertCount(5, $sidebar->items); } - public function test_sidebar_is_ordered_alphabetically_when_no_order_is_set_in_config() + public function testSidebarIsOrderedAlphabeticallyWhenNoOrderIsSetInConfig() { Config::set('docs.sidebar_order', []); Filesystem::touch('_docs/a.md'); @@ -89,7 +89,7 @@ public function test_sidebar_is_ordered_alphabetically_when_no_order_is_set_in_c ); } - public function test_sidebar_is_ordered_by_priority_when_priority_is_set_in_config() + public function testSidebarIsOrderedByPriorityWhenPriorityIsSetInConfig() { Config::set('docs.sidebar_order', [ 'c', @@ -110,14 +110,14 @@ public function test_sidebar_is_ordered_by_priority_when_priority_is_set_in_conf ); } - public function test_sidebar_item_priority_can_be_set_in_front_matter() + public function testSidebarItemPriorityCanBeSetInFrontMatter() { $this->makePage('foo', ['navigation.priority' => 25]); $this->assertEquals(25, DocumentationSidebar::create()->items->first()->priority); } - public function test_sidebar_item_priority_set_in_config_overrides_front_matter() + public function testSidebarItemPrioritySetInConfigOverridesFrontMatter() { $this->makePage('foo', ['navigation.priority' => 25]); @@ -126,7 +126,7 @@ public function test_sidebar_item_priority_set_in_config_overrides_front_matter( $this->assertEquals(25, DocumentationSidebar::create()->items->first()->priority); } - public function test_sidebar_priorities_can_be_set_in_both_front_matter_and_config() + public function testSidebarPrioritiesCanBeSetInBothFrontMatterAndConfig() { Config::set('docs.sidebar_order', [ 'first', @@ -149,26 +149,26 @@ public function test_sidebar_priorities_can_be_set_in_both_front_matter_and_conf ); } - public function test_group_can_be_set_in_front_matter() + public function testGroupCanBeSetInFrontMatter() { $this->makePage('foo', ['navigation.group' => 'bar']); $this->assertEquals('bar', DocumentationSidebar::create()->items->first()->getGroup()); } - public function test_has_groups_returns_false_when_there_are_no_groups() + public function testHasGroupsReturnsFalseWhenThereAreNoGroups() { $this->assertFalse(DocumentationSidebar::create()->hasGroups()); } - public function test_has_groups_returns_true_when_there_are_groups() + public function testHasGroupsReturnsTrueWhenThereAreGroups() { $this->makePage('foo', ['navigation.group' => 'bar']); $this->assertTrue(DocumentationSidebar::create()->hasGroups()); } - public function test_has_groups_returns_true_when_there_are_multiple_groups() + public function testHasGroupsReturnsTrueWhenThereAreMultipleGroups() { $this->makePage('foo', ['navigation.group' => 'bar']); $this->makePage('bar', ['navigation.group' => 'baz']); @@ -176,7 +176,7 @@ public function test_has_groups_returns_true_when_there_are_multiple_groups() $this->assertTrue(DocumentationSidebar::create()->hasGroups()); } - public function test_has_groups_returns_true_when_there_are_multiple_groups_mixed_with_defaults() + public function testHasGroupsReturnsTrueWhenThereAreMultipleGroupsMixedWithDefaults() { $this->makePage('foo', ['navigation.group' => 'bar']); $this->makePage('bar', ['navigation.group' => 'baz']); @@ -185,19 +185,19 @@ public function test_has_groups_returns_true_when_there_are_multiple_groups_mixe $this->assertTrue(DocumentationSidebar::create()->hasGroups()); } - public function test_get_groups_returns_empty_array_when_there_are_no_groups() + public function testGetGroupsReturnsEmptyArrayWhenThereAreNoGroups() { $this->assertEquals([], DocumentationSidebar::create()->getGroups()); } - public function test_get_groups_returns_array_of_groups_when_there_are_groups() + public function testGetGroupsReturnsArrayOfGroupsWhenThereAreGroups() { $this->makePage('foo', ['navigation.group' => 'bar']); $this->assertEquals(['bar'], DocumentationSidebar::create()->getGroups()); } - public function test_get_groups_returns_array_with_no_duplicates() + public function testGetGroupsReturnsArrayWithNoDuplicates() { $this->makePage('foo', ['navigation.group' => 'bar']); $this->makePage('bar', ['navigation.group' => 'bar']); @@ -206,7 +206,7 @@ public function test_get_groups_returns_array_with_no_duplicates() $this->assertEquals(['bar', 'baz'], DocumentationSidebar::create()->getGroups()); } - public function test_groups_are_sorted_by_lowest_found_priority_in_each_group() + public function testGroupsAreSortedByLowestFoundPriorityInEachGroup() { $this->makePage('foo', ['navigation.group' => 'bar', 'navigation.priority' => 100]); $this->makePage('bar', ['navigation.group' => 'bar', 'navigation.priority' => 200]); @@ -215,12 +215,12 @@ public function test_groups_are_sorted_by_lowest_found_priority_in_each_group() $this->assertEquals(['baz', 'bar'], DocumentationSidebar::create()->getGroups()); } - public function test_get_items_in_group_returns_empty_collection_when_there_are_no_items() + public function testGetItemsInGroupReturnsEmptyCollectionWhenThereAreNoItems() { $this->assertEquals(collect(), DocumentationSidebar::create()->getItemsInGroup('foo')); } - public function test_get_items_in_group_returns_collection_of_items_in_group() + public function testGetItemsInGroupReturnsCollectionOfItemsInGroup() { $this->makePage('foo', ['navigation.group' => 'bar']); $this->makePage('bar', ['navigation.group' => 'bar']); @@ -242,7 +242,7 @@ public function test_get_items_in_group_returns_collection_of_items_in_group() ); } - public function test_get_items_in_group_normalizes_group_name_to_slug_format() + public function testGetItemsInGroupNormalizesGroupNameToSlugFormat() { $this->makePage('a', ['navigation.group' => 'foo bar']); $this->makePage('b', ['navigation.group' => 'Foo Bar']); @@ -258,7 +258,7 @@ public function test_get_items_in_group_normalizes_group_name_to_slug_format() ); } - public function test_get_items_in_group_does_not_include_items_with_hidden_front_matter() + public function testGetItemsInGroupDoesNotIncludeItemsWithHiddenFrontMatter() { $this->makePage('a', ['navigation.hidden' => true, 'navigation.group' => 'foo']); $this->makePage('b', ['navigation.group' => 'foo']); @@ -269,7 +269,7 @@ public function test_get_items_in_group_does_not_include_items_with_hidden_front ); } - public function test_get_items_in_group_does_not_include_docs_index() + public function testGetItemsInGroupDoesNotIncludeDocsIndex() { Filesystem::touch('_docs/foo.md'); Filesystem::touch('_docs/index.md'); @@ -280,25 +280,25 @@ public function test_get_items_in_group_does_not_include_docs_index() ); } - public function test_is_group_active_returns_false_when_supplied_group_is_not_active() + public function testIsGroupActiveReturnsFalseWhenSuppliedGroupIsNotActive() { Render::setPage(new DocumentationPage(matter: ['navigation.group' => 'foo'])); $this->assertFalse(DocumentationSidebar::create()->isGroupActive('bar')); } - public function test_is_group_active_returns_true_when_supplied_group_is_active() + public function testIsGroupActiveReturnsTrueWhenSuppliedGroupIsActive() { Render::setPage(new DocumentationPage(matter: ['navigation.group' => 'foo'])); $this->assertTrue(DocumentationSidebar::create()->isGroupActive('foo')); } - public function test_is_group_active_returns_true_for_differing_casing() + public function testIsGroupActiveReturnsTrueForDifferingCasing() { Render::setPage(new DocumentationPage(matter: ['navigation.group' => 'Foo Bar'])); $this->assertTrue(DocumentationSidebar::create()->isGroupActive('foo-bar')); } - public function test_is_group_active_returns_true_first_group_of_index_page() + public function testIsGroupActiveReturnsTrueFirstGroupOfIndexPage() { $this->makePage('index'); $this->makePage('foo', ['navigation.group' => 'foo']); @@ -311,7 +311,7 @@ public function test_is_group_active_returns_true_first_group_of_index_page() $this->assertFalse(DocumentationSidebar::create()->isGroupActive('baz')); } - public function test_is_group_active_returns_true_first_sorted_group_of_index_page() + public function testIsGroupActiveReturnsTrueFirstSortedGroupOfIndexPage() { $this->makePage('index'); $this->makePage('foo', ['navigation.group' => 'foo', 'navigation.priority' => 1]); @@ -324,7 +324,7 @@ public function test_is_group_active_returns_true_first_sorted_group_of_index_pa $this->assertFalse(DocumentationSidebar::create()->isGroupActive('baz')); } - public function test_automatic_index_page_group_expansion_respects_custom_navigation_menu_settings() + public function testAutomaticIndexPageGroupExpansionRespectsCustomNavigationMenuSettings() { $this->makePage('index', ['navigation.group' => 'baz']); $this->makePage('foo', ['navigation.group' => 'foo', 'navigation.priority' => 1]); @@ -337,7 +337,7 @@ public function test_automatic_index_page_group_expansion_respects_custom_naviga $this->assertTrue(DocumentationSidebar::create()->isGroupActive('baz')); } - public function test_make_group_title_turns_group_key_into_title() + public function testMakeGroupTitleTurnsGroupKeyIntoTitle() { $this->assertSame('Hello World', DocumentationSidebar::create()->makeGroupTitle('hello world')); $this->assertSame('Hello World', DocumentationSidebar::create()->makeGroupTitle('hello-world')); @@ -345,7 +345,7 @@ public function test_make_group_title_turns_group_key_into_title() $this->assertSame('Hello World', DocumentationSidebar::create()->makeGroupTitle('helloWorld')); } - public function test_make_group_title_uses_configured_sidebar_group_labels_when_available() + public function testMakeGroupTitleUsesConfiguredSidebarGroupLabelsWhenAvailable() { Config::set('docs.sidebar_group_labels', [ 'example' => 'Hello world!', @@ -355,7 +355,7 @@ public function test_make_group_title_uses_configured_sidebar_group_labels_when_ $this->assertSame('Default', DocumentationSidebar::create()->makeGroupTitle('default')); } - public function test_can_have_multiple_grouped_pages_with_the_same_name_labels() + public function testCanHaveMultipleGroupedPagesWithTheSameNameLabels() { $this->makePage('foo', ['navigation.group' => 'foo', 'navigation.label' => 'Foo']); $this->makePage('bar', ['navigation.group' => 'bar', 'navigation.label' => 'Foo']); @@ -372,7 +372,7 @@ public function test_can_have_multiple_grouped_pages_with_the_same_name_labels() ); } - public function test_duplicate_labels_within_the_same_group_is_removed() + public function testDuplicateLabelsWithinTheSameGroupIsRemoved() { $this->makePage('foo', ['navigation.group' => 'foo', 'navigation.label' => 'Foo']); $this->makePage('bar', ['navigation.group' => 'foo', 'navigation.label' => 'Foo']); @@ -386,7 +386,7 @@ public function test_duplicate_labels_within_the_same_group_is_removed() ); } - public function test_is_group_active_for_index_page_with_no_groups() + public function testIsGroupActiveForIndexPageWithNoGroups() { $this->makePage('index'); @@ -394,7 +394,7 @@ public function test_is_group_active_for_index_page_with_no_groups() $this->assertFalse(DocumentationSidebar::create()->isGroupActive('foo')); } - public function test_index_page_added_to_sidebar_when_it_is_the_only_page() + public function testIndexPageAddedToSidebarWhenItIsTheOnlyPage() { Filesystem::touch('_docs/index.md'); $sidebar = DocumentationSidebar::create(); @@ -406,7 +406,7 @@ public function test_index_page_added_to_sidebar_when_it_is_the_only_page() ); } - public function test_index_page_not_added_to_sidebar_when_other_pages_exist() + public function testIndexPageNotAddedToSidebarWhenOtherPagesExist() { $this->createTestFiles(1); Filesystem::touch('_docs/index.md'); diff --git a/tests/Feature/Services/HydeSmartDocsTest.php b/tests/Feature/Services/HydeSmartDocsTest.php index 1404841f..a44ffcd9 100644 --- a/tests/Feature/Services/HydeSmartDocsTest.php +++ b/tests/Feature/Services/HydeSmartDocsTest.php @@ -20,7 +20,7 @@ */ class HydeSmartDocsTest extends TestCase { - public function test_class_tokenizes_document() + public function testClassTokenizesDocument() { $article = $this->makeArticle("# Header Content \n\n Body Content"); @@ -28,7 +28,7 @@ public function test_class_tokenizes_document() $this->assertEquals('

Body Content

', $article->renderBody()); } - public function test_class_can_handle_document_with_no_header() + public function testClassCanHandleDocumentWithNoHeader() { $article = $this->makeArticle('Body Content'); @@ -36,7 +36,7 @@ public function test_class_can_handle_document_with_no_header() $this->assertEquals('

Body Content

', $article->renderBody()); } - public function test_class_can_handle_document_with_only_header() + public function testClassCanHandleDocumentWithOnlyHeader() { $article = $this->makeArticle('# Header Content'); @@ -44,7 +44,7 @@ public function test_class_can_handle_document_with_only_header() $this->assertEquals('', $article->renderBody()); } - public function test_class_can_handle_empty_document() + public function testClassCanHandleEmptyDocument() { $article = $this->makeArticle(''); @@ -52,7 +52,7 @@ public function test_class_can_handle_empty_document() $this->assertEquals('', $article->renderBody()); } - public function test_create_helper_creates_new_instance_and_processes_it() + public function testCreateHelperCreatesNewInstanceAndProcessesIt() { $article = $this->makeArticle(); @@ -64,7 +64,7 @@ public function test_create_helper_creates_new_instance_and_processes_it() ); } - public function test_render_header_returns_the_extracted_header() + public function testRenderHeaderReturnsTheExtractedHeader() { $this->assertSame( '

Foo

', @@ -72,7 +72,7 @@ public function test_render_header_returns_the_extracted_header() ); } - public function test_render_header_returns_the_extracted_header_with_varying_newlines() + public function testRenderHeaderReturnsTheExtractedHeaderWithVaryingNewlines() { $tests = [ "# Foo\n\nHello world.", @@ -88,7 +88,7 @@ public function test_render_header_returns_the_extracted_header_with_varying_new } } - public function test_render_body_returns_the_extracted_body() + public function testRenderBodyReturnsTheExtractedBody() { $this->assertSame( '

Hello world.

', @@ -96,7 +96,7 @@ public function test_render_body_returns_the_extracted_body() ); } - public function test_render_body_returns_the_extracted_body_with_varying_newlines() + public function testRenderBodyReturnsTheExtractedBodyWithVaryingNewlines() { $tests = [ "# Foo\n\nHello world.", @@ -112,7 +112,7 @@ public function test_render_body_returns_the_extracted_body_with_varying_newline } } - public function test_render_footer_is_empty_by_default() + public function testRenderFooterIsEmptyByDefault() { $this->assertSame( '', @@ -120,7 +120,7 @@ public function test_render_footer_is_empty_by_default() ); } - public function test_add_dynamic_header_content_adds_source_link_when_conditions_are_met() + public function testAddDynamicHeaderContentAddsSourceLinkWhenConditionsAreMet() { config(['docs.source_file_location_base' => 'https://example.com/']); config(['docs.edit_source_link_position' => 'header']); @@ -130,7 +130,7 @@ public function test_add_dynamic_header_content_adds_source_link_when_conditions HTML, $this->makeArticle()->renderHeader()); } - public function test_edit_source_link_is_added_to_footer_when_conditions_are_met() + public function testEditSourceLinkIsAddedToFooterWhenConditionsAreMet() { config(['docs.source_file_location_base' => 'https://example.com/']); config(['docs.edit_source_link_position' => 'footer']); @@ -140,7 +140,7 @@ public function test_edit_source_link_is_added_to_footer_when_conditions_are_met HTML, $this->makeArticle()->renderFooter()); } - public function test_edit_source_link_can_be_added_to_both_header_and_footer() + public function testEditSourceLinkCanBeAddedToBothHeaderAndFooter() { config(['docs.source_file_location_base' => 'https://example.com/']); config(['docs.edit_source_link_position' => 'both']); @@ -156,7 +156,7 @@ public function test_edit_source_link_can_be_added_to_both_header_and_footer() HTML, $article->renderFooter()); } - public function test_edit_source_link_text_can_be_customized_in_header() + public function testEditSourceLinkTextCanBeCustomizedInHeader() { config(['docs.source_file_location_base' => 'https://example.com/']); config(['docs.edit_source_link_position' => 'both']); @@ -167,7 +167,7 @@ public function test_edit_source_link_text_can_be_customized_in_header() HTML, $this->makeArticle()->renderHeader()); } - public function test_edit_source_link_text_can_be_customized_in_footer() + public function testEditSourceLinkTextCanBeCustomizedInFooter() { config(['docs.source_file_location_base' => 'https://example.com/']); config(['docs.edit_source_link_position' => 'both']); @@ -178,7 +178,7 @@ public function test_edit_source_link_text_can_be_customized_in_footer() HTML, $this->makeArticle()->renderFooter()); } - public function test_add_dynamic_footer_content_adds_torchlight_attribution_when_conditions_are_met() + public function testAddDynamicFooterContentAddsTorchlightAttributionWhenConditionsAreMet() { app()->bind('env', fn () => 'production'); config(['torchlight.token' => '12345']); @@ -188,7 +188,7 @@ public function test_add_dynamic_footer_content_adds_torchlight_attribution_when ); } - public function test_the_documentation_article_view() + public function testTheDocumentationArticleView() { $rendered = view('hyde::components.docs.documentation-article', [ 'page' => $this->makePage(), @@ -198,7 +198,7 @@ public function test_the_documentation_article_view() $this->assertStringContainsString('

Hello world.

', $rendered); } - public function test_the_documentation_article_view_with_existing_variable() + public function testTheDocumentationArticleViewWithExistingVariable() { $rendered = view('hyde::components.docs.documentation-article', [ 'page' => $page = $this->makePage(), diff --git a/tests/Feature/Services/Markdown/CodeblockFilepathProcessorTest.php b/tests/Feature/Services/Markdown/CodeblockFilepathProcessorTest.php index ca678357..1d92f722 100644 --- a/tests/Feature/Services/Markdown/CodeblockFilepathProcessorTest.php +++ b/tests/Feature/Services/Markdown/CodeblockFilepathProcessorTest.php @@ -12,7 +12,7 @@ */ class CodeblockFilepathProcessorTest extends TestCase { - public function test_preprocess_expands_filepath() + public function testPreprocessExpandsFilepath() { $markdown = "\n```php\n// filepath: foo.php\necho 'Hello World';\n```"; $expected = "\n\n```php\necho 'Hello World';\n```"; @@ -20,7 +20,7 @@ public function test_preprocess_expands_filepath() $this->assertEquals($expected, CodeblockFilepathProcessor::preprocess($markdown)); } - public function test_preprocess_accepts_multiple_filepath_formats() + public function testPreprocessAcceptsMultipleFilepathFormats() { $patterns = [ '// filepath: ', @@ -41,7 +41,7 @@ public function test_preprocess_accepts_multiple_filepath_formats() } } - public function test_filepath_pattern_is_case_insensitive() + public function testFilepathPatternIsCaseInsensitive() { $patterns = [ '// filepath: ', @@ -58,7 +58,7 @@ public function test_filepath_pattern_is_case_insensitive() } } - public function test_preprocess_accepts_multiple_languages() + public function testPreprocessAcceptsMultipleLanguages() { $languages = [ 'php', @@ -78,7 +78,7 @@ public function test_preprocess_accepts_multiple_languages() $this->assertEquals($expected, CodeblockFilepathProcessor::preprocess($markdown)); } - public function test_preprocess_accepts_multiple_input_blocks() + public function testPreprocessAcceptsMultipleInputBlocks() { $markdown = <<<'MD' @@ -109,7 +109,7 @@ public function test_preprocess_accepts_multiple_input_blocks() $this->assertSame($expected, CodeblockFilepathProcessor::preprocess($markdown)); } - public function test_preprocess_accepts_multi_line_codeblocks() + public function testPreprocessAcceptsMultiLineCodeblocks() { $markdown = <<<'MD' @@ -134,7 +134,7 @@ public function test_preprocess_accepts_multi_line_codeblocks() $this->assertSame($expected, CodeblockFilepathProcessor::preprocess($markdown)); } - public function test_space_after_filepath_is_optional() + public function testSpaceAfterFilepathIsOptional() { $markdown = <<<'MD' @@ -157,7 +157,7 @@ public function test_space_after_filepath_is_optional() CodeblockFilepathProcessor::preprocess($markdown)); } - public function test_processor_expands_filepath_directive_in_standard_codeblock() + public function testProcessorExpandsFilepathDirectiveInStandardCodeblock() { $html = <<<'HTML' @@ -171,7 +171,7 @@ public function test_processor_expands_filepath_directive_in_standard_codeblock( $this->assertSame($expected, CodeblockFilepathProcessor::postprocess($html)); } - public function test_processor_expands_filepath_directive_in_torchlight_codeblock() + public function testProcessorExpandsFilepathDirectiveInTorchlightCodeblock() { $html = <<<'HTML' @@ -185,7 +185,7 @@ public function test_processor_expands_filepath_directive_in_torchlight_codebloc $this->assertSame($expected, CodeblockFilepathProcessor::postprocess($html)); } - public function test_processor_escapes_html_by_default() + public function testProcessorEscapesHtmlByDefault() { $html = <<<'HTML' @@ -200,7 +200,7 @@ public function test_processor_escapes_html_by_default() $this->assertSame($expected, CodeblockFilepathProcessor::postprocess($html)); } - public function test_processor_does_not_escape_html_if_configured() + public function testProcessorDoesNotEscapeHtmlIfConfigured() { config(['markdown.allow_html' => true]); diff --git a/tests/Feature/Services/Markdown/ShortcodeProcessorTest.php b/tests/Feature/Services/Markdown/ShortcodeProcessorTest.php index 559c1c84..195da02b 100644 --- a/tests/Feature/Services/Markdown/ShortcodeProcessorTest.php +++ b/tests/Feature/Services/Markdown/ShortcodeProcessorTest.php @@ -13,7 +13,7 @@ */ class ShortcodeProcessorTest extends UnitTestCase { - public function test_constructor_discovers_default_shortcodes() + public function testConstructorDiscoversDefaultShortcodes() { $shortcodes = (new ShortcodeProcessor('foo'))->getShortcodes(); @@ -21,7 +21,7 @@ public function test_constructor_discovers_default_shortcodes() $this->assertContainsOnlyInstancesOf(MarkdownShortcodeContract::class, $shortcodes); } - public function test_discovered_shortcodes_are_used_to_process_input() + public function testDiscoveredShortcodesAreUsedToProcessInput() { $processor = new ShortcodeProcessor('>info foo'); @@ -29,20 +29,20 @@ public function test_discovered_shortcodes_are_used_to_process_input() $processor->run()); } - public function test_string_without_shortcode_is_not_modified() + public function testStringWithoutShortcodeIsNotModified() { $processor = new ShortcodeProcessor('foo'); $this->assertEquals('foo', $processor->run()); } - public function test_process_static_shorthand() + public function testProcessStaticShorthand() { $this->assertEquals('

foo

', ShortcodeProcessor::preprocess('>info foo')); } - public function test_shortcodes_can_be_added_to_processor() + public function testShortcodesCanBeAddedToProcessor() { $processor = new ShortcodeProcessor('foo'); @@ -63,7 +63,7 @@ public static function resolve(string $input): string $this->assertEquals('bar', $processor->run()); } - public function test_shortcodes_can_be_added_to_processor_using_array() + public function testShortcodesCanBeAddedToProcessorUsingArray() { $processor = new ShortcodeProcessor('foo'); diff --git a/tests/Feature/Services/RssFeedServiceTest.php b/tests/Feature/Services/RssFeedServiceTest.php index da8fa05b..475fb770 100644 --- a/tests/Feature/Services/RssFeedServiceTest.php +++ b/tests/Feature/Services/RssFeedServiceTest.php @@ -16,26 +16,26 @@ */ class RssFeedServiceTest extends TestCase { - public function test_service_instantiates_xml_element() + public function testServiceInstantiatesXmlElement() { $service = new RssFeedGenerator(); $this->assertInstanceOf('SimpleXMLElement', $service->getXmlElement()); } - public function test_xml_root_element_is_set_to_rss_2_0() + public function testXmlRootElementIsSetToRss20() { $service = new RssFeedGenerator(); $this->assertEquals('rss', $service->getXmlElement()->getName()); $this->assertEquals('2.0', $service->getXmlElement()->attributes()->version); } - public function test_xml_element_has_channel_element() + public function testXmlElementHasChannelElement() { $service = new RssFeedGenerator(); $this->assertTrue(property_exists($service->getXmlElement(), 'channel')); } - public function test_xml_channel_element_has_required_elements() + public function testXmlChannelElementHasRequiredElements() { config(['hyde.name' => 'Test Blog']); config(['hyde.url' => 'https://example.com']); @@ -51,7 +51,7 @@ public function test_xml_channel_element_has_required_elements() $this->assertEquals('Test Blog RSS Feed', $service->getXmlElement()->channel->description); } - public function test_xml_channel_element_has_additional_elements() + public function testXmlChannelElementHasAdditionalElements() { config(['hyde.url' => 'https://example.com']); @@ -66,7 +66,7 @@ public function test_xml_channel_element_has_additional_elements() $this->assertTrue(property_exists($service->getXmlElement()->channel, 'lastBuildDate')); } - public function test_xml_channel_data_can_be_customized() + public function testXmlChannelDataCanBeCustomized() { config(['hyde.name' => 'Foo']); config(['hyde.url' => 'https://blog.foo.com/bar']); @@ -78,7 +78,7 @@ public function test_xml_channel_data_can_be_customized() $this->assertEquals('Foo is a web log about stuff', $service->getXmlElement()->channel->description); } - public function test_markdown_blog_posts_are_added_to_rss_feed_through_autodiscovery() + public function testMarkdownBlogPostsAreAddedToRssFeedThroughAutodiscovery() { file_put_contents(Hyde::path('_posts/rss.md'), <<<'MD' --- @@ -121,32 +121,32 @@ public function test_markdown_blog_posts_are_added_to_rss_feed_through_autodisco Filesystem::unlink('_media/rss-test.jpg'); } - public function test_get_xml_method_returns_xml_string() + public function testGetXmlMethodReturnsXmlString() { $service = new RssFeedGenerator(); $this->assertStringStartsWith('', $service->getXml()); } - public function test_generate_feed_helper_returns_xml_string() + public function testGenerateFeedHelperReturnsXmlString() { $this->assertStringStartsWith('', RssFeedGenerator::make()); } - public function test_can_generate_feed_helper_returns_true_if_hyde_has_base_url() + public function testCanGenerateFeedHelperReturnsTrueIfHydeHasBaseUrl() { config(['hyde.url' => 'foo']); $this->file('_posts/foo.md'); $this->assertTrue(Features::rss()); } - public function test_can_generate_feed_helper_returns_false_if_hyde_does_not_have_base_url() + public function testCanGenerateFeedHelperReturnsFalseIfHydeDoesNotHaveBaseUrl() { config(['hyde.url' => '']); $this->file('_posts/foo.md'); $this->assertFalse(Features::rss()); } - public function test_can_generate_feed_helper_returns_false_if_feeds_are_disabled_in_config() + public function testCanGenerateFeedHelperReturnsFalseIfFeedsAreDisabledInConfig() { config(['hyde.url' => 'foo']); config(['hyde.rss.enabled' => false]); diff --git a/tests/Feature/Services/SitemapServiceTest.php b/tests/Feature/Services/SitemapServiceTest.php index e82342eb..c21f16b6 100644 --- a/tests/Feature/Services/SitemapServiceTest.php +++ b/tests/Feature/Services/SitemapServiceTest.php @@ -26,13 +26,13 @@ protected function setUp(): void copy(Hyde::vendorPath('resources/views/pages/404.blade.php'), Hyde::path('_pages/404.blade.php')); } - public function test_service_instantiates_xml_element() + public function testServiceInstantiatesXmlElement() { $service = new SitemapGenerator(); $this->assertInstanceOf('SimpleXMLElement', $service->getXmlElement()); } - public function test_generate_adds_default_pages_to_xml() + public function testGenerateAddsDefaultPagesToXml() { $service = new SitemapGenerator(); $service->generate(); @@ -41,7 +41,7 @@ public function test_generate_adds_default_pages_to_xml() $this->assertCount(2, $service->getXmlElement()->url); } - public function test_generate_adds_markdown_pages_to_xml() + public function testGenerateAddsMarkdownPagesToXml() { Filesystem::touch('_pages/foo.md'); @@ -53,7 +53,7 @@ public function test_generate_adds_markdown_pages_to_xml() Filesystem::unlink('_pages/foo.md'); } - public function test_generate_adds_markdown_posts_to_xml() + public function testGenerateAddsMarkdownPostsToXml() { Filesystem::touch('_posts/foo.md'); @@ -65,7 +65,7 @@ public function test_generate_adds_markdown_posts_to_xml() Filesystem::unlink('_posts/foo.md'); } - public function test_generate_adds_documentation_pages_to_xml() + public function testGenerateAddsDocumentationPagesToXml() { Filesystem::touch('_docs/foo.md'); @@ -77,7 +77,7 @@ public function test_generate_adds_documentation_pages_to_xml() Filesystem::unlink('_docs/foo.md'); } - public function test_get_xml_returns_xml_string() + public function testGetXmlReturnsXmlString() { $service = new SitemapGenerator(); $service->generate(); @@ -87,7 +87,7 @@ public function test_get_xml_returns_xml_string() $this->assertStringStartsWith('', $xml); } - public function test_generate_sitemap_shorthand_method_returns_xml_string() + public function testGenerateSitemapShorthandMethodReturnsXmlString() { $xml = SitemapGenerator::make(); @@ -95,7 +95,7 @@ public function test_generate_sitemap_shorthand_method_returns_xml_string() $this->assertStringStartsWith('', $xml); } - public function test_url_item_is_generated_correctly() + public function testUrlItemIsGeneratedCorrectly() { config(['hyde.pretty_urls' => false]); config(['hyde.url' => 'https://example.com']); @@ -112,7 +112,7 @@ public function test_url_item_is_generated_correctly() Filesystem::unlink('_pages/0-test.blade.php'); } - public function test_url_item_is_generated_with_pretty_urls_if_enabled() + public function testUrlItemIsGeneratedWithPrettyUrlsIfEnabled() { config(['hyde.pretty_urls' => true]); config(['hyde.url' => 'https://example.com']); @@ -127,7 +127,7 @@ public function test_url_item_is_generated_with_pretty_urls_if_enabled() Filesystem::unlink('_pages/0-test.blade.php'); } - public function test_all_route_types_are_discovered() + public function testAllRouteTypesAreDiscovered() { config(['hyde.url' => 'foo']); Filesystem::unlink(['_pages/index.blade.php', '_pages/404.blade.php']); diff --git a/tests/Feature/Services/ValidationServiceTest.php b/tests/Feature/Services/ValidationServiceTest.php index 4efea55c..e6fbe888 100644 --- a/tests/Feature/Services/ValidationServiceTest.php +++ b/tests/Feature/Services/ValidationServiceTest.php @@ -37,7 +37,7 @@ protected function test(string $method, int $expectedStatusCode) $this->assertEquals($expectedStatusCode, $result->statusCode()); } - public function test_checks_returns_an_array_of_validation_check_methods() + public function testChecksReturnsAnArrayOfValidationCheckMethods() { $checks = ValidationService::checks(); $this->assertIsArray($checks); @@ -49,31 +49,31 @@ public function test_checks_returns_an_array_of_validation_check_methods() } } - public function test_check_validators_can_run() + public function testCheckValidatorsCanRun() { $this->test('check_validators_can_run', 0); } - public function test_check_site_has_a_404_page_can_pass() + public function testCheckSiteHasA404PageCanPass() { $this->test('check_site_has_a_404_page', 0); } - public function test_check_site_has_a_404_page_can_fail() + public function testCheckSiteHasA404PageCanFail() { rename(Hyde::path('_pages/404.blade.php'), Hyde::path('_pages/404.blade.php.bak')); $this->test('check_site_has_a_404_page', 2); rename(Hyde::path('_pages/404.blade.php.bak'), Hyde::path('_pages/404.blade.php')); } - public function test_check_documentation_site_has_an_index_page_can_pass() + public function testCheckDocumentationSiteHasAnIndexPageCanPass() { touch('_docs/index.md'); $this->test('check_documentation_site_has_an_index_page', 0); unlink('_docs/index.md'); } - public function test_check_documentation_site_has_an_index_page_can_pass_with_warning_when_only_finding_readme() + public function testCheckDocumentationSiteHasAnIndexPageCanPassWithWarningWhenOnlyFindingReadme() { touch('_docs/README.md'); $this->test('check_documentation_site_has_an_index_page', 2); @@ -82,78 +82,78 @@ public function test_check_documentation_site_has_an_index_page_can_pass_with_wa unlink('_docs/README.md'); } - public function test_check_documentation_site_has_an_index_page_can_fail() + public function testCheckDocumentationSiteHasAnIndexPageCanFail() { touch('_docs/foo.md'); $this->test('check_documentation_site_has_an_index_page', 2); unlink('_docs/foo.md'); } - public function test_check_documentation_site_has_an_index_page_be_skipped() + public function testCheckDocumentationSiteHasAnIndexPageBeSkipped() { $this->test('check_documentation_site_has_an_index_page', 1); } - public function test_check_site_has_an_index_page_can_pass() + public function testCheckSiteHasAnIndexPageCanPass() { $this->test('check_site_has_an_index_page', 0); } - public function test_check_site_has_an_index_page_can_fail() + public function testCheckSiteHasAnIndexPageCanFail() { rename(Hyde::path('_pages/index.blade.php'), Hyde::path('_pages/index.blade.php.bak')); $this->test('check_site_has_an_index_page', 2); rename(Hyde::path('_pages/index.blade.php.bak'), Hyde::path('_pages/index.blade.php')); } - public function test_check_site_has_an_app_css_stylesheet_can_pass() + public function testCheckSiteHasAnAppCssStylesheetCanPass() { $this->test('check_site_has_an_app_css_stylesheet', 0); } - public function test_check_site_has_an_app_css_stylesheet_can_fail() + public function testCheckSiteHasAnAppCssStylesheetCanFail() { rename(Hyde::path('_media/app.css'), Hyde::path('_media/app.css.bak')); $this->test('check_site_has_an_app_css_stylesheet', 2); rename(Hyde::path('_media/app.css.bak'), Hyde::path('_media/app.css')); } - public function test_check_site_has_a_base_url_set_can_pass() + public function testCheckSiteHasABaseUrlSetCanPass() { config(['hyde.url' => 'https://example.com']); $this->test('check_site_has_a_base_url_set', 0); } - public function test_check_site_has_a_base_url_set_can_fail() + public function testCheckSiteHasABaseUrlSetCanFail() { config(['hyde.url' => null]); $this->test('check_site_has_a_base_url_set', 2); } - public function test_check_a_torchlight_api_token_is_set_can_skip() + public function testCheckATorchlightApiTokenIsSetCanSkip() { config(['hyde.features' => []]); $this->test('check_a_torchlight_api_token_is_set', 1); } - public function test_check_a_torchlight_api_token_is_set_can_pass() + public function testCheckATorchlightApiTokenIsSetCanPass() { config(['torchlight.token' => '12345']); $this->test('check_a_torchlight_api_token_is_set', 0); } - public function test_check_a_torchlight_api_token_is_set_can_fail() + public function testCheckATorchlightApiTokenIsSetCanFail() { config(['torchlight.token' => null]); $this->test('check_a_torchlight_api_token_is_set', 2); } - public function test_check_for_conflicts_between_blade_and_markdown_pages_can_pass() + public function testCheckForConflictsBetweenBladeAndMarkdownPagesCanPass() { $this->test('check_for_conflicts_between_blade_and_markdown_pages', 0); } - public function test_check_for_conflicts_between_blade_and_markdown_pages_can_fail() + public function testCheckForConflictsBetweenBladeAndMarkdownPagesCanFail() { Filesystem::touch('_pages/index.md'); $this->test('check_for_conflicts_between_blade_and_markdown_pages', 2); @@ -162,13 +162,13 @@ public function test_check_for_conflicts_between_blade_and_markdown_pages_can_fa // Some unit tests - public function test_validation_result_message_returns_message() + public function testValidationResultMessageReturnsMessage() { $result = new ValidationResult(); $this->assertEquals('Generic check', $result->message()); } - public function test_validation_result_passed_returns_true_when_passed_is_true() + public function testValidationResultPassedReturnsTrueWhenPassedIsTrue() { $result = new ValidationResult(); $result->pass(); @@ -177,7 +177,7 @@ public function test_validation_result_passed_returns_true_when_passed_is_true() $this->assertFalse($result->passed()); } - public function test_validation_result_failed_returns_true_when_passed_is_false() + public function testValidationResultFailedReturnsTrueWhenPassedIsFalse() { $result = new ValidationResult(); $result->pass(); @@ -186,7 +186,7 @@ public function test_validation_result_failed_returns_true_when_passed_is_false( $this->assertTrue($result->failed()); } - public function test_validation_result_skipped_returns_true_when_skipped_is_true() + public function testValidationResultSkippedReturnsTrueWhenSkippedIsTrue() { $result = new ValidationResult(); $this->assertFalse($result->skipped()); @@ -194,7 +194,7 @@ public function test_validation_result_skipped_returns_true_when_skipped_is_true $this->assertTrue($result->skipped()); } - public function test_validation_result_tip_returns_message_when_set() + public function testValidationResultTipReturnsMessageWhenSet() { $result = new ValidationResult(); $this->assertFalse($result->tip()); diff --git a/tests/Feature/Services/ViewDiffServiceTest.php b/tests/Feature/Services/ViewDiffServiceTest.php index 58b8e8bd..ae16dd1f 100644 --- a/tests/Feature/Services/ViewDiffServiceTest.php +++ b/tests/Feature/Services/ViewDiffServiceTest.php @@ -16,7 +16,7 @@ */ class ViewDiffServiceTest extends TestCase { - public function test_get_filecache() + public function testGetFilecache() { $fileCacheService = new ViewDiffService(); $fileCache = $fileCacheService->getViewFileHashIndex(); @@ -27,7 +27,7 @@ public function test_get_filecache() $this->assertEquals(32, strlen($fileCache['resources/views/layouts/app.blade.php']['unixsum'])); } - public function test_get_checksums() + public function testGetChecksums() { $fileCacheService = new ViewDiffService(); $checksums = $fileCacheService->getChecksums(); @@ -36,7 +36,7 @@ public function test_get_checksums() $this->assertEquals(32, strlen($checksums[0])); } - public function test_checksum_matches_any() + public function testChecksumMatchesAny() { $fileCacheService = new ViewDiffService(); @@ -45,7 +45,7 @@ public function test_checksum_matches_any() )); } - public function test_checksum_matches_any_false() + public function testChecksumMatchesAnyFalse() { $fileCacheService = new ViewDiffService(); diff --git a/tests/Feature/SourceDirectoriesCanBeChangedTest.php b/tests/Feature/SourceDirectoriesCanBeChangedTest.php index 6f725512..51bd2016 100644 --- a/tests/Feature/SourceDirectoriesCanBeChangedTest.php +++ b/tests/Feature/SourceDirectoriesCanBeChangedTest.php @@ -17,7 +17,7 @@ */ class SourceDirectoriesCanBeChangedTest extends TestCase { - public function test_baselines() + public function testBaselines() { $this->assertEquals('_pages', HtmlPage::sourceDirectory()); $this->assertEquals('_pages', BladePage::sourceDirectory()); @@ -26,7 +26,7 @@ public function test_baselines() $this->assertEquals('_docs', DocumentationPage::sourceDirectory()); } - public function test_source_directories_can_be_changed_programmatically() + public function testSourceDirectoriesCanBeChangedProgrammatically() { HtmlPage::setSourceDirectory('.source/pages'); BladePage::setSourceDirectory('.source/pages'); @@ -41,7 +41,7 @@ public function test_source_directories_can_be_changed_programmatically() $this->assertEquals('.source/docs', DocumentationPage::sourceDirectory()); } - public function test_source_directories_can_be_changed_in_config() + public function testSourceDirectoriesCanBeChangedInConfig() { config(['hyde.source_directories' => [ HtmlPage::class => '.source/pages', @@ -60,7 +60,7 @@ public function test_source_directories_can_be_changed_in_config() $this->assertEquals('.source/docs', DocumentationPage::sourceDirectory()); } - public function test_build_service_recognizes_changed_directory() + public function testBuildServiceRecognizesChangedDirectory() { MarkdownPost::setSourceDirectory('_source/posts'); @@ -70,7 +70,7 @@ public function test_build_service_recognizes_changed_directory() ); } - public function test_autodiscovery_discovers_posts_in_custom_directory() + public function testAutodiscoveryDiscoversPostsInCustomDirectory() { $this->directory('_source'); $this->file('_source/test.md'); @@ -83,7 +83,7 @@ public function test_autodiscovery_discovers_posts_in_custom_directory() ); } - public function test_autodiscovery_discovers_posts_in_custom_subdirectory() + public function testAutodiscoveryDiscoversPostsInCustomSubdirectory() { $this->directory('_source/posts'); $this->file('_source/posts/test.md'); diff --git a/tests/Feature/SourceFileParserTest.php b/tests/Feature/SourceFileParserTest.php index d58408b7..cf099e08 100644 --- a/tests/Feature/SourceFileParserTest.php +++ b/tests/Feature/SourceFileParserTest.php @@ -17,7 +17,7 @@ */ class SourceFileParserTest extends TestCase { - public function test_blade_page_parser() + public function testBladePageParser() { $this->file('_pages/foo.blade.php'); @@ -27,7 +27,7 @@ public function test_blade_page_parser() $this->assertEquals('foo', $page->identifier); } - public function test_markdown_page_parser() + public function testMarkdownPageParser() { $this->markdown('_pages/foo.md', '# Foo Bar', ['title' => 'Foo Bar Baz']); @@ -39,7 +39,7 @@ public function test_markdown_page_parser() $this->assertEquals('Foo Bar Baz', $page->title); } - public function test_markdown_post_parser() + public function testMarkdownPostParser() { $this->markdown('_posts/foo.md', '# Foo Bar', ['title' => 'Foo Bar Baz']); @@ -51,7 +51,7 @@ public function test_markdown_post_parser() $this->assertEquals('Foo Bar Baz', $page->title); } - public function test_documentation_page_parser() + public function testDocumentationPageParser() { $this->markdown('_docs/foo.md', '# Foo Bar', ['title' => 'Foo Bar Baz']); @@ -63,7 +63,7 @@ public function test_documentation_page_parser() $this->assertEquals('Foo Bar Baz', $page->title); } - public function test_html_page_parser() + public function testHtmlPageParser() { $this->file('_pages/foo.html', '

Foo Bar

'); @@ -74,21 +74,21 @@ public function test_html_page_parser() $this->assertEquals('

Foo Bar

', $page->contents()); } - public function test_parsed_page_is_run_through_dynamic_constructor() + public function testParsedPageIsRunThroughDynamicConstructor() { $this->markdown('_pages/foo.md', '# Foo Bar', ['title' => 'Foo Bar Baz']); $page = MarkdownPage::parse('foo'); $this->assertEquals('Foo Bar Baz', $page->title); } - public function test_blade_page_data_is_parsed_to_front_matter() + public function testBladePageDataIsParsedToFrontMatter() { $this->file('_pages/foo.blade.php', "@php(\$foo = 'bar')\n"); $page = BladePage::parse('foo'); $this->assertEquals('bar', $page->data('foo')); } - public function test_blade_page_matter_is_used_for_the_page_title() + public function testBladePageMatterIsUsedForThePageTitle() { $this->file('_pages/foo.blade.php', "@php(\$title = 'Foo Bar')\n"); $page = BladePage::parse('foo'); diff --git a/tests/Feature/StaticPageBuilderTest.php b/tests/Feature/StaticPageBuilderTest.php index d724259c..65cad39f 100644 --- a/tests/Feature/StaticPageBuilderTest.php +++ b/tests/Feature/StaticPageBuilderTest.php @@ -52,7 +52,7 @@ protected function validateBasicHtml(string $html) $this->assertStringContainsString('', $html); } - public function test_can_build_blade_page() + public function testCanBuildBladePage() { file_put_contents(BladePage::sourceDirectory().'/foo.blade.php', 'bar'); @@ -67,7 +67,7 @@ public function test_can_build_blade_page() Filesystem::unlink('_site/foo.html'); } - public function test_can_build_markdown_post() + public function testCanBuildMarkdownPost() { $page = MarkdownPost::make('foo', [ 'title' => 'foo', @@ -80,7 +80,7 @@ public function test_can_build_markdown_post() $this->validateBasicHtml(file_get_contents(Hyde::path('_site/posts/foo.html'))); } - public function test_can_build_markdown_page() + public function testCanBuildMarkdownPage() { $page = MarkdownPage::make('foo', [], '# Body'); @@ -91,7 +91,7 @@ public function test_can_build_markdown_page() Filesystem::unlink('_site/foo.html'); } - public function test_can_build_documentation_page() + public function testCanBuildDocumentationPage() { $page = DocumentationPage::make('foo', [], '# Body'); @@ -101,7 +101,7 @@ public function test_can_build_documentation_page() $this->validateBasicHtml(file_get_contents(Hyde::path('_site/'.'docs/foo.html'))); } - public function test_can_build_html_page() + public function testCanBuildHtmlPage() { $this->file('_pages/foo.html', 'bar'); $page = new HtmlPage('foo'); @@ -113,7 +113,7 @@ public function test_can_build_html_page() Filesystem::unlink('_site/foo.html'); } - public function test_can_build_nested_html_page() + public function testCanBuildNestedHtmlPage() { mkdir(Hyde::path('_pages/foo')); file_put_contents(Hyde::path('_pages/foo/bar.html'), 'baz'); @@ -129,7 +129,7 @@ public function test_can_build_nested_html_page() rmdir(Hyde::path('_pages/foo')); } - public function test_creates_custom_documentation_directory() + public function testCreatesCustomDocumentationDirectory() { $page = DocumentationPage::make('foo'); @@ -143,7 +143,7 @@ public function test_creates_custom_documentation_directory() Filesystem::unlink('_site/docs/foo/foo.html'); } - public function test_site_directory_can_be_customized() + public function testSiteDirectoryCanBeCustomized() { Hyde::setOutputDirectory('foo'); @@ -155,7 +155,7 @@ public function test_site_directory_can_be_customized() File::deleteDirectory(Hyde::path('foo')); } - public function test_site_directory_can_be_customized_with_nested_pages() + public function testSiteDirectoryCanBeCustomizedWithNestedPages() { Hyde::setOutputDirectory('foo'); @@ -167,7 +167,7 @@ public function test_site_directory_can_be_customized_with_nested_pages() File::deleteDirectory(Hyde::path('foo')); } - public function test_can_rebuild_blade_page() + public function testCanRebuildBladePage() { $this->file('_pages/foo.blade.php'); StaticPageBuilder::handle(Pages::getPage('_pages/foo.blade.php')); @@ -176,7 +176,7 @@ public function test_can_rebuild_blade_page() unlink(Hyde::path('_site/foo.html')); } - public function test_can_rebuild_markdown_page() + public function testCanRebuildMarkdownPage() { $this->file('_pages/foo.md'); StaticPageBuilder::handle(Pages::getPage('_pages/foo.md')); @@ -185,7 +185,7 @@ public function test_can_rebuild_markdown_page() unlink(Hyde::path('_site/foo.html')); } - public function test_can_rebuild_markdown_post() + public function testCanRebuildMarkdownPost() { $this->file('_posts/foo.md'); StaticPageBuilder::handle(Pages::getPage('_posts/foo.md')); @@ -194,7 +194,7 @@ public function test_can_rebuild_markdown_post() unlink(Hyde::path('_site/posts/foo.html')); } - public function test_can_rebuild_documentation_page() + public function testCanRebuildDocumentationPage() { $this->file('_pages/foo.md'); StaticPageBuilder::handle(Pages::getPage('_pages/foo.md')); diff --git a/tests/Feature/StaticSiteBuilderDocumentationModuleTest.php b/tests/Feature/StaticSiteBuilderDocumentationModuleTest.php index 9907fc70..807059a5 100644 --- a/tests/Feature/StaticSiteBuilderDocumentationModuleTest.php +++ b/tests/Feature/StaticSiteBuilderDocumentationModuleTest.php @@ -42,7 +42,7 @@ protected function inspectHtml(array $expectedStrings, string $path = null) } } - public function test_can_create_page() + public function testCanCreatePage() { StaticPageBuilder::handle($this->page); @@ -51,7 +51,7 @@ public function test_can_create_page() unlink(Hyde::path('_site/docs/test-page.html')); } - public function test_page_contains_expected_content() + public function testPageContainsExpectedContent() { $this->inspectHtml([ 'Adventures in Wonderland', @@ -60,7 +60,7 @@ public function test_page_contains_expected_content() ]); } - public function test_can_compile_page_to_root_output_directory() + public function testCanCompilePageToRootOutputDirectory() { DocumentationPage::setOutputDirectory(''); diff --git a/tests/Feature/StaticSiteBuilderPostModuleTest.php b/tests/Feature/StaticSiteBuilderPostModuleTest.php index 4bc2c899..b94742e9 100644 --- a/tests/Feature/StaticSiteBuilderPostModuleTest.php +++ b/tests/Feature/StaticSiteBuilderPostModuleTest.php @@ -55,14 +55,14 @@ protected function inspectHtml(array $expectedStrings) } } - public function test_can_create_post() + public function testCanCreatePost() { StaticPageBuilder::handle($this->post); $this->assertFileExists(Hyde::path('_site/posts/test-post.html')); } - public function test_post_contains_expected_content() + public function testPostContainsExpectedContent() { $this->inspectHtml([ 'Adventures in Wonderland', @@ -74,7 +74,7 @@ public function test_post_contains_expected_content() ]); } - public function test_post_contains_expected_elements() + public function testPostContainsExpectedElements() { $this->inspectHtml([ '', @@ -91,7 +91,7 @@ public function test_post_contains_expected_elements() ]); } - public function test_post_contains_expected_meta_tags() + public function testPostContainsExpectedMetaTags() { $this->inspectHtml([ '', @@ -103,7 +103,7 @@ public function test_post_contains_expected_meta_tags() ]); } - public function test_post_contains_expected_itemprops() + public function testPostContainsExpectedItemprops() { $this->inspectHtml([ 'itemtype="https://schema.org/Article"', @@ -117,7 +117,7 @@ public function test_post_contains_expected_itemprops() ]); } - public function test_post_contains_expected_aria_support() + public function testPostContainsExpectedAriaSupport() { $this->inspectHtml([ 'role="doc-pageheader"', @@ -126,7 +126,7 @@ public function test_post_contains_expected_aria_support() ]); } - public function test_post_image_is_resolved_relatively() + public function testPostImageIsResolvedRelatively() { $this->inspectHtml([ '', diff --git a/tests/Feature/StaticSiteServiceTest.php b/tests/Feature/StaticSiteServiceTest.php index c4bc8d35..7f3982b4 100644 --- a/tests/Feature/StaticSiteServiceTest.php +++ b/tests/Feature/StaticSiteServiceTest.php @@ -31,7 +31,7 @@ protected function tearDown(): void parent::tearDown(); } - public function test_build_command_contains_expected_output() + public function testBuildCommandContainsExpectedOutput() { $this->artisan('build') ->expectsOutputToContain('Building your static site') @@ -40,7 +40,7 @@ public function test_build_command_contains_expected_output() ->assertExitCode(0); } - public function test_build_command_creates_html_files() + public function testBuildCommandCreatesHtmlFiles() { $this->file('_posts/test-post.md'); @@ -51,7 +51,7 @@ public function test_build_command_creates_html_files() $this->assertFileExists(Hyde::path('_site/posts/test-post.html')); } - public function test_build_command_transfers_media_asset_files() + public function testBuildCommandTransfersMediaAssetFiles() { file_put_contents(Hyde::path('_media/test-image.png'), 'foo'); $this->artisan('build'); @@ -60,7 +60,7 @@ public function test_build_command_transfers_media_asset_files() Filesystem::unlink('_site/media/test-image.png'); } - public function test_build_command_transfers_media_asset_files_recursively() + public function testBuildCommandTransfersMediaAssetFilesRecursively() { $this->directory('_media/foo'); @@ -69,7 +69,7 @@ public function test_build_command_transfers_media_asset_files_recursively() $this->assertFileEquals(Hyde::path('_media/foo/img.png'), Hyde::path('_site/media/foo/img.png')); } - public function test_all_page_types_can_be_compiled() + public function testAllPageTypesCanBeCompiled() { $this->file('_pages/html.html'); $this->file('_pages/blade.blade.php'); @@ -99,7 +99,7 @@ public function test_all_page_types_can_be_compiled() Filesystem::unlink('_site/docs/docs.html'); } - public function test_only_progress_bars_for_types_with_pages_are_shown() + public function testOnlyProgressBarsForTypesWithPagesAreShown() { $this->file('_pages/blade.blade.php'); $this->file('_pages/markdown.md'); @@ -119,14 +119,14 @@ public function test_only_progress_bars_for_types_with_pages_are_shown() Filesystem::unlink('_site/markdown.html'); } - public function test_print_initial_information_allows_api_to_be_disabled() + public function testPrintInitialInformationAllowsApiToBeDisabled() { $this->artisan('build --no-api') ->expectsOutput('Disabling external API calls') ->assertExitCode(0); } - public function test_node_action_outputs() + public function testNodeActionOutputs() { $this->artisan('build --run-prettier --run-dev --run-prod') ->expectsOutput('Prettifying code! This may take a second.') @@ -135,14 +135,14 @@ public function test_node_action_outputs() ->assertExitCode(0); } - public function test_pretty_urls_option_output() + public function testPrettyUrlsOptionOutput() { $this->artisan('build --pretty-urls') ->expectsOutput('Generating site with pretty URLs') ->assertExitCode(0); } - public function test_sitemap_is_not_generated_when_conditions_are_not_met() + public function testSitemapIsNotGeneratedWhenConditionsAreNotMet() { config(['hyde.url' => '']); config(['hyde.generate_sitemap' => false]); @@ -152,7 +152,7 @@ public function test_sitemap_is_not_generated_when_conditions_are_not_met() ->assertExitCode(0); } - public function test_sitemap_is_generated_when_conditions_are_met() + public function testSitemapIsGeneratedWhenConditionsAreMet() { config(['hyde.url' => 'https://example.com']); config(['hyde.generate_sitemap' => true]); @@ -163,7 +163,7 @@ public function test_sitemap_is_generated_when_conditions_are_met() Filesystem::unlink('_site/sitemap.xml'); } - public function test_rss_feed_is_not_generated_when_conditions_are_not_met() + public function testRssFeedIsNotGeneratedWhenConditionsAreNotMet() { config(['hyde.url' => '']); config(['hyde.rss.enabled' => false]); @@ -173,7 +173,7 @@ public function test_rss_feed_is_not_generated_when_conditions_are_not_met() ->assertExitCode(0); } - public function test_rss_feed_is_generated_when_conditions_are_met() + public function testRssFeedIsGeneratedWhenConditionsAreMet() { config(['hyde.url' => 'https://example.com']); config(['hyde.rss.enabled' => true]); @@ -188,7 +188,7 @@ public function test_rss_feed_is_generated_when_conditions_are_met() Filesystem::unlink('_site/feed.xml'); } - public function test_does_not_generate_search_files_when_conditions_are_not_met() + public function testDoesNotGenerateSearchFilesWhenConditionsAreNotMet() { $this->artisan('build') ->doesntExpectOutput('Generating search index...') @@ -196,7 +196,7 @@ public function test_does_not_generate_search_files_when_conditions_are_not_met( ->assertExitCode(0); } - public function test_generates_search_files_when_conditions_are_met() + public function testGeneratesSearchFilesWhenConditionsAreMet() { Filesystem::touch('_docs/foo.md'); @@ -208,7 +208,7 @@ public function test_generates_search_files_when_conditions_are_met() Filesystem::unlink('_docs/foo.md'); } - public function test_site_directory_is_emptied_before_build() + public function testSiteDirectoryIsEmptiedBeforeBuild() { Filesystem::touch('_site/foo.html'); $this->artisan('build') @@ -217,7 +217,7 @@ public function test_site_directory_is_emptied_before_build() $this->assertFileDoesNotExist(Hyde::path('_site/foo.html')); } - public function test_output_directory_is_not_emptied_if_disabled_in_config() + public function testOutputDirectoryIsNotEmptiedIfDisabledInConfig() { config(['hyde.empty_output_directory' => false]); Filesystem::touch('_site/keep.html'); @@ -230,7 +230,7 @@ public function test_output_directory_is_not_emptied_if_disabled_in_config() Filesystem::unlink('_site/keep.html'); } - public function test_aborts_when_non_standard_directory_is_emptied() + public function testAbortsWhenNonStandardDirectoryIsEmptied() { Hyde::setOutputDirectory('foo'); @@ -247,14 +247,14 @@ public function test_aborts_when_non_standard_directory_is_emptied() File::deleteDirectory(Hyde::path('foo')); } - public function test_without_warnings() + public function testWithoutWarnings() { $this->artisan('build') ->doesntExpectOutput('There were some warnings during the build process:') ->assertExitCode(0); } - public function test_with_warnings() + public function testWithWarnings() { BuildWarnings::report('This is a warning'); @@ -264,7 +264,7 @@ public function test_with_warnings() ->assertExitCode(0); } - public function test_with_warnings_and_verbose() + public function testWithWarningsAndVerbose() { BuildWarnings::report('This is a warning'); @@ -275,7 +275,7 @@ public function test_with_warnings_and_verbose() ->assertExitCode(0); } - public function test_with_warnings_but_warnings_are_disabled() + public function testWithWarningsButWarningsAreDisabled() { config(['hyde.log_warnings' => false]); BuildWarnings::report('This is a warning'); @@ -285,7 +285,7 @@ public function test_with_warnings_but_warnings_are_disabled() ->assertExitCode(0); } - public function test_with_warnings_converted_to_exceptions() + public function testWithWarningsConvertedToExceptions() { config(['hyde.convert_build_warnings_to_exceptions' => true]); BuildWarnings::report('This is a warning'); diff --git a/tests/Feature/Support/MediaFileTest.php b/tests/Feature/Support/MediaFileTest.php index 9b514b1c..a320126f 100644 --- a/tests/Feature/Support/MediaFileTest.php +++ b/tests/Feature/Support/MediaFileTest.php @@ -15,7 +15,7 @@ */ class MediaFileTest extends TestCase { - public function test_can_construct() + public function testCanConstruct() { $file = new MediaFile('foo'); $this->assertInstanceOf(MediaFile::class, $file); @@ -27,41 +27,41 @@ public function can_make() $this->assertEquals(new MediaFile('foo'), MediaFile::make('foo')); } - public function test_can_construct_with_nested_paths() + public function testCanConstructWithNestedPaths() { $this->assertEquals('path/to/file.txt', MediaFile::make('path/to/file.txt')->path); } - public function test_absolute_path_is_normalized_to_relative() + public function testAbsolutePathIsNormalizedToRelative() { $this->assertEquals('foo', MediaFile::make(Hyde::path('foo'))->path); } - public function test_get_name_returns_name_of_file() + public function testGetNameReturnsNameOfFile() { $this->assertSame('foo.txt', MediaFile::make('foo.txt')->getName()); $this->assertSame('bar.txt', MediaFile::make('foo/bar.txt')->getName()); } - public function test_get_path_returns_path_of_file() + public function testGetPathReturnsPathOfFile() { $this->assertSame('foo.txt', MediaFile::make('foo.txt')->getPath()); $this->assertSame('foo/bar.txt', MediaFile::make('foo/bar.txt')->getPath()); } - public function test_get_absolute_path_returns_absolute_path_of_file() + public function testGetAbsolutePathReturnsAbsolutePathOfFile() { $this->assertSame(Hyde::path('foo.txt'), MediaFile::make('foo.txt')->getAbsolutePath()); $this->assertSame(Hyde::path('foo/bar.txt'), MediaFile::make('foo/bar.txt')->getAbsolutePath()); } - public function test_get_contents_returns_contents_of_file() + public function testGetContentsReturnsContentsOfFile() { $this->file('foo.txt', 'foo bar'); $this->assertSame('foo bar', MediaFile::make('foo.txt')->getContents()); } - public function test_get_extension_returns_extension_of_file() + public function testGetExtensionReturnsExtensionOfFile() { $this->file('foo.txt', 'foo'); $this->assertSame('txt', MediaFile::make('foo.txt')->getExtension()); @@ -70,7 +70,7 @@ public function test_get_extension_returns_extension_of_file() $this->assertSame('png', MediaFile::make('foo.png')->getExtension()); } - public function test_to_array_returns_array_of_file_properties() + public function testToArrayReturnsArrayOfFileProperties() { $this->file('foo.txt', 'foo bar'); @@ -82,7 +82,7 @@ public function test_to_array_returns_array_of_file_properties() ], MediaFile::make('foo.txt')->toArray()); } - public function test_to_array_with_empty_file_with_no_extension() + public function testToArrayWithEmptyFileWithNoExtension() { $this->file('foo', 'foo bar'); $this->assertSame([ @@ -93,7 +93,7 @@ public function test_to_array_with_empty_file_with_no_extension() ], MediaFile::make('foo')->toArray()); } - public function test_to_array_with_file_in_subdirectory() + public function testToArrayWithFileInSubdirectory() { mkdir(Hyde::path('foo')); touch(Hyde::path('foo/bar.txt')); @@ -107,19 +107,19 @@ public function test_to_array_with_file_in_subdirectory() rmdir(Hyde::path('foo')); } - public function test_getContentLength() + public function testGetContentLength() { $this->file('foo', 'Hello World!'); $this->assertSame(12, MediaFile::make('foo')->getContentLength()); } - public function test_getContentLength_with_empty_file() + public function testGetContentLengthWithEmptyFile() { $this->file('foo', ''); $this->assertSame(0, MediaFile::make('foo')->getContentLength()); } - public function test_getContentLength_with_directory() + public function testGetContentLengthWithDirectory() { $this->directory('foo'); @@ -128,50 +128,50 @@ public function test_getContentLength_with_directory() MediaFile::make('foo')->getContentLength(); } - public function test_getContentLength_with_non_existent_file() + public function testGetContentLengthWithNonExistentFile() { $this->expectException(FileNotFoundException::class); $this->expectExceptionMessage('File [foo] not found.'); MediaFile::make('foo')->getContentLength(); } - public function test_getMimeType() + public function testGetMimeType() { $this->file('foo.txt', 'Hello World!'); $this->assertSame('text/plain', MediaFile::make('foo.txt')->getMimeType()); } - public function test_getMimeType_without_extension() + public function testGetMimeTypeWithoutExtension() { $this->file('foo', 'Hello World!'); $this->assertSame('text/plain', MediaFile::make('foo')->getMimeType()); } - public function test_getMimeType_with_empty_file() + public function testGetMimeTypeWithEmptyFile() { $this->file('foo', ''); $this->assertSame('application/x-empty', MediaFile::make('foo')->getMimeType()); } - public function test_getMimeType_with_directory() + public function testGetMimeTypeWithDirectory() { $this->directory('foo'); $this->assertSame('directory', MediaFile::make('foo')->getMimeType()); } - public function test_getMimeType_with_non_existent_file() + public function testGetMimeTypeWithNonExistentFile() { $this->assertSame('text/plain', MediaFile::make('foo')->getMimeType()); } - public function test_all_helper_returns_all_media_files() + public function testAllHelperReturnsAllMediaFiles() { $this->assertEquals([ 'app.css' => new MediaFile('_media/app.css'), ], MediaFile::all()); } - public function test_all_helper_does_not_include_non_media_files() + public function testAllHelperDoesNotIncludeNonMediaFiles() { $this->file('_media/foo.blade.php'); $this->assertEquals([ @@ -179,7 +179,7 @@ public function test_all_helper_does_not_include_non_media_files() ], MediaFile::all()); } - public function test_files_helper() + public function testFilesHelper() { $this->assertSame(['app.css'], MediaFile::files()); } diff --git a/tests/Feature/Support/ProjectFileTest.php b/tests/Feature/Support/ProjectFileTest.php index e1ebb9d8..a33c0b73 100644 --- a/tests/Feature/Support/ProjectFileTest.php +++ b/tests/Feature/Support/ProjectFileTest.php @@ -14,7 +14,7 @@ */ class ProjectFileTest extends TestCase { - public function test_can_construct() + public function testCanConstruct() { $file = new ProjectFileTestClass('foo'); $this->assertInstanceOf(ProjectFileTestClass::class, $file); @@ -26,41 +26,41 @@ public function can_make() $this->assertEquals(new ProjectFileTestClass('foo'), ProjectFileTestClass::make('foo')); } - public function test_can_construct_with_nested_paths() + public function testCanConstructWithNestedPaths() { $this->assertEquals('path/to/file.txt', ProjectFileTestClass::make('path/to/file.txt')->path); } - public function test_absolute_path_is_normalized_to_relative() + public function testAbsolutePathIsNormalizedToRelative() { $this->assertEquals('foo', ProjectFileTestClass::make(Hyde::path('foo'))->path); } - public function test_get_name_returns_name_of_file() + public function testGetNameReturnsNameOfFile() { $this->assertSame('foo.txt', ProjectFileTestClass::make('foo.txt')->getName()); $this->assertSame('bar.txt', ProjectFileTestClass::make('foo/bar.txt')->getName()); } - public function test_get_path_returns_path_of_file() + public function testGetPathReturnsPathOfFile() { $this->assertSame('foo.txt', ProjectFileTestClass::make('foo.txt')->getPath()); $this->assertSame('foo/bar.txt', ProjectFileTestClass::make('foo/bar.txt')->getPath()); } - public function test_get_absolute_path_returns_absolute_path_of_file() + public function testGetAbsolutePathReturnsAbsolutePathOfFile() { $this->assertSame(Hyde::path('foo.txt'), ProjectFileTestClass::make('foo.txt')->getAbsolutePath()); $this->assertSame(Hyde::path('foo/bar.txt'), ProjectFileTestClass::make('foo/bar.txt')->getAbsolutePath()); } - public function test_get_contents_returns_contents_of_file() + public function testGetContentsReturnsContentsOfFile() { $this->file('foo.txt', 'foo bar'); $this->assertSame('foo bar', ProjectFileTestClass::make('foo.txt')->getContents()); } - public function test_get_extension_returns_extension_of_file() + public function testGetExtensionReturnsExtensionOfFile() { $this->file('foo.txt', 'foo'); $this->assertSame('txt', ProjectFileTestClass::make('foo.txt')->getExtension()); @@ -69,7 +69,7 @@ public function test_get_extension_returns_extension_of_file() $this->assertSame('png', ProjectFileTestClass::make('foo.png')->getExtension()); } - public function test_to_array_returns_array_of_file_properties() + public function testToArrayReturnsArrayOfFileProperties() { $this->file('foo.txt', 'foo bar'); @@ -79,7 +79,7 @@ public function test_to_array_returns_array_of_file_properties() ], ProjectFileTestClass::make('foo.txt')->toArray()); } - public function test_to_array_with_empty_file_with_no_extension() + public function testToArrayWithEmptyFileWithNoExtension() { $this->file('foo'); $this->assertSame([ @@ -88,7 +88,7 @@ public function test_to_array_with_empty_file_with_no_extension() ], ProjectFileTestClass::make('foo')->toArray()); } - public function test_to_array_with_file_in_subdirectory() + public function testToArrayWithFileInSubdirectory() { mkdir(Hyde::path('foo')); touch(Hyde::path('foo/bar.txt')); diff --git a/tests/Feature/Support/SourceFileTest.php b/tests/Feature/Support/SourceFileTest.php index 2b85f6e6..62dde1f5 100644 --- a/tests/Feature/Support/SourceFileTest.php +++ b/tests/Feature/Support/SourceFileTest.php @@ -16,7 +16,7 @@ */ class SourceFileTest extends TestCase { - public function test_can_construct() + public function testCanConstruct() { $file = new SourceFile('foo'); $this->assertInstanceOf(SourceFile::class, $file); @@ -25,7 +25,7 @@ public function test_can_construct() $this->assertSame(HydePage::class, $file->pageClass); } - public function test_can_construct_with_model_class() + public function testCanConstructWithModelClass() { $file = new SourceFile('foo', MarkdownPage::class); $this->assertInstanceOf(SourceFile::class, $file); @@ -39,47 +39,47 @@ public function can_make() $this->assertEquals(new SourceFile('foo'), SourceFile::make('foo')); } - public function test_can_make_with_model_class() + public function testCanMakeWithModelClass() { $this->assertEquals(new SourceFile('foo', MarkdownPage::class), SourceFile::make('foo', MarkdownPage::class)); } - public function test_can_construct_with_nested_paths() + public function testCanConstructWithNestedPaths() { $this->assertEquals('path/to/file.txt', SourceFile::make('path/to/file.txt')->path); } - public function test_absolute_path_is_normalized_to_relative() + public function testAbsolutePathIsNormalizedToRelative() { $this->assertEquals('foo', SourceFile::make(Hyde::path('foo'))->path); } - public function test_get_name_returns_name_of_file() + public function testGetNameReturnsNameOfFile() { $this->assertSame('foo.txt', SourceFile::make('foo.txt')->getName()); $this->assertSame('bar.txt', SourceFile::make('foo/bar.txt')->getName()); } - public function test_get_path_returns_path_of_file() + public function testGetPathReturnsPathOfFile() { $this->assertSame('foo.txt', SourceFile::make('foo.txt')->getPath()); $this->assertSame('foo/bar.txt', SourceFile::make('foo/bar.txt')->getPath()); } - public function test_get_absolute_path_returns_absolute_path_of_file() + public function testGetAbsolutePathReturnsAbsolutePathOfFile() { $this->assertSame(Hyde::path('foo.txt'), SourceFile::make('foo.txt')->getAbsolutePath()); $this->assertSame(Hyde::path('foo/bar.txt'), SourceFile::make('foo/bar.txt')->getAbsolutePath()); } - public function test_get_contents_returns_contents_of_file() + public function testGetContentsReturnsContentsOfFile() { $this->file('foo.txt', 'foo bar'); $this->assertSame('foo bar', SourceFile::make('foo.txt')->getContents()); } - public function test_get_extension_returns_extension_of_file() + public function testGetExtensionReturnsExtensionOfFile() { $this->file('foo.txt', 'foo'); $this->assertSame('txt', SourceFile::make('foo.txt')->getExtension()); @@ -88,7 +88,7 @@ public function test_get_extension_returns_extension_of_file() $this->assertSame('png', SourceFile::make('foo.png')->getExtension()); } - public function test_to_array_returns_array_of_file_properties() + public function testToArrayReturnsArrayOfFileProperties() { $this->file('foo.txt', 'foo bar'); @@ -99,7 +99,7 @@ public function test_to_array_returns_array_of_file_properties() ], SourceFile::make('foo.txt')->toArray()); } - public function test_to_array_with_empty_file_with_no_extension() + public function testToArrayWithEmptyFileWithNoExtension() { $this->file('foo'); $this->assertSame([ @@ -109,7 +109,7 @@ public function test_to_array_with_empty_file_with_no_extension() ], SourceFile::make('foo')->toArray()); } - public function test_to_array_with_file_in_subdirectory() + public function testToArrayWithFileInSubdirectory() { mkdir(Hyde::path('foo')); touch(Hyde::path('foo/bar.txt')); diff --git a/tests/Unit/BaseFoundationCollectionTest.php b/tests/Unit/BaseFoundationCollectionTest.php index 2156d74e..9fb8edb7 100644 --- a/tests/Unit/BaseFoundationCollectionTest.php +++ b/tests/Unit/BaseFoundationCollectionTest.php @@ -15,7 +15,7 @@ */ class BaseFoundationCollectionTest extends UnitTestCase { - public function test_init() + public function testInit() { $this->needsKernel(); @@ -28,19 +28,19 @@ public function test_init() $this->assertTrue($booted->isDiscovered()); } - public function test_exceptions_are_caught_and_rethrown_as_runtime_exceptions() + public function testExceptionsAreCaughtAndRethrownAsRuntimeExceptions() { $this->expectException(RuntimeException::class); ThrowingBaseFoundationCollectionTestClass::init(HydeKernel::getInstance())->boot(); } - public function test_exceptions_are_caught_and_rethrown_with_helpful_information() + public function testExceptionsAreCaughtAndRethrownWithHelpfulInformation() { $this->expectException(RuntimeException::class); ThrowingBaseFoundationCollectionTestClass::init(HydeKernel::getInstance())->boot(); } - public function test_can_get_previous_exception() + public function testCanGetPreviousException() { try { ThrowingBaseFoundationCollectionTestClass::init(HydeKernel::getInstance())->boot(); diff --git a/tests/Unit/BlogPostFrontMatterIsOptionalTest.php b/tests/Unit/BlogPostFrontMatterIsOptionalTest.php index 2b2366fe..b90fe0a0 100644 --- a/tests/Unit/BlogPostFrontMatterIsOptionalTest.php +++ b/tests/Unit/BlogPostFrontMatterIsOptionalTest.php @@ -13,7 +13,7 @@ class BlogPostFrontMatterIsOptionalTest extends TestCase { - public function test_blog_post_can_be_created_without_front_matter() + public function testBlogPostCanBeCreatedWithoutFrontMatter() { file_put_contents(Hyde::path('_posts/test-post.md'), '# My New Post'); @@ -25,7 +25,7 @@ public function test_blog_post_can_be_created_without_front_matter() Filesystem::unlink('_site/posts/test-post.html'); } - public function test_blog_post_feed_can_be_rendered_when_post_has_no_front_matter() + public function testBlogPostFeedCanBeRenderedWhenPostHasNoFrontMatter() { file_put_contents(Hyde::path('_posts/test-post.md'), '# My New Post'); diff --git a/tests/Unit/BuildOutputDirectoryCanBeChangedTest.php b/tests/Unit/BuildOutputDirectoryCanBeChangedTest.php index 1cf82bb0..6bd0380a 100644 --- a/tests/Unit/BuildOutputDirectoryCanBeChangedTest.php +++ b/tests/Unit/BuildOutputDirectoryCanBeChangedTest.php @@ -16,7 +16,7 @@ */ class BuildOutputDirectoryCanBeChangedTest extends TestCase { - public function test_site_output_directory_can_be_changed_for_site_builds() + public function testSiteOutputDirectoryCanBeChangedForSiteBuilds() { $this->file('_posts/test-post.md'); @@ -32,7 +32,7 @@ public function test_site_output_directory_can_be_changed_for_site_builds() File::deleteDirectory(Hyde::path('_site/build')); } - public function test_site_output_directory_can_be_changed_in_static_page_builder() + public function testSiteOutputDirectoryCanBeChangedInStaticPageBuilder() { $this->file('_posts/test-post.md'); @@ -45,7 +45,7 @@ public function test_site_output_directory_can_be_changed_in_static_page_builder File::deleteDirectory(Hyde::path('_site/build')); } - public function test_output_directory_is_created_if_it_does_not_exist_in_static_page_builder() + public function testOutputDirectoryIsCreatedIfItDoesNotExistInStaticPageBuilder() { $this->file('_posts/test-post.md'); File::deleteDirectory(Hyde::path('_site/build/foo')); @@ -56,7 +56,7 @@ public function test_output_directory_is_created_if_it_does_not_exist_in_static_ File::deleteDirectory(Hyde::path('_site/build/foo')); } - public function test_site_output_directory_can_be_changed_in_configuration() + public function testSiteOutputDirectoryCanBeChangedInConfiguration() { $this->assertEquals('_site', Hyde::kernel()->getOutputDirectory()); @@ -72,7 +72,7 @@ public function test_site_output_directory_can_be_changed_in_configuration() File::deleteDirectory(Hyde::path('_site/build')); } - public function test_site_output_directory_path_is_normalized_to_trim_trailing_slashes() + public function testSiteOutputDirectoryPathIsNormalizedToTrimTrailingSlashes() { Hyde::setOutputDirectory('foo/bar/'); $this->assertEquals('foo/bar', Hyde::kernel()->getOutputDirectory()); diff --git a/tests/Unit/ConfigFileTest.php b/tests/Unit/ConfigFileTest.php index 4661a36c..8ea6dda5 100644 --- a/tests/Unit/ConfigFileTest.php +++ b/tests/Unit/ConfigFileTest.php @@ -23,22 +23,22 @@ class ConfigFileTest extends UnitTestCase protected static bool $needsKernel = true; protected static bool $needsConfig = true; - public function test_default_output_directory_value_matches_declared_value() + public function testDefaultOutputDirectoryValueMatchesDeclaredValue() { expect($this->getConfig('output_directory'))->toBe(Hyde::getOutputDirectory()); } - public function test_default_media_directory_value_matches_declared_value() + public function testDefaultMediaDirectoryValueMatchesDeclaredValue() { expect($this->getConfig('media_directory'))->toBe(Hyde::getMediaDirectory()); } - public function test_default_source_root_value_matches_declared_value() + public function testDefaultSourceRootValueMatchesDeclaredValue() { expect($this->getConfig('source_root'))->toBe(Hyde::getSourceRoot()); } - public function test_default_source_directories_values_match_declared_values() + public function testDefaultSourceDirectoriesValuesMatchDeclaredValues() { expect($this->getConfig('source_directories'))->toBe([ HtmlPage::class => '_pages', @@ -49,7 +49,7 @@ public function test_default_source_directories_values_match_declared_values() ]); } - public function test_default_source_directories_values_cover_all_core_extension_classes() + public function testDefaultSourceDirectoriesValuesCoverAllCoreExtensionClasses() { expect($this->getConfig('source_directories'))->toBe(collect(HydeCoreExtension::getPageClasses()) ->mapWithKeys(fn ($pageClass) => [$pageClass => $pageClass::sourceDirectory()]) @@ -57,7 +57,7 @@ public function test_default_source_directories_values_cover_all_core_extension_ ); } - public function test_default_output_directories_values_match_declared_values() + public function testDefaultOutputDirectoriesValuesMatchDeclaredValues() { expect($this->getConfig('output_directories'))->toBe([ HtmlPage::class => '', @@ -68,7 +68,7 @@ public function test_default_output_directories_values_match_declared_values() ]); } - public function test_default_output_directories_values_cover_all_core_extension_classes() + public function testDefaultOutputDirectoriesValuesCoverAllCoreExtensionClasses() { expect($this->getConfig('output_directories'))->toBe(collect(HydeCoreExtension::getPageClasses()) ->mapWithKeys(fn ($pageClass) => [$pageClass => $pageClass::outputDirectory()]) @@ -76,7 +76,7 @@ public function test_default_output_directories_values_cover_all_core_extension_ ); } - public function test_default_features_array_matches_default_features() + public function testDefaultFeaturesArrayMatchesDefaultFeatures() { expect($this->getConfig('features')) ->toBe((new ReflectionClass(Features::class))->getMethod('getDefaultOptions')->invoke(null)); diff --git a/tests/Unit/DocumentationPageTest.php b/tests/Unit/DocumentationPageTest.php index 733d96dc..b725e594 100644 --- a/tests/Unit/DocumentationPageTest.php +++ b/tests/Unit/DocumentationPageTest.php @@ -22,19 +22,19 @@ */ class DocumentationPageTest extends TestCase { - public function test_can_generate_table_of_contents() + public function testCanGenerateTableOfContents() { $page = DocumentationPage::make(markdown: '# Foo'); $this->assertIsString($page->getTableOfContents()); } - public function test_can_get_current_page_path() + public function testCanGetCurrentPagePath() { $page = DocumentationPage::make('foo'); $this->assertEquals('docs/foo', $page->getRouteKey()); } - public function test_can_get_current_custom_page_path() + public function testCanGetCurrentCustomPagePath() { config(['hyde.output_directories.documentation-page' => 'documentation/latest/']); (new HydeServiceProvider($this->app))->register(); @@ -43,7 +43,7 @@ public function test_can_get_current_custom_page_path() $this->assertEquals('documentation/latest/foo', $page->getRouteKey()); } - public function test_can_get_current_page_path_when_using_flattened_output_paths() + public function testCanGetCurrentPagePathWhenUsingFlattenedOutputPaths() { Config::set('docs.flattened_output_paths', true); @@ -57,7 +57,7 @@ public function test_can_get_current_page_path_when_using_flattened_output_paths $this->assertEquals('documentation/latest/bar', $page->getRouteKey()); } - public function test_can_get_current_page_path_when_not_using_flattened_output_paths() + public function testCanGetCurrentPagePathWhenNotUsingFlattenedOutputPaths() { Config::set('docs.flattened_output_paths', false); @@ -71,20 +71,20 @@ public function test_can_get_current_page_path_when_not_using_flattened_output_p $this->assertEquals('documentation/latest/foo/bar', $page->getRouteKey()); } - public function test_can_get_online_source_path() + public function testCanGetOnlineSourcePath() { $page = DocumentationPage::make('foo'); $this->assertFalse($page->getOnlineSourcePath()); } - public function test_can_get_online_source_path_with_source_file_location_base() + public function testCanGetOnlineSourcePathWithSourceFileLocationBase() { config(['docs.source_file_location_base' => 'docs.example.com/edit']); $page = DocumentationPage::make('foo'); $this->assertEquals('docs.example.com/edit/foo.md', $page->getOnlineSourcePath()); } - public function test_can_get_online_source_path_with_trailing_slash() + public function testCanGetOnlineSourcePathWithTrailingSlash() { $page = DocumentationPage::make('foo'); @@ -95,19 +95,19 @@ public function test_can_get_online_source_path_with_trailing_slash() $this->assertEquals('edit/foo.md', $page->getOnlineSourcePath()); } - public function test_can_get_documentation_output_path() + public function testCanGetDocumentationOutputPath() { $this->assertEquals('docs', DocumentationPage::outputDirectory()); } - public function test_can_get_documentation_output_path_with_custom_output_directory() + public function testCanGetDocumentationOutputPathWithCustomOutputDirectory() { config(['hyde.output_directories.documentation-page' => 'foo']); (new HydeServiceProvider($this->app))->register(); $this->assertEquals('foo', DocumentationPage::outputDirectory()); } - public function test_can_get_documentation_output_path_with_trailing_slashes() + public function testCanGetDocumentationOutputPathWithTrailingSlashes() { $tests = [ 'foo', @@ -124,7 +124,7 @@ public function test_can_get_documentation_output_path_with_trailing_slashes() } } - public function test_get_source_path_returns_qualified_basename() + public function testGetSourcePathReturnsQualifiedBasename() { $this->assertEquals( DocumentationPage::sourcePath('foo'), @@ -132,7 +132,7 @@ public function test_get_source_path_returns_qualified_basename() ); } - public function test_get_source_path_returns_qualified_basename_for_nested_page() + public function testGetSourcePathReturnsQualifiedBasenameForNestedPage() { $this->assertEquals( DocumentationPage::sourcePath('foo/bar'), @@ -140,12 +140,12 @@ public function test_get_source_path_returns_qualified_basename_for_nested_page( ); } - public function test_home_method_returns_null_when_there_is_no_index_page() + public function testHomeMethodReturnsNullWhenThereIsNoIndexPage() { $this->assertNull(DocumentationPage::home()); } - public function test_home_method_returns_docs_index_route_when_it_exists() + public function testHomeMethodReturnsDocsIndexRouteWhenItExists() { Filesystem::touch('_docs/index.md'); $this->assertInstanceOf(Route::class, DocumentationPage::home()); @@ -153,7 +153,7 @@ public function test_home_method_returns_docs_index_route_when_it_exists() Filesystem::unlink('_docs/index.md'); } - public function test_home_method_finds_docs_index_for_custom_output_directory() + public function testHomeMethodFindsDocsIndexForCustomOutputDirectory() { config(['hyde.output_directories.documentation-page' => 'foo']); (new HydeServiceProvider($this->app))->register(); @@ -165,7 +165,7 @@ public function test_home_method_finds_docs_index_for_custom_output_directory() File::deleteDirectory(Hyde::path('foo')); } - public function test_home_method_finds_docs_index_for_custom_nested_output_directory() + public function testHomeMethodFindsDocsIndexForCustomNestedOutputDirectory() { config(['hyde.output_directories.documentation-page' => 'foo/bar']); (new HydeServiceProvider($this->app))->register(); @@ -178,12 +178,12 @@ public function test_home_method_finds_docs_index_for_custom_nested_output_direc File::deleteDirectory(Hyde::path('foo')); } - public function test_home_route_name_method_returns_output_directory_slash_index() + public function testHomeRouteNameMethodReturnsOutputDirectorySlashIndex() { $this->assertSame('docs/index', DocumentationPage::homeRouteName()); } - public function test_home_route_name_method_returns_customized_output_directory_slash_index() + public function testHomeRouteNameMethodReturnsCustomizedOutputDirectorySlashIndex() { config(['hyde.output_directories.documentation-page' => 'foo/bar']); (new HydeServiceProvider($this->app))->register(); @@ -191,7 +191,7 @@ public function test_home_route_name_method_returns_customized_output_directory_ $this->assertSame('foo/bar/index', DocumentationPage::homeRouteName()); } - public function test_has_table_of_contents() + public function testHasTableOfContents() { $this->assertIsBool(DocumentationPage::hasTableOfContents()); @@ -202,27 +202,27 @@ public function test_has_table_of_contents() $this->assertFalse(DocumentationPage::hasTableOfContents()); } - public function test_compiled_pages_originating_in_subdirectories_get_output_to_root_docs_path() + public function testCompiledPagesOriginatingInSubdirectoriesGetOutputToRootDocsPath() { $page = DocumentationPage::make('foo/bar'); $this->assertEquals('docs/bar.html', $page->getOutputPath()); } - public function test_compiled_pages_originating_in_subdirectories_get_output_to_root_docs_path_when_using_flattened_output_paths() + public function testCompiledPagesOriginatingInSubdirectoriesGetOutputToRootDocsPathWhenUsingFlattenedOutputPaths() { Config::set('docs.flattened_output_paths', true); $page = DocumentationPage::make('foo/bar'); $this->assertEquals('docs/bar.html', $page->getOutputPath()); } - public function test_compiled_pages_originating_in_subdirectories_retain_subdirectory_structure_when_not_using_flattened_output_paths() + public function testCompiledPagesOriginatingInSubdirectoriesRetainSubdirectoryStructureWhenNotUsingFlattenedOutputPaths() { Config::set('docs.flattened_output_paths', false); $page = DocumentationPage::make('foo/bar'); $this->assertEquals('docs/foo/bar.html', $page->getOutputPath()); } - public function test_page_has_front_matter() + public function testPageHasFrontMatter() { $this->markdown('_docs/foo.md', matter: $expected = [ 'foo' => 'bar', @@ -236,7 +236,7 @@ public function test_page_has_front_matter() $this->assertEquals(new FrontMatter($expected), $page->matter()); } - public function test_page_can_be_hidden_from_sidebar_using_front_matter() + public function testPageCanBeHiddenFromSidebarUsingFrontMatter() { $this->markdown('_docs/foo.md', matter: [ 'navigation' => [ @@ -247,14 +247,14 @@ public function test_page_can_be_hidden_from_sidebar_using_front_matter() $this->assertFalse($page->showInNavigation()); } - public function test_page_is_visible_in_sidebar_without_using_front_matter() + public function testPageIsVisibleInSidebarWithoutUsingFrontMatter() { $this->markdown('_docs/foo.md'); $page = DocumentationPage::parse('foo'); $this->assertTrue($page->showInNavigation()); } - public function test_page_can_set_sidebar_priority_using_front_matter() + public function testPageCanSetSidebarPriorityUsingFrontMatter() { $this->file('_docs/foo.md', '--- navigation: @@ -265,7 +265,7 @@ public function test_page_can_set_sidebar_priority_using_front_matter() $this->assertEquals(10, $page->navigationMenuPriority()); } - public function test_page_can_set_sidebar_label_using_front_matter() + public function testPageCanSetSidebarLabelUsingFrontMatter() { $this->file('_docs/foo.md', '--- navigation: diff --git a/tests/Unit/ExtensionsUnitTest.php b/tests/Unit/ExtensionsUnitTest.php index 3eb2b92e..60b7653d 100644 --- a/tests/Unit/ExtensionsUnitTest.php +++ b/tests/Unit/ExtensionsUnitTest.php @@ -189,12 +189,12 @@ public function testRouteHandlerDependencyInjection() RouteCollection::init($this->kernel)->boot(); } - public function test_get_registered_page_classes_returns_core_extension_classes() + public function testGetRegisteredPageClassesReturnsCoreExtensionClasses() { $this->assertSame(HydeCoreExtension::getPageClasses(), $this->kernel->getRegisteredPageClasses()); } - public function test_get_registered_page_classes_merges_all_extension_classes() + public function testGetRegisteredPageClassesMergesAllExtensionClasses() { $this->kernel->registerExtension(HydeTestExtension::class); @@ -204,7 +204,7 @@ public function test_get_registered_page_classes_merges_all_extension_classes() ); } - public function test_merged_registered_page_classes_array_contents() + public function testMergedRegisteredPageClassesArrayContents() { $this->assertSame([ HtmlPage::class, diff --git a/tests/Unit/Facades/AssetFacadeTest.php b/tests/Unit/Facades/AssetFacadeTest.php index 0dbd09e7..df8344a3 100644 --- a/tests/Unit/Facades/AssetFacadeTest.php +++ b/tests/Unit/Facades/AssetFacadeTest.php @@ -13,17 +13,17 @@ */ class AssetFacadeTest extends TestCase { - public function test_asset_facade_returns_the_asset_service() + public function testAssetFacadeReturnsTheAssetService() { $this->assertInstanceOf(AssetService::class, Asset::getFacadeRoot()); } - public function test_facade_returns_same_instance_as_bound_by_the_container() + public function testFacadeReturnsSameInstanceAsBoundByTheContainer() { $this->assertSame(Asset::getFacadeRoot(), app(AssetService::class)); } - public function test_asset_facade_can_call_methods_on_the_asset_service() + public function testAssetFacadeCanCallMethodsOnTheAssetService() { $service = new AssetService(); $this->assertEquals($service->version(), Asset::version()); diff --git a/tests/Unit/Facades/HydeFacadesAreAliasedInAppConfigTest.php b/tests/Unit/Facades/HydeFacadesAreAliasedInAppConfigTest.php index 0aab7438..132e7bda 100644 --- a/tests/Unit/Facades/HydeFacadesAreAliasedInAppConfigTest.php +++ b/tests/Unit/Facades/HydeFacadesAreAliasedInAppConfigTest.php @@ -9,7 +9,7 @@ class HydeFacadesAreAliasedInAppConfigTest extends TestCase { - public function test_all_facades_are_aliased_in_app_config() + public function testAllFacadesAreAliasedInAppConfig() { $this->assertArrayHasKey('Hyde', config('app.aliases')); diff --git a/tests/Unit/FileConflictExceptionTest.php b/tests/Unit/FileConflictExceptionTest.php index 50f6ce98..13116df2 100644 --- a/tests/Unit/FileConflictExceptionTest.php +++ b/tests/Unit/FileConflictExceptionTest.php @@ -13,35 +13,35 @@ */ class FileConflictExceptionTest extends UnitTestCase { - public function test_it_can_be_instantiated() + public function testItCanBeInstantiated() { $this->assertInstanceOf(FileConflictException::class, new FileConflictException()); } - public function test_it_can_be_thrown() + public function testItCanBeThrown() { $this->expectException(FileConflictException::class); throw new FileConflictException(); } - public function test_exception_code() + public function testExceptionCode() { $this->assertSame(409, (new FileConflictException())->getCode()); } - public function test_exception_message() + public function testExceptionMessage() { $this->assertSame('A file already exists at this path.', (new FileConflictException())->getMessage()); } - public function test_exception_message_with_path() + public function testExceptionMessageWithPath() { HydeKernel::setInstance(new HydeKernel('my-base-path')); $this->assertSame('File [path/to/file] already exists.', (new FileConflictException('path/to/file'))->getMessage()); } - public function test_exception_message_with_absolute_path() + public function testExceptionMessageWithAbsolutePath() { HydeKernel::setInstance(new HydeKernel('my-base-path')); $this->assertSame('File [path/to/file] already exists.', (new FileConflictException('my-base-path/path/to/file'))->getMessage()); diff --git a/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php b/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php index 902d9dc5..2c4ad100 100644 --- a/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php +++ b/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php @@ -18,87 +18,87 @@ public static function setUpBeforeClass(): void self::mockConfig(); } - public function test_helper_returns_string_as_is_if_pretty_urls_is_not_true() + public function testHelperReturnsStringAsIsIfPrettyUrlsIsNotTrue() { self::mockConfig(['hyde.pretty_urls' => false]); $this->assertEquals('foo/bar.html', Hyde::formatLink('foo/bar.html')); } - public function test_helper_returns_pretty_url_if_pretty_urls_is_true() + public function testHelperReturnsPrettyUrlIfPrettyUrlsIsTrue() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('foo/bar', Hyde::formatLink('foo/bar.html')); } - public function test_helper_respects_absolute_urls() + public function testHelperRespectsAbsoluteUrls() { self::mockConfig(['hyde.pretty_urls' => false]); $this->assertEquals('/foo/bar.html', Hyde::formatLink('/foo/bar.html')); } - public function test_helper_respects_pretty_absolute_urls() + public function testHelperRespectsPrettyAbsoluteUrls() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('/foo/bar', Hyde::formatLink('/foo/bar.html')); } - public function test_helper_respects_relative_urls() + public function testHelperRespectsRelativeUrls() { self::mockConfig(['hyde.pretty_urls' => false]); $this->assertEquals('../foo/bar.html', Hyde::formatLink('../foo/bar.html')); } - public function test_helper_respects_pretty_relative_urls() + public function testHelperRespectsPrettyRelativeUrls() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('../foo/bar', Hyde::formatLink('../foo/bar.html')); } - public function test_non_html_links_are_not_modified() + public function testNonHtmlLinksAreNotModified() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('/foo/bar.jpg', Hyde::formatLink('/foo/bar.jpg')); } - public function test_helper_respects_absolute_urls_with_pretty_urls_enabled() + public function testHelperRespectsAbsoluteUrlsWithPrettyUrlsEnabled() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('/foo/bar.jpg', Hyde::formatLink('/foo/bar.jpg')); } - public function test_helper_rewrites_index_when_using_pretty_urls() + public function testHelperRewritesIndexWhenUsingPrettyUrls() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('/', Hyde::formatLink('index.html')); } - public function test_helper_does_not_rewrite_index_when_not_using_pretty_urls() + public function testHelperDoesNotRewriteIndexWhenNotUsingPrettyUrls() { self::mockConfig(['hyde.pretty_urls' => false]); $this->assertEquals('index.html', Hyde::formatLink('index.html')); } - public function test_helper_rewrites_documentation_page_index_when_using_pretty_urls() + public function testHelperRewritesDocumentationPageIndexWhenUsingPrettyUrls() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('docs/', Hyde::formatLink('docs/index.html')); } - public function test_helper_does_not_rewrite_documentation_page_index_when_not_using_pretty_urls() + public function testHelperDoesNotRewriteDocumentationPageIndexWhenNotUsingPrettyUrls() { self::mockConfig(['hyde.pretty_urls' => false]); $this->assertEquals('docs/index.html', Hyde::formatLink('docs/index.html')); } - public function test_helpers_rewrites_arbitrary_nested_index_pages_when_using_pretty_urls() + public function testHelpersRewritesArbitraryNestedIndexPagesWhenUsingPrettyUrls() { self::mockConfig(['hyde.pretty_urls' => true]); $this->assertEquals('foo/bar/', Hyde::formatLink('foo/bar/index.html')); } - public function test_helpers_does_not_rewrite_arbitrary_nested_index_pages_when_not_using_pretty_urls() + public function testHelpersDoesNotRewriteArbitraryNestedIndexPagesWhenNotUsingPrettyUrls() { self::mockConfig(['hyde.pretty_urls' => false]); $this->assertEquals('foo/bar/index.html', Hyde::formatLink('foo/bar/index.html')); diff --git a/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php b/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php index 8a400d7a..8da15364 100644 --- a/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php +++ b/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php @@ -24,43 +24,43 @@ protected function setUp(): void $this->class = new Hyperlinks(HydeKernel::getInstance()); } - public function test_has_site_url_returns_false_when_no_site_url_is_set() + public function testHasSiteUrlReturnsFalseWhenNoSiteUrlIsSet() { config(['hyde.url' => null]); $this->assertFalse($this->class->hasSiteUrl()); } - public function test_has_site_url_returns_true_when_site_url_is_set() + public function testHasSiteUrlReturnsTrueWhenSiteUrlIsSet() { config(['hyde.url' => 'https://example.com']); $this->assertTrue($this->class->hasSiteUrl()); } - public function test_qualified_url_returns_site_url_when_no_path_is_given() + public function testQualifiedUrlReturnsSiteUrlWhenNoPathIsGiven() { config(['hyde.url' => 'https://example.com']); $this->assertEquals('https://example.com', $this->class->url()); } - public function test_qualified_url_returns_site_url_plus_given_path() + public function testQualifiedUrlReturnsSiteUrlPlusGivenPath() { config(['hyde.url' => 'https://example.com']); $this->assertEquals('https://example.com/path', $this->class->url('path')); } - public function test_qualified_url_returns_site_url_plus_given_path_with_extension() + public function testQualifiedUrlReturnsSiteUrlPlusGivenPathWithExtension() { config(['hyde.url' => 'https://example.com']); $this->assertEquals('https://example.com/path.html', $this->class->url('path.html')); } - public function test_qualified_url_returns_site_url_plus_given_path_with_extension_and_query_string() + public function testQualifiedUrlReturnsSiteUrlPlusGivenPathWithExtensionAndQueryString() { config(['hyde.url' => 'https://example.com']); $this->assertEquals('https://example.com/path.html?query=string', $this->class->url('path.html?query=string')); } - public function test_qualified_url_trims_trailing_slashes() + public function testQualifiedUrlTrimsTrailingSlashes() { config(['hyde.url' => 'https://example.com/']); $this->assertEquals('https://example.com', $this->class->url()); @@ -68,13 +68,13 @@ public function test_qualified_url_trims_trailing_slashes() $this->assertEquals('https://example.com/foo', $this->class->url('/foo/')); } - public function test_qualified_url_accepts_multiple_schemes() + public function testQualifiedUrlAcceptsMultipleSchemes() { config(['hyde.url' => 'http://example.com']); $this->assertEquals('http://example.com', $this->class->url()); } - public function test_qualified_url_throws_exception_when_no_site_url_is_set() + public function testQualifiedUrlThrowsExceptionWhenNoSiteUrlIsSet() { config(['hyde.url' => null]); $this->expectException(BaseUrlNotSetException::class); @@ -82,13 +82,13 @@ public function test_qualified_url_throws_exception_when_no_site_url_is_set() $this->class->url(); } - public function test_helper_returns_expected_string_when_site_url_is_set() + public function testHelperReturnsExpectedStringWhenSiteUrlIsSet() { config(['hyde.url' => 'https://example.com']); $this->assertEquals('https://example.com/foo/bar.html', $this->class->url('foo/bar.html')); } - public function test_helper_returns_expected_string_when_pretty_urls_are_enabled() + public function testHelperReturnsExpectedStringWhenPrettyUrlsAreEnabled() { config(['hyde.url' => 'https://example.com', 'hyde.pretty_urls' => true]); $this->assertEquals('https://example.com', $this->class->url('index.html')); diff --git a/tests/Unit/GenerateBuildManifestTest.php b/tests/Unit/GenerateBuildManifestTest.php index 4892244e..f3ffc9fd 100644 --- a/tests/Unit/GenerateBuildManifestTest.php +++ b/tests/Unit/GenerateBuildManifestTest.php @@ -21,7 +21,7 @@ public static function setUpBeforeClass(): void self::mockConfig(); } - public function test_action_generates_build_manifest() + public function testActionGeneratesBuildManifest() { (new GenerateBuildManifest())->handle(); diff --git a/tests/Unit/GetLatestMarkdownPostsTest.php b/tests/Unit/GetLatestMarkdownPostsTest.php index 7511e342..5cbfb808 100644 --- a/tests/Unit/GetLatestMarkdownPostsTest.php +++ b/tests/Unit/GetLatestMarkdownPostsTest.php @@ -15,7 +15,7 @@ */ class GetLatestMarkdownPostsTest extends TestCase { - public function test_markdown_page_get_latest_helper_returns_sorted_markdown_page_collection() + public function testMarkdownPageGetLatestHelperReturnsSortedMarkdownPageCollection() { file_put_contents(Hyde::path('_posts/new.md'), "---\ndate: '2022-01-01 12:00'\n---\n"); file_put_contents(Hyde::path('_posts/old.md'), "---\ndate: '2021-01-01 12:00'\n---\n"); diff --git a/tests/Unit/HydeBasePathCanBeChangedTest.php b/tests/Unit/HydeBasePathCanBeChangedTest.php index 3eff9f91..9e40d9ff 100644 --- a/tests/Unit/HydeBasePathCanBeChangedTest.php +++ b/tests/Unit/HydeBasePathCanBeChangedTest.php @@ -34,7 +34,7 @@ protected function tearDown(): void parent::tearDown(); } - public function test_hyde_base_path_can_be_changed() + public function testHydeBasePathCanBeChanged() { Hyde::setBasePath('/foo/bar'); $this->assertEquals('/foo/bar', Hyde::getBasePath()); diff --git a/tests/Unit/HydeConfigFilesAreMatchingTest.php b/tests/Unit/HydeConfigFilesAreMatchingTest.php index a056cefe..ff906d2c 100644 --- a/tests/Unit/HydeConfigFilesAreMatchingTest.php +++ b/tests/Unit/HydeConfigFilesAreMatchingTest.php @@ -23,7 +23,7 @@ protected function setUp(): void } } - public function test_hyde_config_files_are_matching() + public function testHydeConfigFilesAreMatching() { $this->assertFileEqualsIgnoringNewlineType( Hyde::path('config/hyde.php'), @@ -31,7 +31,7 @@ public function test_hyde_config_files_are_matching() ); } - public function test_docs_config_files_are_matching() + public function testDocsConfigFilesAreMatching() { $this->assertFileEqualsIgnoringNewlineType( Hyde::path('config/docs.php'), @@ -39,7 +39,7 @@ public function test_docs_config_files_are_matching() ); } - public function test_markdown_config_files_are_matching() + public function testMarkdownConfigFilesAreMatching() { $this->assertFileEqualsIgnoringNewlineType( Hyde::path('config/markdown.php'), diff --git a/tests/Unit/HydeFileHelpersTest.php b/tests/Unit/HydeFileHelpersTest.php index b451d58c..b5838e93 100644 --- a/tests/Unit/HydeFileHelpersTest.php +++ b/tests/Unit/HydeFileHelpersTest.php @@ -14,24 +14,24 @@ */ class HydeFileHelpersTest extends TestCase { - public function test_current_page_returns_current_page_view_property() + public function testCurrentPageReturnsCurrentPageViewProperty() { Render::share('routeKey', 'foo'); $this->assertEquals('foo', Hyde::currentRouteKey()); } - public function test_current_page_falls_back_to_empty_string_if_current_page_view_property_is_not_set() + public function testCurrentPageFallsBackToEmptyStringIfCurrentPageViewPropertyIsNotSet() { $this->assertEquals('', Hyde::currentRouteKey()); } - public function test_current_route_returns_current_route_view_property() + public function testCurrentRouteReturnsCurrentRouteViewProperty() { Render::share('route', Routes::get('index')); $this->assertEquals(Routes::get('index'), Hyde::currentRoute()); } - public function test_current_route_falls_back_to_null_if_current_route_view_property_is_not_set() + public function testCurrentRouteFallsBackToNullIfCurrentRouteViewPropertyIsNotSet() { $this->assertNull(Hyde::currentRoute()); } diff --git a/tests/Unit/HydeGetBasePathHasFallbackTest.php b/tests/Unit/HydeGetBasePathHasFallbackTest.php index cdb7eb66..dab5596d 100644 --- a/tests/Unit/HydeGetBasePathHasFallbackTest.php +++ b/tests/Unit/HydeGetBasePathHasFallbackTest.php @@ -14,7 +14,7 @@ */ class HydeGetBasePathHasFallbackTest extends TestCase { - public function test_hyde_get_base_path_falls_back_to_getcwd() + public function testHydeGetBasePathFallsBackToGetcwd() { $mock = new class extends Hyde { diff --git a/tests/Unit/HydeHelperFacadeTest.php b/tests/Unit/HydeHelperFacadeTest.php index e8ca9eb8..d4780b1f 100644 --- a/tests/Unit/HydeHelperFacadeTest.php +++ b/tests/Unit/HydeHelperFacadeTest.php @@ -13,7 +13,7 @@ */ class HydeHelperFacadeTest extends TestCase { - public function test_features_facade_returns_instance_of_features_class() + public function testFeaturesFacadeReturnsInstanceOfFeaturesClass() { $this->assertInstanceOf( Features::class, @@ -21,14 +21,14 @@ public function test_features_facade_returns_instance_of_features_class() ); } - public function test_features_facade_can_be_used_to_call_static_methods_on_features_class() + public function testFeaturesFacadeCanBeUsedToCallStaticMethodsOnFeaturesClass() { $this->assertTrue( Hyde::features()->hasMarkdownPosts() ); } - public function test_hyde_has_feature_shorthand_calls_static_method_on_features_class() + public function testHydeHasFeatureShorthandCallsStaticMethodOnFeaturesClass() { $this->assertTrue( Hyde::hasFeature('markdown-posts') diff --git a/tests/Unit/HydeVendorPathHelperTest.php b/tests/Unit/HydeVendorPathHelperTest.php index 49628d4c..21959d72 100644 --- a/tests/Unit/HydeVendorPathHelperTest.php +++ b/tests/Unit/HydeVendorPathHelperTest.php @@ -10,29 +10,29 @@ class HydeVendorPathHelperTest extends TestCase { - public function test_method_exists() + public function testMethodExists() { $this->assertTrue(method_exists(HydeKernel::class, 'vendorPath')); } - public function test_method_returns_string() + public function testMethodReturnsString() { $this->assertIsString(Hyde::vendorPath()); } - public function test_method_returns_string_containing_vendor_path() + public function testMethodReturnsStringContainingVendorPath() { $this->assertStringContainsString('vendor', Hyde::vendorPath()); } - public function test_method_returns_path_to_the_vendor_directory() + public function testMethodReturnsPathToTheVendorDirectory() { $this->assertDirectoryExists(Hyde::vendorPath()); $this->assertFileExists(Hyde::vendorPath().'/composer.json'); $this->assertStringContainsString('"name": "hyde/framework",', file_get_contents(Hyde::vendorPath().'/composer.json')); } - public function test_can_specify_which_hyde_package_to_use() + public function testCanSpecifyWhichHydePackageToUse() { $this->assertDirectoryExists(Hyde::vendorPath(package: 'realtime-compiler')); $this->assertFileExists(Hyde::vendorPath('composer.json', 'realtime-compiler')); diff --git a/tests/Unit/InteractsWithDirectoriesConcernTest.php b/tests/Unit/InteractsWithDirectoriesConcernTest.php index 7832e01f..e8210d71 100644 --- a/tests/Unit/InteractsWithDirectoriesConcernTest.php +++ b/tests/Unit/InteractsWithDirectoriesConcernTest.php @@ -32,7 +32,7 @@ protected function tearDown(): void parent::tearDown(); } - public function test_methods_can_be_called_statically() + public function testMethodsCanBeCalledStatically() { static::needsDirectory('foo'); $this->assertDirectoryExists(Hyde::path('foo')); @@ -41,32 +41,32 @@ public function test_methods_can_be_called_statically() $this->assertDirectoryExists(Hyde::path('foo')); } - public function test_needs_directory_creates_the_directory() + public function testNeedsDirectoryCreatesTheDirectory() { $this->needsDirectory('foo'); $this->assertDirectoryExists(Hyde::path('foo')); } - public function test_needs_directory_creates_the_directory_recursively() + public function testNeedsDirectoryCreatesTheDirectoryRecursively() { $this->needsDirectory('foo/bar/baz'); $this->assertDirectoryExists(Hyde::path('foo/bar/baz')); } - public function test_needs_directory_handles_existing_directory() + public function testNeedsDirectoryHandlesExistingDirectory() { $this->needsDirectory('foo'); $this->needsDirectory('foo'); $this->assertDirectoryExists(Hyde::path('foo')); } - public function test_needs_directories_creates_single_directory() + public function testNeedsDirectoriesCreatesSingleDirectory() { $this->needsDirectories(['foo']); $this->assertDirectoryExists(Hyde::path('foo')); } - public function test_needs_directories_creates_multiple_directories() + public function testNeedsDirectoriesCreatesMultipleDirectories() { $this->needsDirectories(['foo', 'bar']); $this->assertDirectoryExists(Hyde::path('foo')); @@ -75,7 +75,7 @@ public function test_needs_directories_creates_multiple_directories() File::deleteDirectory(Hyde::path('bar')); } - public function test_needs_parent_directory_creates_directory_for_the_parent_file() + public function testNeedsParentDirectoryCreatesDirectoryForTheParentFile() { $this->needsParentDirectory(Hyde::path('foo/bar/baz.txt')); $this->assertDirectoryExists(Hyde::path('foo/bar')); diff --git a/tests/Unit/MarkdownDocumentTest.php b/tests/Unit/MarkdownDocumentTest.php index 90d9fdc8..dce948cd 100644 --- a/tests/Unit/MarkdownDocumentTest.php +++ b/tests/Unit/MarkdownDocumentTest.php @@ -17,44 +17,44 @@ */ class MarkdownDocumentTest extends TestCase { - public function test_constructor_creates_new_markdown_document() + public function testConstructorCreatesNewMarkdownDocument() { $document = new MarkdownDocument([], ''); $this->assertInstanceOf(MarkdownDocument::class, $document); } - public function test_constructor_arguments_are_optional() + public function testConstructorArgumentsAreOptional() { $document = new MarkdownDocument(); $this->assertInstanceOf(MarkdownDocument::class, $document); } - public function test_constructor_arguments_are_assigned() + public function testConstructorArgumentsAreAssigned() { $document = new MarkdownDocument(['foo' => 'bar'], 'Hello, world!'); $this->assertEquals(FrontMatter::fromArray(['foo' => 'bar']), $document->matter); } - public function test_magic_to_string_method_returns_body() + public function testMagicToStringMethodReturnsBody() { $document = new MarkdownDocument(['foo' => 'bar'], 'Hello, world!'); $this->assertEquals('Hello, world!', (string) $document); } - public function test_compile_method_returns_rendered_html() + public function testCompileMethodReturnsRenderedHtml() { $document = new MarkdownDocument([], 'Hello, world!'); $this->assertEquals("

Hello, world!

\n", $document->markdown->compile()); } - public function test_to_html_method_returns_rendered_as_html_string() + public function testToHtmlMethodReturnsRenderedAsHtmlString() { $document = new MarkdownDocument([], 'Hello, world!'); $this->assertInstanceOf(HtmlString::class, $document->markdown->toHtml()); $this->assertEquals("

Hello, world!

\n", (string) $document->markdown->toHtml()); } - public function test_parse_method_parses_a_file_using_the_markdown_file_service() + public function testParseMethodParsesAFileUsingTheMarkdownFileService() { file_put_contents('_pages/foo.md', "---\nfoo: bar\n---\nHello, world!"); $document = MarkdownDocument::parse('_pages/foo.md'); @@ -64,13 +64,13 @@ public function test_parse_method_parses_a_file_using_the_markdown_file_service( Filesystem::unlink('_pages/foo.md'); } - public function test_to_array_method_returns_array_markdown_body_lines() + public function testToArrayMethodReturnsArrayMarkdownBodyLines() { $document = new MarkdownDocument(body: "foo\nbar\nbaz"); $this->assertEquals(['foo', 'bar', 'baz'], $document->markdown->toArray()); } - public function test_from_file_method_returns_new_markdown_document() + public function testFromFileMethodReturnsNewMarkdownDocument() { file_put_contents('_pages/foo.md', "---\nfoo: bar\n---\nHello, world!"); $markdown = Markdown::fromFile('_pages/foo.md'); @@ -85,7 +85,7 @@ public function end_of_markdown_body_is_trimmed() $this->assertEquals('Hello, world!', $markdown->body()); } - public function test_carriage_returns_are_normalized() + public function testCarriageReturnsAreNormalized() { $markdown = new Markdown("foo\rbar"); $this->assertEquals("foo\rbar", $markdown->body()); diff --git a/tests/Unit/MarkdownFacadeTest.php b/tests/Unit/MarkdownFacadeTest.php index 32a41f1a..2f17ee60 100644 --- a/tests/Unit/MarkdownFacadeTest.php +++ b/tests/Unit/MarkdownFacadeTest.php @@ -14,7 +14,7 @@ */ class MarkdownFacadeTest extends TestCase { - public function test_render(): void + public function testRender(): void { $markdown = '# Hello World!'; diff --git a/tests/Unit/MediaDirectoryCanBeChangedTest.php b/tests/Unit/MediaDirectoryCanBeChangedTest.php index bd8bd522..f2521fc5 100644 --- a/tests/Unit/MediaDirectoryCanBeChangedTest.php +++ b/tests/Unit/MediaDirectoryCanBeChangedTest.php @@ -19,7 +19,7 @@ */ class MediaDirectoryCanBeChangedTest extends TestCase { - public function test_media_output_directory_can_be_changed_for_site_builds() + public function testMediaOutputDirectoryCanBeChangedForSiteBuilds() { Filesystem::deleteDirectory('_site'); @@ -37,7 +37,7 @@ public function test_media_output_directory_can_be_changed_for_site_builds() $this->resetSite(); } - public function test_media_output_directory_can_be_changed_for_site_rebuilds() + public function testMediaOutputDirectoryCanBeChangedForSiteRebuilds() { Filesystem::deleteDirectory('_site'); @@ -55,7 +55,7 @@ public function test_media_output_directory_can_be_changed_for_site_rebuilds() $this->resetSite(); } - public function test_compiled_pages_have_links_to_the_right_media_file_location() + public function testCompiledPagesHaveLinksToTheRightMediaFileLocation() { Filesystem::moveDirectory('_media', '_assets'); Hyde::setMediaDirectory('_assets'); diff --git a/tests/Unit/NavItemTest.php b/tests/Unit/NavItemTest.php index 2976278c..379fbf58 100644 --- a/tests/Unit/NavItemTest.php +++ b/tests/Unit/NavItemTest.php @@ -38,7 +38,7 @@ protected function setUp(): void Render::swap(new RenderData()); } - public function test__construct() + public function testConstruct() { $route = new Route(new MarkdownPage()); $item = new NavItem($route, 'Test', 500); @@ -78,7 +78,7 @@ public function testFromRoute() $this->assertSame($route->getLink(), $item->destination); } - public function test__toString() + public function testToString() { Render::shouldReceive('getRouteKey')->once()->andReturn('index'); diff --git a/tests/Unit/Pages/BaseHydePageUnitTest.php b/tests/Unit/Pages/BaseHydePageUnitTest.php index 3d063cc9..ce7b358e 100644 --- a/tests/Unit/Pages/BaseHydePageUnitTest.php +++ b/tests/Unit/Pages/BaseHydePageUnitTest.php @@ -86,7 +86,7 @@ abstract public function testAll(); abstract public function testMetadata(); - abstract public function test__construct(); + abstract public function testConstruct(); abstract public function testMake(); diff --git a/tests/Unit/Pages/BladePageUnitTest.php b/tests/Unit/Pages/BladePageUnitTest.php index b7ddc68a..7376f56a 100644 --- a/tests/Unit/Pages/BladePageUnitTest.php +++ b/tests/Unit/Pages/BladePageUnitTest.php @@ -146,7 +146,7 @@ public function testMetadata() $this->assertInstanceOf(PageMetadataBag::class, (new BladePage())->metadata()); } - public function test__construct() + public function testConstruct() { $this->assertInstanceOf(BladePage::class, new BladePage()); } diff --git a/tests/Unit/Pages/DocumentationPageUnitTest.php b/tests/Unit/Pages/DocumentationPageUnitTest.php index 39f1f2bb..2ef2ae37 100644 --- a/tests/Unit/Pages/DocumentationPageUnitTest.php +++ b/tests/Unit/Pages/DocumentationPageUnitTest.php @@ -154,7 +154,7 @@ public function testMetadata() $this->assertInstanceOf(PageMetadataBag::class, (new DocumentationPage())->metadata()); } - public function test__construct() + public function testConstruct() { $this->assertInstanceOf(DocumentationPage::class, new DocumentationPage()); } diff --git a/tests/Unit/Pages/HtmlPageUnitTest.php b/tests/Unit/Pages/HtmlPageUnitTest.php index 060a9e62..c6343585 100644 --- a/tests/Unit/Pages/HtmlPageUnitTest.php +++ b/tests/Unit/Pages/HtmlPageUnitTest.php @@ -180,7 +180,7 @@ public function testMetadata() $this->assertInstanceOf(PageMetadataBag::class, (new HtmlPage())->metadata()); } - public function test__construct() + public function testConstruct() { $this->assertInstanceOf(HtmlPage::class, new HtmlPage()); } diff --git a/tests/Unit/Pages/InMemoryPageUnitTest.php b/tests/Unit/Pages/InMemoryPageUnitTest.php index fc79dd0d..2169a655 100644 --- a/tests/Unit/Pages/InMemoryPageUnitTest.php +++ b/tests/Unit/Pages/InMemoryPageUnitTest.php @@ -184,7 +184,7 @@ public function testMetadata() $this->assertInstanceOf(PageMetadataBag::class, (new InMemoryPage('foo'))->metadata()); } - public function test__construct() + public function testConstruct() { $this->assertInstanceOf(InMemoryPage::class, new InMemoryPage('foo')); } diff --git a/tests/Unit/Pages/MarkdownPageModelConstructorArgumentsAreOptionalTest.php b/tests/Unit/Pages/MarkdownPageModelConstructorArgumentsAreOptionalTest.php index ed9fb44b..d0ba7052 100644 --- a/tests/Unit/Pages/MarkdownPageModelConstructorArgumentsAreOptionalTest.php +++ b/tests/Unit/Pages/MarkdownPageModelConstructorArgumentsAreOptionalTest.php @@ -11,7 +11,7 @@ class MarkdownPageModelConstructorArgumentsAreOptionalTest extends TestCase { - public function test_markdown_page_model_constructor_arguments_are_optional() + public function testMarkdownPageModelConstructorArgumentsAreOptional() { $models = [ MarkdownPage::class, diff --git a/tests/Unit/Pages/MarkdownPageTest.php b/tests/Unit/Pages/MarkdownPageTest.php index 4f6af8dd..712ccdb8 100644 --- a/tests/Unit/Pages/MarkdownPageTest.php +++ b/tests/Unit/Pages/MarkdownPageTest.php @@ -16,13 +16,13 @@ */ class MarkdownPageTest extends TestCase { - public function test_can_get_collection_of_slugs() + public function testCanGetCollectionOfSlugs() { $this->file('_pages/test-page.md', "# Test Page \n Hello World!"); $this->assertSame(['test-page'], MarkdownPage::files()); } - public function test_created_model_contains_expected_data() + public function testCreatedModelContainsExpectedData() { $this->file('_pages/test-page.md', "# Test Page \n Hello World!"); $page = MarkdownPage::parse('test-page'); @@ -32,7 +32,7 @@ public function test_created_model_contains_expected_data() $this->assertEquals('test-page', $page->identifier); } - public function test_can_render_markdown_page() + public function testCanRenderMarkdownPage() { $this->file('_pages/test-page.md', "# Test Page \n Hello World!"); $page = MarkdownPage::parse('test-page'); diff --git a/tests/Unit/Pages/MarkdownPageUnitTest.php b/tests/Unit/Pages/MarkdownPageUnitTest.php index 9a38dd55..1942e97f 100644 --- a/tests/Unit/Pages/MarkdownPageUnitTest.php +++ b/tests/Unit/Pages/MarkdownPageUnitTest.php @@ -182,7 +182,7 @@ public function testMetadata() $this->assertInstanceOf(PageMetadataBag::class, (new MarkdownPage())->metadata()); } - public function test__construct() + public function testConstruct() { $this->assertInstanceOf(MarkdownPage::class, new MarkdownPage()); } diff --git a/tests/Unit/Pages/MarkdownPostHelpersTest.php b/tests/Unit/Pages/MarkdownPostHelpersTest.php index 6f4a9354..7e93b577 100644 --- a/tests/Unit/Pages/MarkdownPostHelpersTest.php +++ b/tests/Unit/Pages/MarkdownPostHelpersTest.php @@ -12,39 +12,39 @@ */ class MarkdownPostHelpersTest extends TestCase { - public function test_get_current_page_path_returns_local_uri_path_for_post_slug() + public function testGetCurrentPagePathReturnsLocalUriPathForPostSlug() { $post = new MarkdownPost('foo-bar'); $this->assertEquals('posts/foo-bar', $post->getRouteKey()); } - public function test_get_canonical_link_returns_canonical_uri_path_for_post_slug() + public function testGetCanonicalLinkReturnsCanonicalUriPathForPostSlug() { config(['hyde.url' => 'https://example.com']); $post = new MarkdownPost('foo-bar'); $this->assertEquals('https://example.com/posts/foo-bar.html', $post->getCanonicalUrl()); } - public function test_get_canonical_link_returns_pretty_url_when_enabled() + public function testGetCanonicalLinkReturnsPrettyUrlWhenEnabled() { config(['hyde.url' => 'https://example.com', 'hyde.pretty_urls' => true]); $post = new MarkdownPost('foo-bar'); $this->assertEquals('https://example.com/posts/foo-bar', $post->getCanonicalUrl()); } - public function test_get_post_description_returns_post_description_when_set_in_front_matter() + public function testGetPostDescriptionReturnsPostDescriptionWhenSetInFrontMatter() { $post = MarkdownPost::make('foo-bar', ['description' => 'This is a post description']); $this->assertEquals('This is a post description', $post->description); } - public function test_get_post_description_returns_post_body_when_no_description_set_in_front_matter() + public function testGetPostDescriptionReturnsPostBodyWhenNoDescriptionSetInFrontMatter() { $post = MarkdownPost::make('foo-bar', [], 'This is a post body'); $this->assertEquals('This is a post body', $post->description); } - public function test_dynamic_description_is_truncated_when_longer_than_128_characters() + public function testDynamicDescriptionIsTruncatedWhenLongerThan128Characters() { $post = MarkdownPost::make('foo-bar', [], str_repeat('a', 128)); $this->assertEquals(str_repeat('a', 125).'...', $post->description); diff --git a/tests/Unit/Pages/MarkdownPostParserTest.php b/tests/Unit/Pages/MarkdownPostParserTest.php index c9387c8b..c6b0d4f7 100644 --- a/tests/Unit/Pages/MarkdownPostParserTest.php +++ b/tests/Unit/Pages/MarkdownPostParserTest.php @@ -39,7 +39,7 @@ protected function tearDown(): void parent::tearDown(); } - public function test_can_parse_markdown_file() + public function testCanParseMarkdownFile() { $post = MarkdownPost::parse('test-post'); $this->assertInstanceOf(MarkdownPost::class, $post); @@ -52,7 +52,7 @@ public function test_can_parse_markdown_file() $this->assertTrue(strlen($post->identifier) > 8); } - public function test_parsed_markdown_post_contains_valid_front_matter() + public function testParsedMarkdownPostContainsValidFrontMatter() { $post = MarkdownPost::parse('test-post'); $this->assertEquals('My New Post', $post->data('title')); diff --git a/tests/Unit/Pages/MarkdownPostUnitTest.php b/tests/Unit/Pages/MarkdownPostUnitTest.php index a3f12d4e..9bddaf59 100644 --- a/tests/Unit/Pages/MarkdownPostUnitTest.php +++ b/tests/Unit/Pages/MarkdownPostUnitTest.php @@ -182,7 +182,7 @@ public function testMetadata() $this->assertInstanceOf(PageMetadataBag::class, (new MarkdownPost())->metadata()); } - public function test__construct() + public function testConstruct() { $this->assertInstanceOf(MarkdownPost::class, new MarkdownPost()); } diff --git a/tests/Unit/Pages/PageModelGetAllFilesHelperTest.php b/tests/Unit/Pages/PageModelGetAllFilesHelperTest.php index 26b77d05..8ccd211d 100644 --- a/tests/Unit/Pages/PageModelGetAllFilesHelperTest.php +++ b/tests/Unit/Pages/PageModelGetAllFilesHelperTest.php @@ -16,7 +16,7 @@ */ class PageModelGetAllFilesHelperTest extends TestCase { - public function test_blade_page_get_helper_returns_blade_page_array() + public function testBladePageGetHelperReturnsBladePageArray() { $array = BladePage::files(); $this->assertCount(2, $array); @@ -24,7 +24,7 @@ public function test_blade_page_get_helper_returns_blade_page_array() $this->assertEquals(['404', 'index'], $array); } - public function test_markdown_page_get_helper_returns_markdown_page_array() + public function testMarkdownPageGetHelperReturnsMarkdownPageArray() { Filesystem::touch('_pages/test-page.md'); @@ -36,7 +36,7 @@ public function test_markdown_page_get_helper_returns_markdown_page_array() Filesystem::unlink('_pages/test-page.md'); } - public function test_markdown_post_get_helper_returns_markdown_post_array() + public function testMarkdownPostGetHelperReturnsMarkdownPostArray() { Filesystem::touch('_posts/test-post.md'); @@ -48,7 +48,7 @@ public function test_markdown_post_get_helper_returns_markdown_post_array() Filesystem::unlink('_posts/test-post.md'); } - public function test_documentation_page_get_helper_returns_documentation_page_array() + public function testDocumentationPageGetHelperReturnsDocumentationPageArray() { Filesystem::touch('_docs/test-page.md'); diff --git a/tests/Unit/Pages/PageModelGetHelperTest.php b/tests/Unit/Pages/PageModelGetHelperTest.php index fea50135..f832755d 100644 --- a/tests/Unit/Pages/PageModelGetHelperTest.php +++ b/tests/Unit/Pages/PageModelGetHelperTest.php @@ -17,7 +17,7 @@ */ class PageModelGetHelperTest extends TestCase { - public function test_blade_page_get_helper_returns_blade_page_collection() + public function testBladePageGetHelperReturnsBladePageCollection() { $collection = BladePage::all(); $this->assertCount(2, $collection); @@ -25,7 +25,7 @@ public function test_blade_page_get_helper_returns_blade_page_collection() $this->assertContainsOnlyInstancesOf(BladePage::class, $collection); } - public function test_markdown_page_get_helper_returns_markdown_page_collection() + public function testMarkdownPageGetHelperReturnsMarkdownPageCollection() { Filesystem::touch('_pages/test-page.md'); @@ -37,7 +37,7 @@ public function test_markdown_page_get_helper_returns_markdown_page_collection() Filesystem::unlink('_pages/test-page.md'); } - public function test_markdown_post_get_helper_returns_markdown_post_collection() + public function testMarkdownPostGetHelperReturnsMarkdownPostCollection() { Filesystem::touch('_posts/test-post.md'); @@ -49,7 +49,7 @@ public function test_markdown_post_get_helper_returns_markdown_post_collection() Filesystem::unlink('_posts/test-post.md'); } - public function test_documentation_page_get_helper_returns_documentation_page_collection() + public function testDocumentationPageGetHelperReturnsDocumentationPageCollection() { Filesystem::touch('_docs/test-page.md'); diff --git a/tests/Unit/Pages/PageModelParseHelperTest.php b/tests/Unit/Pages/PageModelParseHelperTest.php index 3f86e47b..8e4c55fe 100644 --- a/tests/Unit/Pages/PageModelParseHelperTest.php +++ b/tests/Unit/Pages/PageModelParseHelperTest.php @@ -16,7 +16,7 @@ */ class PageModelParseHelperTest extends TestCase { - public function test_blade_page_get_helper_returns_blade_page_object() + public function testBladePageGetHelperReturnsBladePageObject() { Filesystem::touch('_pages/foo.blade.php'); @@ -26,7 +26,7 @@ public function test_blade_page_get_helper_returns_blade_page_object() Filesystem::unlink('_pages/foo.blade.php'); } - public function test_markdown_page_get_helper_returns_markdown_page_object() + public function testMarkdownPageGetHelperReturnsMarkdownPageObject() { Filesystem::touch('_pages/foo.md'); @@ -36,7 +36,7 @@ public function test_markdown_page_get_helper_returns_markdown_page_object() Filesystem::unlink('_pages/foo.md'); } - public function test_markdown_post_get_helper_returns_markdown_post_object() + public function testMarkdownPostGetHelperReturnsMarkdownPostObject() { Filesystem::touch('_posts/foo.md'); @@ -46,7 +46,7 @@ public function test_markdown_post_get_helper_returns_markdown_post_object() Filesystem::unlink('_posts/foo.md'); } - public function test_documentation_page_get_helper_returns_documentation_page_object() + public function testDocumentationPageGetHelperReturnsDocumentationPageObject() { Filesystem::touch('_docs/foo.md'); diff --git a/tests/Unit/RelativeLinksAcrossPagesRetainsIntegrityTest.php b/tests/Unit/RelativeLinksAcrossPagesRetainsIntegrityTest.php index d02b3851..2c3562e1 100644 --- a/tests/Unit/RelativeLinksAcrossPagesRetainsIntegrityTest.php +++ b/tests/Unit/RelativeLinksAcrossPagesRetainsIntegrityTest.php @@ -68,7 +68,7 @@ protected function assertSee(string $page, string|array $text): void "Failed asserting that the page '$page' contains the text '$text'"); } - public function test_relative_links_across_pages_retains_integrity() + public function testRelativeLinksAcrossPagesRetainsIntegrity() { $service = new BuildService(Mockery::mock(OutputStyle::class, [ 'getFormatter' => Mockery::mock(OutputFormatterInterface::class, [ diff --git a/tests/Unit/RouteNotFoundExceptionTest.php b/tests/Unit/RouteNotFoundExceptionTest.php index 87390343..caa8dea1 100644 --- a/tests/Unit/RouteNotFoundExceptionTest.php +++ b/tests/Unit/RouteNotFoundExceptionTest.php @@ -12,14 +12,14 @@ */ class RouteNotFoundExceptionTest extends UnitTestCase { - public function test_it_can_be_instantiated() + public function testItCanBeInstantiated() { $exception = new RouteNotFoundException(); $this->assertInstanceOf(RouteNotFoundException::class, $exception); } - public function test_it_throws_an_exception_when_page_type_is_not_supported() + public function testItThrowsAnExceptionWhenPageTypeIsNotSupported() { $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route [not-found] not found.'); diff --git a/tests/Unit/ServeCommandOptionsUnitTest.php b/tests/Unit/ServeCommandOptionsUnitTest.php index 9b73aa63..86cf2674 100644 --- a/tests/Unit/ServeCommandOptionsUnitTest.php +++ b/tests/Unit/ServeCommandOptionsUnitTest.php @@ -28,58 +28,58 @@ protected function setUp(): void ]); } - public function test_getHostSelection() + public function testGetHostSelection() { $this->assertSame('localhost', $this->getMock()->getHostSelection()); } - public function test_getHostSelection_withHostOption() + public function testGetHostSelectionWithHostOption() { $this->assertSame('foo', $this->getMock(['host' => 'foo'])->getHostSelection()); } - public function test_getHostSelection_withConfigOption() + public function testGetHostSelectionWithConfigOption() { self::mockConfig(['hyde.server.host' => 'foo']); $this->assertSame('foo', $this->getMock()->getHostSelection()); } - public function test_getHostSelection_withHostOptionAndConfigOption() + public function testGetHostSelectionWithHostOptionAndConfigOption() { self::mockConfig(['hyde.server.host' => 'foo']); $this->assertSame('bar', $this->getMock(['host' => 'bar'])->getHostSelection()); } - public function test_getPortSelection() + public function testGetPortSelection() { $this->assertSame(8080, $this->getMock()->getPortSelection()); } - public function test_getPortSelection_withPortOption() + public function testGetPortSelectionWithPortOption() { $this->assertSame(8081, $this->getMock(['port' => 8081])->getPortSelection()); } - public function test_getPortSelection_withConfigOption() + public function testGetPortSelectionWithConfigOption() { self::mockConfig(['hyde.server.port' => 8082]); $this->assertSame(8082, $this->getMock()->getPortSelection()); } - public function test_getPortSelection_withPortOptionAndConfigOption() + public function testGetPortSelectionWithPortOptionAndConfigOption() { self::mockConfig(['hyde.server.port' => 8082]); $this->assertSame(8081, $this->getMock(['port' => 8081])->getPortSelection()); } - public function test_getEnvironmentVariables() + public function testGetEnvironmentVariables() { $this->assertSame([ 'HYDE_SERVER_REQUEST_OUTPUT' => true, ], $this->getMock()->getEnvironmentVariables()); } - public function test_getEnvironmentVariables_withNoAnsiOption() + public function testGetEnvironmentVariablesWithNoAnsiOption() { $this->assertSame([ 'HYDE_SERVER_REQUEST_OUTPUT' => false, @@ -158,7 +158,7 @@ public function testPlayCdnOptionPropagatesToEnvironmentVariables() $this->assertFalse(isset($command->getEnvironmentVariables()['HYDE_PLAY_CDN'])); } - public function test_parseEnvironmentOption() + public function testParseEnvironmentOption() { $command = $this->getMock(['foo' => 'true']); $this->assertSame('enabled', $command->parseEnvironmentOption('foo')); @@ -167,19 +167,19 @@ public function test_parseEnvironmentOption() $this->assertSame('disabled', $command->parseEnvironmentOption('foo')); } - public function test_parseEnvironmentOption_withEmptyString() + public function testParseEnvironmentOptionWithEmptyString() { $command = $this->getMock(['foo' => '']); $this->assertSame('enabled', $command->parseEnvironmentOption('foo')); } - public function test_parseEnvironmentOption_withNull() + public function testParseEnvironmentOptionWithNull() { $command = $this->getMock(['foo' => null]); $this->assertNull($command->parseEnvironmentOption('foo')); } - public function test_parseEnvironmentOption_withInvalidValue() + public function testParseEnvironmentOptionWithInvalidValue() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid boolean value for --foo option.'); @@ -188,7 +188,7 @@ public function test_parseEnvironmentOption_withInvalidValue() $command->parseEnvironmentOption('foo'); } - public function test_checkArgvForOption() + public function testCheckArgvForOption() { $serverBackup = $_SERVER; @@ -233,7 +233,7 @@ protected function openInBrowser(): void $this->assertTrue($command->openInBrowserCalled); } - public function test_openInBrowser() + public function testOpenInBrowser() { $output = $this->createMock(OutputStyle::class); $output->expects($this->never())->method('writeln'); @@ -254,7 +254,7 @@ public function test_openInBrowser() $command->openInBrowser(); } - public function test_openInBrowserThatFails() + public function testOpenInBrowserThatFails() { $output = Mockery::mock(OutputStyle::class); $output->shouldReceive('getFormatter')->andReturn($this->createMock(OutputFormatterInterface::class)); diff --git a/tests/Unit/SourceFilesInCustomDirectoriesCanBeCompiledTest.php b/tests/Unit/SourceFilesInCustomDirectoriesCanBeCompiledTest.php index 14e519cf..f5208611 100644 --- a/tests/Unit/SourceFilesInCustomDirectoriesCanBeCompiledTest.php +++ b/tests/Unit/SourceFilesInCustomDirectoriesCanBeCompiledTest.php @@ -34,7 +34,7 @@ protected function tearDown(): void parent::tearDown(); } - public function test_markdown_posts_in_changed_directory_can_be_compiled() + public function testMarkdownPostsInChangedDirectoryCanBeCompiled() { mkdir(Hyde::path('testSourceDir/blog')); Filesystem::touch('testSourceDir/blog/test.md'); @@ -47,7 +47,7 @@ public function test_markdown_posts_in_changed_directory_can_be_compiled() Filesystem::unlink('_site/posts/test.html'); } - public function test_markdown_pages_in_changed_directory_can_be_compiled() + public function testMarkdownPagesInChangedDirectoryCanBeCompiled() { mkdir(Hyde::path('testSourceDir/pages')); Filesystem::touch('testSourceDir/pages/test.md'); @@ -60,7 +60,7 @@ public function test_markdown_pages_in_changed_directory_can_be_compiled() Filesystem::unlink('_site/test.html'); } - public function test_documentation_pages_in_changed_directory_can_be_compiled() + public function testDocumentationPagesInChangedDirectoryCanBeCompiled() { mkdir(Hyde::path('testSourceDir/documentation')); Filesystem::touch('testSourceDir/documentation/test.md'); @@ -73,7 +73,7 @@ public function test_documentation_pages_in_changed_directory_can_be_compiled() Filesystem::unlink('_site/docs/test.html'); } - public function test_blade_pages_in_changed_directory_can_be_compiled() + public function testBladePagesInChangedDirectoryCanBeCompiled() { mkdir(Hyde::path('testSourceDir/blade')); Filesystem::touch('testSourceDir/blade/test.blade.php'); diff --git a/tests/Unit/TestBuildStaticSiteCommandFlagToEnablePrettyUrlsTest.php b/tests/Unit/TestBuildStaticSiteCommandFlagToEnablePrettyUrlsTest.php index ea623166..b9e3638b 100644 --- a/tests/Unit/TestBuildStaticSiteCommandFlagToEnablePrettyUrlsTest.php +++ b/tests/Unit/TestBuildStaticSiteCommandFlagToEnablePrettyUrlsTest.php @@ -13,7 +13,7 @@ */ class TestBuildStaticSiteCommandFlagToEnablePrettyUrlsTest extends TestCase { - public function test_pretty_urls_can_be_enabled_with_flag() + public function testPrettyUrlsCanBeEnabledWithFlag() { config(['hyde.pretty_urls' => false]); @@ -26,7 +26,7 @@ public function test_pretty_urls_can_be_enabled_with_flag() File::cleanDirectory(Hyde::path('_site')); } - public function test_config_change_is_not_persisted() + public function testConfigChangeIsNotPersisted() { $this->assertFalse(config('hyde.pretty_urls', false)); } diff --git a/tests/Unit/TracksExecutionTimeTest.php b/tests/Unit/TracksExecutionTimeTest.php index 44752ba2..e85b94a4 100644 --- a/tests/Unit/TracksExecutionTimeTest.php +++ b/tests/Unit/TracksExecutionTimeTest.php @@ -12,7 +12,7 @@ */ class TracksExecutionTimeTest extends UnitTestCase { - public function test_startClock() + public function testStartClock() { $class = new TracksExecutionTimeTestClass(); @@ -25,7 +25,7 @@ public function test_startClock() $this->assertLessThan(1, abs(microtime(true) - $class->timeStart)); } - public function test_stopClock() + public function testStopClock() { $class = new TracksExecutionTimeTestClass(); $class->startClock(); @@ -34,7 +34,7 @@ public function test_stopClock() $this->assertLessThan(1, $class->stopClock()); } - public function test_getExecutionTimeInMs() + public function testGetExecutionTimeInMs() { $class = new FixedStopClockTestClass(); @@ -42,7 +42,7 @@ public function test_getExecutionTimeInMs() $this->assertSame(3.14, $class->getExecutionTimeInMs()); } - public function test_getExecutionTimeString() + public function testGetExecutionTimeString() { $class = new FixedStopClockTestClass(); diff --git a/tests/Unit/UnixsumTest.php b/tests/Unit/UnixsumTest.php index 58ccde0a..b72b3eef 100644 --- a/tests/Unit/UnixsumTest.php +++ b/tests/Unit/UnixsumTest.php @@ -14,42 +14,42 @@ class UnixsumTest extends TestCase { - public function test_method_returns_string() + public function testMethodReturnsString() { $this->assertIsString(unixsum('foo')); } - public function test_method_returns_string_with_length_of_32() + public function testMethodReturnsStringWithLengthOf32() { $this->assertEquals(32, strlen(unixsum('foo'))); } - public function test_method_returns_string_matching_expected_format() + public function testMethodReturnsStringMatchingExpectedFormat() { $this->assertMatchesRegularExpression('/^[a-f0-9]{32}$/', unixsum('foo')); } - public function test_method_returns_same_value_for_same_string_using_normal_method() + public function testMethodReturnsSameValueForSameStringUsingNormalMethod() { $this->assertEquals(md5('foo'), unixsum('foo')); } - public function test_method_returns_different_value_for_different_string() + public function testMethodReturnsDifferentValueForDifferentString() { $this->assertNotEquals(unixsum('foo'), unixsum('bar')); } - public function test_function_is_case_sensitive() + public function testFunctionIsCaseSensitive() { $this->assertNotEquals(unixsum('foo'), unixsum('FOO')); } - public function test_function_is_space_sensitive() + public function testFunctionIsSpaceSensitive() { $this->assertNotEquals(unixsum(' foo '), unixsum('foo')); } - public function test_method_returns_same_value_regardless_of_end_of_line_sequence() + public function testMethodReturnsSameValueRegardlessOfEndOfLineSequence() { $this->assertEquals(unixsum('foo'), unixsum('foo')); $this->assertEquals(unixsum("foo\n"), unixsum("foo\n")); @@ -57,13 +57,13 @@ public function test_method_returns_same_value_regardless_of_end_of_line_sequenc $this->assertEquals(unixsum("foo\n"), unixsum("foo\r\n")); } - public function test_method_returns_same_value_for_string_with_mixed_end_of_line_sequences() + public function testMethodReturnsSameValueForStringWithMixedEndOfLineSequences() { $this->assertEquals(unixsum("foo\nbar\r\nbaz\r\n"), unixsum("foo\nbar\nbaz\n")); } - public function test_method_returns_same_value_when_loaded_from_file_using_shorthand() + public function testMethodReturnsSameValueWhenLoadedFromFileUsingShorthand() { $string = "foo\nbar\r\nbaz\r\n"; diff --git a/tests/Unit/UnsupportedPageTypeExceptionTest.php b/tests/Unit/UnsupportedPageTypeExceptionTest.php index e9307a0e..36e972b9 100644 --- a/tests/Unit/UnsupportedPageTypeExceptionTest.php +++ b/tests/Unit/UnsupportedPageTypeExceptionTest.php @@ -12,14 +12,14 @@ */ class UnsupportedPageTypeExceptionTest extends UnitTestCase { - public function test_it_can_be_instantiated() + public function testItCanBeInstantiated() { $exception = new UnsupportedPageTypeException(); $this->assertInstanceOf(UnsupportedPageTypeException::class, $exception); } - public function test_it_throws_an_exception_when_page_type_is_not_supported() + public function testItThrowsAnExceptionWhenPageTypeIsNotSupported() { $this->expectException(UnsupportedPageTypeException::class); $this->expectExceptionMessage('The page type [unsupported] is not supported.'); diff --git a/tests/Unit/ValidatesExistenceTest.php b/tests/Unit/ValidatesExistenceTest.php index 3cef88c6..51414ea4 100644 --- a/tests/Unit/ValidatesExistenceTest.php +++ b/tests/Unit/ValidatesExistenceTest.php @@ -15,7 +15,7 @@ */ class ValidatesExistenceTest extends TestCase { - public function test_validate_existence_does_nothing_if_file_exists() + public function testValidateExistenceDoesNothingIfFileExists() { $class = new ValidatesExistenceTestClass(); @@ -24,7 +24,7 @@ public function test_validate_existence_does_nothing_if_file_exists() $this->assertTrue(true); } - public function test_validate_existence_throws_file_not_found_exception_if_file_does_not_exist() + public function testValidateExistenceThrowsFileNotFoundExceptionIfFileDoesNotExist() { $this->expectException(FileNotFoundException::class); diff --git a/tests/Unit/Views/ArticleExcerptViewTest.php b/tests/Unit/Views/ArticleExcerptViewTest.php index e42b88a8..aa445431 100644 --- a/tests/Unit/Views/ArticleExcerptViewTest.php +++ b/tests/Unit/Views/ArticleExcerptViewTest.php @@ -21,13 +21,13 @@ protected function renderTestView(MarkdownPost $post): string ), ['post' => $post]); } - public function test_component_can_be_rendered() + public function testComponentCanBeRendered() { $view = $this->renderTestView(MarkdownPost::make()); $this->assertStringContainsString('https://schema.org/Article', $view); } - public function test_component_renders_post_data() + public function testComponentRendersPostData() { $view = $this->renderTestView(MarkdownPost::make(matter: [ 'title' => 'Test Post', @@ -43,7 +43,7 @@ public function test_component_renders_post_data() $this->assertStringContainsString('Read post', $view); } - public function test_component_renders_post_with_author_object() + public function testComponentRendersPostWithAuthorObject() { $view = $this->renderTestView(MarkdownPost::make(matter: [ 'author' => [ @@ -55,7 +55,7 @@ public function test_component_renders_post_with_author_object() $this->assertStringContainsString('John Doe', $view); } - public function test_there_is_no_comma_after_date_string_when_there_is_no_author() + public function testThereIsNoCommaAfterDateStringWhenThereIsNoAuthor() { $view = $this->renderTestView(MarkdownPost::make(matter: [ 'date' => '2022-01-01', @@ -65,7 +65,7 @@ public function test_there_is_no_comma_after_date_string_when_there_is_no_author $this->assertStringNotContainsString('Jan 1st, 2022,', $view); } - public function test_there_is_a_comma_after_date_string_when_there_is_a_author() + public function testThereIsACommaAfterDateStringWhenThereIsAAuthor() { $view = $this->renderTestView(MarkdownPost::make(matter: [ 'date' => '2022-01-01', diff --git a/tests/Unit/Views/Components/LinkComponentTest.php b/tests/Unit/Views/Components/LinkComponentTest.php index bc877f98..7e5e667e 100644 --- a/tests/Unit/Views/Components/LinkComponentTest.php +++ b/tests/Unit/Views/Components/LinkComponentTest.php @@ -14,19 +14,19 @@ */ class LinkComponentTest extends TestCase { - public function test_link_component_can_be_rendered() + public function testLinkComponentCanBeRendered() { $this->assertEquals('
bar', rtrim(Blade::render('bar'))); } - public function test_link_component_can_be_rendered_with_route() + public function testLinkComponentCanBeRenderedWithRoute() { $route = Routes::get('index'); $this->assertEquals('bar', rtrim( Blade::render('bar'))); } - public function test_link_component_can_be_rendered_with_route_for_nested_pages() + public function testLinkComponentCanBeRenderedWithRouteForNestedPages() { Render::share('routeKey', 'foo/bar'); $route = Routes::get('index'); diff --git a/tests/Unit/Views/FeaturedImageViewTest.php b/tests/Unit/Views/FeaturedImageViewTest.php index 9b3c11db..8d60759d 100644 --- a/tests/Unit/Views/FeaturedImageViewTest.php +++ b/tests/Unit/Views/FeaturedImageViewTest.php @@ -22,7 +22,7 @@ */ class FeaturedImageViewTest extends TestCase { - public function test_the_view() + public function testTheView() { $component = $this->renderComponent([ 'image.source' => 'foo.jpg', @@ -48,7 +48,7 @@ public function test_the_view() ); } - public function test_image_author_attribution_string() + public function testImageAuthorAttributionString() { $string = $this->renderComponent(['image.authorName' => 'John Doe']); $this->assertStringContainsString('itemprop="creator"', $string); @@ -56,7 +56,7 @@ public function test_image_author_attribution_string() $this->assertStringContainsString('John Doe', $string); } - public function test_image_author_attribution_string_with_url() + public function testImageAuthorAttributionStringWithUrl() { $string = $this->renderComponent([ 'image.authorName' => 'John Doe', @@ -69,27 +69,27 @@ public function test_image_author_attribution_string_with_url() $this->assertStringContainsString('renderComponent(['image.copyright' => 'foo copy']); $this->assertStringContainsString('', $string); $this->assertStringContainsString('foo copy', $string); } - public function test_copyright_string_inverse() + public function testCopyrightStringInverse() { $string = $this->renderComponent([]); $this->assertStringNotContainsString('', $string); } - public function test_license_string() + public function testLicenseString() { $string = $this->renderComponent(['image.licenseName' => 'foo']); $this->assertStringContainsString('foo', $string); } - public function test_license_string_with_url() + public function testLicenseStringWithUrl() { $image = $this->make([ 'image.licenseName' => 'foo', @@ -100,21 +100,21 @@ public function test_license_string_with_url() $this->assertStringContainsString('foo', $string); } - public function test_license_string_inverse() + public function testLicenseStringInverse() { $string = $this->renderComponent([]); $this->assertStringNotContainsString('', $string); $this->assertStringNotContainsString('license', $string); } - public function test_license_string_inverse_with_url() + public function testLicenseStringInverseWithUrl() { $string = $this->renderComponent(['image.licenseUrl' => 'https://example.com/bar.html']); $this->assertStringNotContainsString('', $string); $this->assertStringNotContainsString('license', $string); } - public function test_fluent_attribution_logic_uses_rich_html_tags() + public function testFluentAttributionLogicUsesRichHtmlTags() { $image = $this->make([ 'image.authorName' => 'John Doe', @@ -133,7 +133,7 @@ public function test_fluent_attribution_logic_uses_rich_html_tags() $this->assertStringContainsString('John Doe', $string); } - public function test_fluent_attribution_logic_uses_rich_html_tags_1() + public function testFluentAttributionLogicUsesRichHtmlTags1() { $image = $this->make(['image.authorName' => 'John Doe']); $string = $this->renderComponent($image); @@ -141,7 +141,7 @@ public function test_fluent_attribution_logic_uses_rich_html_tags_1() $this->assertStringContainsString('John Doe', $string); } - public function test_fluent_attribution_logic_uses_rich_html_tags_2() + public function testFluentAttributionLogicUsesRichHtmlTags2() { $image = $this->make(['image.copyright' => 'foo']); $string = $this->renderComponent($image); @@ -149,7 +149,7 @@ public function test_fluent_attribution_logic_uses_rich_html_tags_2() $this->assertStringContainsString('foo', $string); } - public function test_fluent_attribution_logic_uses_rich_html_tags_3() + public function testFluentAttributionLogicUsesRichHtmlTags3() { $image = $this->make(['image.licenseName' => 'foo']); @@ -157,7 +157,7 @@ public function test_fluent_attribution_logic_uses_rich_html_tags_3() $this->assertStringContainsString('foo', $string); } - public function test_fluent_attribution_logic_uses_rich_html_tags_4() + public function testFluentAttributionLogicUsesRichHtmlTags4() { $image = $this->make(); $string = $this->renderComponent($image); @@ -165,7 +165,7 @@ public function test_fluent_attribution_logic_uses_rich_html_tags_4() $this->assertStringNotContainsString('License', $string); } - public function test_fluent_attribution_logic_creates_fluent_messages1() + public function testFluentAttributionLogicCreatesFluentMessages1() { $image = $this->make([ 'image.authorName' => 'John Doe', @@ -179,7 +179,7 @@ public function test_fluent_attribution_logic_creates_fluent_messages1() ); } - public function test_fluent_attribution_logic_creates_fluent_messages2() + public function testFluentAttributionLogicCreatesFluentMessages2() { $image = $this->make([ 'image.authorName' => 'John Doe', @@ -192,7 +192,7 @@ public function test_fluent_attribution_logic_creates_fluent_messages2() ); } - public function test_fluent_attribution_logic_creates_fluent_messages3() + public function testFluentAttributionLogicCreatesFluentMessages3() { $expect = 'Image by John Doe. CC.'; $image = $this->make([ @@ -206,7 +206,7 @@ public function test_fluent_attribution_logic_creates_fluent_messages3() ); } - public function test_fluent_attribution_logic_creates_fluent_messages4() + public function testFluentAttributionLogicCreatesFluentMessages4() { $expect = 'All rights reserved.'; $image = $this->make([ @@ -219,7 +219,7 @@ public function test_fluent_attribution_logic_creates_fluent_messages4() ); } - public function test_fluent_attribution_logic_creates_fluent_messages5() + public function testFluentAttributionLogicCreatesFluentMessages5() { $expect = 'Image by John Doe.'; $image = $this->make([ @@ -232,7 +232,7 @@ public function test_fluent_attribution_logic_creates_fluent_messages5() ); } - public function test_fluent_attribution_logic_creates_fluent_messages6() + public function testFluentAttributionLogicCreatesFluentMessages6() { $expect = 'License MIT.'; $image = $this->make([ @@ -245,7 +245,7 @@ public function test_fluent_attribution_logic_creates_fluent_messages6() ); } - public function test_fluent_attribution_logic_creates_fluent_messages7() + public function testFluentAttributionLogicCreatesFluentMessages7() { $expect = ''; $image = $this->make(); diff --git a/tests/Unit/Views/NavigationBrandViewTest.php b/tests/Unit/Views/NavigationBrandViewTest.php index 98a52e42..577295f5 100644 --- a/tests/Unit/Views/NavigationBrandViewTest.php +++ b/tests/Unit/Views/NavigationBrandViewTest.php @@ -26,12 +26,12 @@ protected function render(): string ])->render(); } - public function test_component_links_to_home_route() + public function testComponentLinksToHomeRoute() { $this->assertStringContainsString('href="index.html"', $this->render()); } - public function test_component_uses_site_name() + public function testComponentUsesSiteName() { $this->assertStringContainsString('HydePHP', $this->render()); config(['hyde.name' => 'foo']); diff --git a/tests/Unit/Views/NavigationLinkViewTest.php b/tests/Unit/Views/NavigationLinkViewTest.php index 2e56951f..1018d2ae 100644 --- a/tests/Unit/Views/NavigationLinkViewTest.php +++ b/tests/Unit/Views/NavigationLinkViewTest.php @@ -27,23 +27,23 @@ protected function render(?NavItem $item = null): string ])->render(); } - public function test_component_links_to_route_destination() + public function testComponentLinksToRouteDestination() { $this->assertStringContainsString('href="foo.html"', $this->render()); } - public function test_component_uses_title() + public function testComponentUsesTitle() { $this->assertStringContainsString('Foo', $this->render()); } - public function test_component_is_current_when_current_route_matches() + public function testComponentIsCurrentWhenCurrentRouteMatches() { $this->mockRoute(Routes::get('index')); $this->assertStringContainsString('current', $this->render(NavItem::forRoute(Routes::get('index'), 'Home'))); } - public function test_component_has_aria_current_when_current_route_matches() + public function testComponentHasAriaCurrentWhenCurrentRouteMatches() { $this->mockRoute(Routes::get('index')); $this->assertStringContainsString('aria-current="page"', $this->render(NavItem::forRoute(Routes::get('index'), 'Home'))); diff --git a/tests/Unit/Views/NavigationMenuViewTest.php b/tests/Unit/Views/NavigationMenuViewTest.php index ba8eb893..be7fe698 100644 --- a/tests/Unit/Views/NavigationMenuViewTest.php +++ b/tests/Unit/Views/NavigationMenuViewTest.php @@ -25,37 +25,37 @@ protected function render(): string return view('hyde::layouts.navigation')->render(); } - public function test_component_can_be_rendered() + public function testComponentCanBeRendered() { $this->assertStringContainsString('id="main-navigation"', $this->render()); } - public function test_component_contains_dark_mode_button() + public function testComponentContainsDarkModeButton() { $this->assertStringContainsString('theme-toggle-button', $this->render()); } - public function test_component_contains_navigation_menu_toggle_button() + public function testComponentContainsNavigationMenuToggleButton() { $this->assertStringContainsString('id="navigation-toggle-button"', $this->render()); } - public function test_component_contains_main_navigation_links() + public function testComponentContainsMainNavigationLinks() { $this->assertStringContainsString('id="main-navigation-links"', $this->render()); } - public function test_component_contains_index_html_link() + public function testComponentContainsIndexHtmlLink() { $this->assertStringContainsString('href="index.html"', $this->render()); } - public function test_component_not_contains_404_html_link() + public function testComponentNotContains404HtmlLink() { $this->assertStringNotContainsString('href="404.html"', $this->render()); } - public function test_navigation_menu_label_can_be_changed_in_front_matter() + public function testNavigationMenuLabelCanBeChangedInFrontMatter() { $this->file('_pages/foo.md', '--- navigation: @@ -69,7 +69,7 @@ public function test_navigation_menu_label_can_be_changed_in_front_matter() Filesystem::unlink('_site/foo.html'); } - public function test_navigation_menu_label_can_be_changed_in_blade_matter() + public function testNavigationMenuLabelCanBeChangedInBladeMatter() { $this->file('_pages/foo.blade.php', <<<'BLADE' @extends('hyde::layouts.app') diff --git a/tests/Unit/Views/ScriptsComponentViewTest.php b/tests/Unit/Views/ScriptsComponentViewTest.php index 022567e1..63abb92a 100644 --- a/tests/Unit/Views/ScriptsComponentViewTest.php +++ b/tests/Unit/Views/ScriptsComponentViewTest.php @@ -26,24 +26,24 @@ protected function renderTestView(): string )); } - public function test_component_can_be_rendered() + public function testComponentCanBeRendered() { $this->assertStringContainsString('', $this->renderTestView()); } - public function test_scripts_can_be_pushed_to_the_component_scripts_stack() + public function testScriptsCanBePushedToTheComponentScriptsStack() { view()->share('routeKey', ''); diff --git a/tests/Unit/Views/StylesComponentViewTest.php b/tests/Unit/Views/StylesComponentViewTest.php index 4630fe70..36a30f7c 100644 --- a/tests/Unit/Views/StylesComponentViewTest.php +++ b/tests/Unit/Views/StylesComponentViewTest.php @@ -31,17 +31,17 @@ protected function renderTestView(): string )); } - public function test_component_can_be_rendered() + public function testComponentCanBeRendered() { $this->assertStringContainsString('renderTestView()); } - public function test_component_has_link_to_app_css_file() + public function testComponentHasLinkToAppCssFile() { $this->assertStringContainsString('renderTestView()); } - public function test_component_uses_relative_path_to_app_css_file_for_nested_pages() + public function testComponentUsesRelativePathToAppCssFileForNestedPages() { $this->mockCurrentPage = 'foo'; $this->assertStringContainsString('renderTestView()); @@ -52,14 +52,14 @@ public function test_component_uses_relative_path_to_app_css_file_for_nested_pag $this->mockCurrentPage = null; } - public function test_component_does_not_render_link_to_app_css_when_it_does_not_exist() + public function testComponentDoesNotRenderLinkToAppCssWhenItDoesNotExist() { rename(Hyde::path('_media/app.css'), Hyde::path('_media/app.css.bak')); $this->assertStringNotContainsString('renderTestView()); rename(Hyde::path('_media/app.css.bak'), Hyde::path('_media/app.css')); } - public function test_styles_can_be_pushed_to_the_component_styles_stack() + public function testStylesCanBePushedToTheComponentStylesStack() { Render::share('routeKey', ''); @@ -74,25 +74,25 @@ public function test_styles_can_be_pushed_to_the_component_styles_stack() ); } - public function test_component_renders_tailwind_play_cdn_link_when_enabled_in_config() + public function testComponentRendersTailwindPlayCdnLinkWhenEnabledInConfig() { config(['hyde.use_play_cdn' => true]); $this->assertStringContainsString('', $this->renderTestView()); } - public function test_component_renders_app_cdn_link_when_enabled_in_config() + public function testComponentRendersAppCdnLinkWhenEnabledInConfig() { config(['hyde.load_app_styles_from_cdn' => true]); $this->assertStringContainsString(Asset::cdnLink('app.css'), $this->renderTestView()); } - public function test_component_does_not_render_link_to_local_app_css_when_cdn_link_is_enabled_in_config() + public function testComponentDoesNotRenderLinkToLocalAppCssWhenCdnLinkIsEnabledInConfig() { config(['hyde.load_app_styles_from_cdn' => true]); $this->assertStringNotContainsString('renderTestView()); } - public function test_component_does_not_render_cdn_link_when_a_local_file_exists() + public function testComponentDoesNotRenderCdnLinkWhenALocalFileExists() { Filesystem::touch('_media/hyde.css'); $this->assertStringNotContainsString('https://cdn.jsdelivr.net/npm/hydefront', $this->renderTestView());