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( '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('', 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