diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c1dadfcdf30..f562b80a14e 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -20,8 +20,11 @@ In general, these changes should only affect those who have written custom code - Moved class DocumentationSidebar into Navigation namespace - Moved class NavigationMenu into Navigation namespace - Moved class NavItem into Navigation namespace +- Moved class FindsContentLengthForImageObject into Constructors namespace - Merged interface RouteFacadeContract into existing interface RouteContract - +- Renamed HydeBuildStaticSiteCommand to HydeBuildSiteCommand +- Renamed legacy FileCacheService to ViewDiffService + ### Deprecated - for soon-to-be removed features. diff --git a/packages/framework/src/Actions/FindsContentLengthForImageObject.php b/packages/framework/src/Actions/Constructors/FindsContentLengthForImageObject.php similarity index 98% rename from packages/framework/src/Actions/FindsContentLengthForImageObject.php rename to packages/framework/src/Actions/Constructors/FindsContentLengthForImageObject.php index 324ec18f5b9..81776e89f7d 100644 --- a/packages/framework/src/Actions/FindsContentLengthForImageObject.php +++ b/packages/framework/src/Actions/Constructors/FindsContentLengthForImageObject.php @@ -1,6 +1,6 @@ option('force'); } diff --git a/packages/framework/src/HydeServiceProvider.php b/packages/framework/src/HydeServiceProvider.php index ede93636d80..eb189262b84 100644 --- a/packages/framework/src/HydeServiceProvider.php +++ b/packages/framework/src/HydeServiceProvider.php @@ -106,7 +106,7 @@ protected function registerHydeConsoleCommands(): void Commands\HydeUpdateConfigsCommand::class, Commands\HydePublishViewsCommand::class, Commands\HydeRebuildStaticSiteCommand::class, - Commands\HydeBuildStaticSiteCommand::class, + Commands\HydeBuildSiteCommand::class, Commands\HydeBuildSitemapCommand::class, Commands\HydeBuildRssFeedCommand::class, Commands\HydeBuildSearchCommand::class, diff --git a/packages/framework/src/Models/Image.php b/packages/framework/src/Models/Image.php index 7a3226d68dc..add03f9bd99 100644 --- a/packages/framework/src/Models/Image.php +++ b/packages/framework/src/Models/Image.php @@ -2,7 +2,7 @@ namespace Hyde\Framework\Models; -use Hyde\Framework\Actions\FindsContentLengthForImageObject; +use Hyde\Framework\Actions\Constructors\FindsContentLengthForImageObject; use Hyde\Framework\Hyde; /** diff --git a/packages/framework/src/Services/FileCacheService.php b/packages/framework/src/Services/ViewDiffService.php similarity index 90% rename from packages/framework/src/Services/FileCacheService.php rename to packages/framework/src/Services/ViewDiffService.php index 25965759fae..3fdf8b06858 100644 --- a/packages/framework/src/Services/FileCacheService.php +++ b/packages/framework/src/Services/ViewDiffService.php @@ -7,10 +7,9 @@ /** * Helper methods to interact with the filecache. * - * @see \Hyde\Framework\Testing\Feature\Services\FileCacheServiceTest - * @see \Hyde\Framework\Testing\Unit\FileCacheServiceUnixsumMethodTest + * @see \Hyde\Framework\Testing\Feature\Services\ViewDiffServiceTest */ -class FileCacheService +class ViewDiffService { public static function getFilecache(): array { diff --git a/packages/framework/tests/Feature/FindsContentLengthForImageObjectTest.php b/packages/framework/tests/Feature/FindsContentLengthForImageObjectTest.php index 4c8798ec83b..bcec0bd5379 100644 --- a/packages/framework/tests/Feature/FindsContentLengthForImageObjectTest.php +++ b/packages/framework/tests/Feature/FindsContentLengthForImageObjectTest.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Http; /** - * @covers \Hyde\Framework\Actions\FindsContentLengthForImageObject + * @covers \Hyde\Framework\Actions\Constructors\FindsContentLengthForImageObject */ class FindsContentLengthForImageObjectTest extends TestCase { diff --git a/packages/framework/tests/Feature/Services/BuildTaskServiceTest.php b/packages/framework/tests/Feature/Services/BuildTaskServiceTest.php index 527314dc1a0..557cb23dde7 100644 --- a/packages/framework/tests/Feature/Services/BuildTaskServiceTest.php +++ b/packages/framework/tests/Feature/Services/BuildTaskServiceTest.php @@ -20,7 +20,7 @@ class BuildTaskServiceTest extends TestCase { /** - * @covers \Hyde\Framework\Commands\HydeBuildStaticSiteCommand::runPostBuildActions + * @covers \Hyde\Framework\Commands\HydeBuildSiteCommand::runPostBuildActions */ public function test_build_command_can_run_post_build_tasks() { diff --git a/packages/framework/tests/Feature/Services/FileCacheServiceTest.php b/packages/framework/tests/Feature/Services/FileCacheServiceTest.php deleted file mode 100644 index 1957aa95104..00000000000 --- a/packages/framework/tests/Feature/Services/FileCacheServiceTest.php +++ /dev/null @@ -1,51 +0,0 @@ -getFilecache(); - - $this->assertIsArray($fileCache); - $this->assertArrayHasKey('/resources/views/layouts/app.blade.php', $fileCache); - $this->assertArrayHasKey('unixsum', $fileCache['/resources/views/layouts/app.blade.php']); - $this->assertEquals(32, strlen($fileCache['/resources/views/layouts/app.blade.php']['unixsum'])); - } - - public function test_get_checksums() - { - $fileCacheService = new FileCacheService(); - $checksums = $fileCacheService->getChecksums(); - - $this->assertIsArray($checksums); - $this->assertEquals(32, strlen($checksums[0])); - } - - public function test_checksum_matches_any() - { - $fileCacheService = new FileCacheService(); - - $this->assertTrue($fileCacheService->checksumMatchesAny(FileCacheService::unixsumFile( - Hyde::vendorPath('resources/views/layouts/app.blade.php')) - )); - } - - public function test_checksum_matches_any_false() - { - $fileCacheService = new FileCacheService(); - - $this->assertFalse($fileCacheService->checksumMatchesAny(FileCacheService::unixsum( - 'foo' - ))); - } -} diff --git a/packages/framework/tests/Feature/Services/ViewDiffServiceTest.php b/packages/framework/tests/Feature/Services/ViewDiffServiceTest.php new file mode 100644 index 00000000000..f9293039f35 --- /dev/null +++ b/packages/framework/tests/Feature/Services/ViewDiffServiceTest.php @@ -0,0 +1,122 @@ +getFilecache(); + + $this->assertIsArray($fileCache); + $this->assertArrayHasKey('/resources/views/layouts/app.blade.php', $fileCache); + $this->assertArrayHasKey('unixsum', $fileCache['/resources/views/layouts/app.blade.php']); + $this->assertEquals(32, strlen($fileCache['/resources/views/layouts/app.blade.php']['unixsum'])); + } + + public function test_get_checksums() + { + $fileCacheService = new ViewDiffService(); + $checksums = $fileCacheService->getChecksums(); + + $this->assertIsArray($checksums); + $this->assertEquals(32, strlen($checksums[0])); + } + + public function test_checksum_matches_any() + { + $fileCacheService = new ViewDiffService(); + + $this->assertTrue($fileCacheService->checksumMatchesAny(ViewDiffService::unixsumFile( + Hyde::vendorPath('resources/views/layouts/app.blade.php')) + )); + } + + public function test_checksum_matches_any_false() + { + $fileCacheService = new ViewDiffService(); + + $this->assertFalse($fileCacheService->checksumMatchesAny(ViewDiffService::unixsum( + 'foo' + ))); + } + + public function test_method_returns_string() + { + $this->assertIsString(ViewDiffService::unixsum('foo')); + } + + public function test_method_returns_string_with_length_of_32() + { + $this->assertEquals(32, strlen(ViewDiffService::unixsum('foo'))); + } + + public function test_method_returns_string_matching_expected_format() + { + $this->assertMatchesRegularExpression('/^[a-f0-9]{32}$/', ViewDiffService::unixsum('foo')); + } + + public function test_method_returns_same_value_for_same_string_using_normal_method() + { + $this->assertEquals(md5('foo'), ViewDiffService::unixsum('foo')); + } + + public function test_method_returns_different_value_for_different_string() + { + $this->assertNotEquals(ViewDiffService::unixsum('foo'), ViewDiffService::unixsum('bar')); + } + + public function test_function_is_case_sensitive() + { + $this->assertNotEquals(ViewDiffService::unixsum('foo'), ViewDiffService::unixsum('FOO')); + } + + public function test_function_is_space_sensitive() + { + $this->assertNotEquals(ViewDiffService::unixsum(' foo '), ViewDiffService::unixsum('foo')); + } + + public function test_method_returns_same_value_regardless_of_end_of_line_sequence() + { + $this->assertEquals(ViewDiffService::unixsum('foo'), ViewDiffService::unixsum('foo')); + $this->assertEquals(ViewDiffService::unixsum("foo\n"), ViewDiffService::unixsum("foo\n")); + $this->assertEquals(ViewDiffService::unixsum("foo\n"), ViewDiffService::unixsum("foo\r")); + $this->assertEquals(ViewDiffService::unixsum("foo\n"), ViewDiffService::unixsum("foo\r\n")); + } + + public function test_method_returns_same_value_for_string_with_mixed_end_of_line_sequences() + { + $this->assertEquals(ViewDiffService::unixsum("foo\nbar\r\nbaz\r\n"), + ViewDiffService::unixsum("foo\nbar\nbaz\n")); + } + + public function test_method_returns_same_value_when_loaded_from_file() + { + $string = "foo\nbar\r\nbaz\r\n"; + $file = tempnam(sys_get_temp_dir(), 'foo'); + file_put_contents($file, $string); + + $this->assertEquals(ViewDiffService::unixsum($string), ViewDiffService::unixsum(file_get_contents($file))); + + unlink($file); + } + + public function test_method_returns_same_value_when_loaded_from_file_using_shorthand() + { + $string = "foo\nbar\r\nbaz\r\n"; + $file = tempnam(sys_get_temp_dir(), 'foo'); + file_put_contents($file, $string); + + $this->assertEquals(ViewDiffService::unixsum($string), ViewDiffService::unixsumFile($file)); + + unlink($file); + } +} diff --git a/packages/framework/tests/Feature/StaticSiteServiceTest.php b/packages/framework/tests/Feature/StaticSiteServiceTest.php index c16af2587a3..4a14d44c8ee 100644 --- a/packages/framework/tests/Feature/StaticSiteServiceTest.php +++ b/packages/framework/tests/Feature/StaticSiteServiceTest.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\File; /** - * @covers \Hyde\Framework\Commands\HydeBuildStaticSiteCommand + * @covers \Hyde\Framework\Commands\HydeBuildSiteCommand * @covers \Hyde\Framework\Services\BuildService */ class StaticSiteServiceTest extends TestCase diff --git a/packages/framework/tests/Unit/FileCacheServiceUnixsumMethodTest.php b/packages/framework/tests/Unit/FileCacheServiceUnixsumMethodTest.php index cc952c4daf0..3853e09960e 100644 --- a/packages/framework/tests/Unit/FileCacheServiceUnixsumMethodTest.php +++ b/packages/framework/tests/Unit/FileCacheServiceUnixsumMethodTest.php @@ -1,80 +1,3 @@ assertIsString(Service::unixsum('foo')); - } - - public function test_method_returns_string_with_length_of_32() - { - $this->assertEquals(32, strlen(Service::unixsum('foo'))); - } - - public function test_method_returns_string_matching_expected_format() - { - $this->assertMatchesRegularExpression('/^[a-f0-9]{32}$/', Service::unixsum('foo')); - } - - public function test_method_returns_same_value_for_same_string_using_normal_method() - { - $this->assertEquals(md5('foo'), Service::unixsum('foo')); - } - - public function test_method_returns_different_value_for_different_string() - { - $this->assertNotEquals(Service::unixsum('foo'), Service::unixsum('bar')); - } - - public function test_function_is_case_sensitive() - { - $this->assertNotEquals(Service::unixsum('foo'), Service::unixsum('FOO')); - } - - public function test_function_is_space_sensitive() - { - $this->assertNotEquals(Service::unixsum(' foo '), Service::unixsum('foo')); - } - - public function test_method_returns_same_value_regardless_of_end_of_line_sequence() - { - $this->assertEquals(Service::unixsum('foo'), Service::unixsum('foo')); - $this->assertEquals(Service::unixsum("foo\n"), Service::unixsum("foo\n")); - $this->assertEquals(Service::unixsum("foo\n"), Service::unixsum("foo\r")); - $this->assertEquals(Service::unixsum("foo\n"), Service::unixsum("foo\r\n")); - } - - public function test_method_returns_same_value_for_string_with_mixed_end_of_line_sequences() - { - $this->assertEquals(Service::unixsum("foo\nbar\r\nbaz\r\n"), - Service::unixsum("foo\nbar\nbaz\n")); - } - - public function test_method_returns_same_value_when_loaded_from_file() - { - $string = "foo\nbar\r\nbaz\r\n"; - $file = tempnam(sys_get_temp_dir(), 'foo'); - file_put_contents($file, $string); - - $this->assertEquals(Service::unixsum($string), Service::unixsum(file_get_contents($file))); - - unlink($file); - } - - public function test_method_returns_same_value_when_loaded_from_file_using_shorthand() - { - $string = "foo\nbar\r\nbaz\r\n"; - $file = tempnam(sys_get_temp_dir(), 'foo'); - file_put_contents($file, $string); - - $this->assertEquals(Service::unixsum($string), Service::unixsumFile($file)); - - unlink($file); - } -}