HTML, - ], - [ - '>info This is an info blockquote', - <<<'HTML' + ]; + yield [ + '>info This is an info blockquote', + <<<'HTML'This is a danger blockquote
HTML, - ], - [ - '>success This is a success blockquote', - <<<'HTML' + ]; + yield [ + '>success This is a success blockquote', + <<<'HTML'This is an info blockquote
HTML, - ], - [ - '>warning This is a warning blockquote', - <<<'HTML' + ]; + yield [ + '>warning This is a warning blockquote', + <<<'HTML'This is a success blockquote
HTML, - ], ]; } } diff --git a/tests/Unit/Console/Helpers/ViewPublishGroupTest.php b/tests/Unit/Console/Helpers/ViewPublishGroupTest.php index fb7942d0..d621c96c 100644 --- a/tests/Unit/Console/Helpers/ViewPublishGroupTest.php +++ b/tests/Unit/Console/Helpers/ViewPublishGroupTest.php @@ -11,9 +11,7 @@ use Hyde\Console\Helpers\ViewPublishGroup; use Illuminate\Support\Collection; -/** - * @covers \Hyde\Console\Helpers\ViewPublishGroup - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Console\Helpers\ViewPublishGroup::class)] class ViewPublishGroupTest extends UnitTestCase { protected static bool $needsKernel = true; @@ -47,11 +45,11 @@ public function testCanCreateGroup() $this->assertInstanceOf(ViewPublishGroup::class, $group); - $this->assertSame($group->group, 'layouts'); - $this->assertSame($group->name, 'Layouts'); - $this->assertSame($group->description, "Publish the 'layouts' files for customization."); + $this->assertSame('layouts', $group->group); + $this->assertSame('Layouts', $group->name); + $this->assertSame("Publish the 'layouts' files for customization.", $group->description); $this->assertSame($group->source, ViewPublishGroupTest::$packageDirectory.'/framework/resources/views/layouts'); - $this->assertSame($group->target, 'resources/views/vendor/hyde/layouts'); + $this->assertSame('resources/views/vendor/hyde/layouts', $group->target); $this->assertSame($group->files, ['app.blade.php', 'page.blade.php', 'post.blade.php']); } @@ -59,24 +57,24 @@ public function testCanCreateGroupWithCustomName() { $group = ViewPublishGroup::fromGroup('layouts', 'Custom Layouts'); - $this->assertSame($group->name, 'Custom Layouts'); - $this->assertSame($group->description, "Publish the 'layouts' files for customization."); + $this->assertSame('Custom Layouts', $group->name); + $this->assertSame("Publish the 'layouts' files for customization.", $group->description); } public function testCanCreateGroupWithCustomDescription() { $group = ViewPublishGroup::fromGroup('layouts', null, 'Custom description'); - $this->assertSame($group->name, 'Layouts'); - $this->assertSame($group->description, 'Custom description'); + $this->assertSame('Layouts', $group->name); + $this->assertSame('Custom description', $group->description); } public function testCanCreateGroupWithCustomNameAndDescription() { $group = ViewPublishGroup::fromGroup('layouts', 'Custom Layouts', 'Custom description'); - $this->assertSame($group->name, 'Custom Layouts'); - $this->assertSame($group->description, 'Custom description'); + $this->assertSame('Custom Layouts', $group->name); + $this->assertSame('Custom description', $group->description); } public function testCanGetPublishableFilesMap() diff --git a/tests/Unit/ConsoleHelperTest.php b/tests/Unit/ConsoleHelperTest.php index ff3307e1..988adf10 100644 --- a/tests/Unit/ConsoleHelperTest.php +++ b/tests/Unit/ConsoleHelperTest.php @@ -8,9 +8,7 @@ use Hyde\Testing\UnitTestCase; use Symfony\Component\Console\Input\InputInterface; -/** - * @covers \Hyde\Console\Helpers\ConsoleHelper - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Console\Helpers\ConsoleHelper::class)] class ConsoleHelperTest extends UnitTestCase { protected function tearDown(): void diff --git a/tests/Unit/ConsoleServiceProviderUnitTest.php b/tests/Unit/ConsoleServiceProviderUnitTest.php index 07a792be..75fd259d 100644 --- a/tests/Unit/ConsoleServiceProviderUnitTest.php +++ b/tests/Unit/ConsoleServiceProviderUnitTest.php @@ -7,9 +7,7 @@ use Hyde\Console\ConsoleServiceProvider; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Console\ConsoleServiceProvider - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Console\ConsoleServiceProvider::class)] class ConsoleServiceProviderUnitTest extends UnitTestCase { public function testProviderRegistersLogo() diff --git a/tests/Unit/CoreDataObjectTest.php b/tests/Unit/CoreDataObjectTest.php index 091a9f45..d0575752 100644 --- a/tests/Unit/CoreDataObjectTest.php +++ b/tests/Unit/CoreDataObjectTest.php @@ -9,9 +9,7 @@ use Hyde\Pages\MarkdownPage; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Framework\Factories\Concerns\CoreDataObject - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\Concerns\CoreDataObject::class)] class CoreDataObjectTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/CreatesNewMarkdownPostFileTest.php b/tests/Unit/CreatesNewMarkdownPostFileTest.php index 338db38c..332f7412 100644 --- a/tests/Unit/CreatesNewMarkdownPostFileTest.php +++ b/tests/Unit/CreatesNewMarkdownPostFileTest.php @@ -10,10 +10,9 @@ use Hyde\Framework\Actions\CreatesNewMarkdownPostFile; /** - * @covers \Hyde\Framework\Actions\CreatesNewMarkdownPostFile - * * @see \Hyde\Framework\Testing\Feature\Commands\MakePostCommandTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Actions\CreatesNewMarkdownPostFile::class)] class CreatesNewMarkdownPostFileTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/CustomExceptionsTest.php b/tests/Unit/CustomExceptionsTest.php index d0ac2ae0..dac82c17 100644 --- a/tests/Unit/CustomExceptionsTest.php +++ b/tests/Unit/CustomExceptionsTest.php @@ -15,14 +15,12 @@ use Exception; use Hyde\Framework\Exceptions\InvalidConfigurationException; -/** - * @covers \Hyde\Framework\Exceptions\FileConflictException - * @covers \Hyde\Framework\Exceptions\FileNotFoundException - * @covers \Hyde\Framework\Exceptions\RouteNotFoundException - * @covers \Hyde\Framework\Exceptions\UnsupportedPageTypeException - * @covers \Hyde\Framework\Exceptions\InvalidConfigurationException - * @covers \Hyde\Framework\Exceptions\ParseException - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\FileConflictException::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\FileNotFoundException::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\RouteNotFoundException::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\UnsupportedPageTypeException::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\InvalidConfigurationException::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\ParseException::class)] class CustomExceptionsTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/DataCollectionUnitTest.php b/tests/Unit/DataCollectionUnitTest.php index 8ebff95c..1cdd68d3 100644 --- a/tests/Unit/DataCollectionUnitTest.php +++ b/tests/Unit/DataCollectionUnitTest.php @@ -16,10 +16,9 @@ use Hyde\Framework\Exceptions\ParseException; /** - * @covers \Hyde\Support\DataCollection - * * @see \Hyde\Framework\Testing\Feature\DataCollectionTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Support\DataCollection::class)] class DataCollectionUnitTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/DateStringTest.php b/tests/Unit/DateStringTest.php index 6f17c975..3f9c32e2 100644 --- a/tests/Unit/DateStringTest.php +++ b/tests/Unit/DateStringTest.php @@ -8,9 +8,7 @@ use Hyde\Support\Models\DateString; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Support\Models\DateString - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Support\Models\DateString::class)] class DateStringTest extends UnitTestCase { public function testItCanParseDateString() diff --git a/tests/Unit/DocumentationSidebarGetActiveGroupUnitTest.php b/tests/Unit/DocumentationSidebarGetActiveGroupUnitTest.php index 06d8f27d..3f46ff80 100644 --- a/tests/Unit/DocumentationSidebarGetActiveGroupUnitTest.php +++ b/tests/Unit/DocumentationSidebarGetActiveGroupUnitTest.php @@ -16,11 +16,10 @@ use Hyde\Framework\Features\Navigation\DocumentationSidebar; /** - * @covers \Hyde\Framework\Features\Navigation\DocumentationSidebar - * * @see \Hyde\Framework\Testing\Feature\Services\DocumentationSidebarTest * @see \Hyde\Framework\Testing\Unit\DocumentationSidebarGetActiveGroupUnitTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\DocumentationSidebar::class)] class DocumentationSidebarGetActiveGroupUnitTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/DocumentationSidebarUnitTest.php b/tests/Unit/DocumentationSidebarUnitTest.php index 27e1e382..afe744b8 100644 --- a/tests/Unit/DocumentationSidebarUnitTest.php +++ b/tests/Unit/DocumentationSidebarUnitTest.php @@ -11,13 +11,12 @@ use Hyde\Framework\Features\Navigation\DocumentationSidebar; /** - * @covers \Hyde\Framework\Features\Navigation\DocumentationSidebar - * @covers \Hyde\Framework\Features\Navigation\NavigationMenu - * * @see \Hyde\Framework\Testing\Feature\Services\DocumentationSidebarTest * @see \Hyde\Framework\Testing\Unit\DocumentationSidebarGetActiveGroupUnitTest * @see \Hyde\Framework\Testing\Unit\NavigationMenuUnitTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\DocumentationSidebar::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\NavigationMenu::class)] class DocumentationSidebarUnitTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/EnsureCodeFollowsNamingConventionTest.php b/tests/Unit/EnsureCodeFollowsNamingConventionTest.php index 8f9a638f..0e510a63 100644 --- a/tests/Unit/EnsureCodeFollowsNamingConventionTest.php +++ b/tests/Unit/EnsureCodeFollowsNamingConventionTest.php @@ -59,7 +59,8 @@ public function testCommandsDescriptionsFollowNamingConventions() $this->assertIsString($description); $this->assertNotEmpty($description); - $this->assertTrue($description[0] === strtoupper($description[0]), + $this->assertSame(strtoupper($description[0]), + $description[0], "Command class $class description does not start with an uppercase letter.\n ".realpath($filepath) ); diff --git a/tests/Unit/ExampleUnitTest.php b/tests/Unit/ExampleUnitTest.php index c5e092f9..0ecfea6e 100644 --- a/tests/Unit/ExampleUnitTest.php +++ b/tests/Unit/ExampleUnitTest.php @@ -6,9 +6,7 @@ use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Hyde - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Hyde::class)] class ExampleUnitTest extends UnitTestCase { public function testExample() diff --git a/tests/Unit/ExtensionsUnitTest.php b/tests/Unit/ExtensionsUnitTest.php index 60b7653d..d1666295 100644 --- a/tests/Unit/ExtensionsUnitTest.php +++ b/tests/Unit/ExtensionsUnitTest.php @@ -23,13 +23,12 @@ use stdClass; /** - * @covers \Hyde\Foundation\HydeKernel - * @covers \Hyde\Foundation\Concerns\HydeExtension - * @covers \Hyde\Foundation\Concerns\ManagesExtensions - * * @see \Hyde\Framework\Testing\Feature\HydeKernelTest * @see \Hyde\Framework\Testing\Feature\HydeExtensionFeatureTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\HydeKernel::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Concerns\HydeExtension::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Concerns\ManagesExtensions::class)] class ExtensionsUnitTest extends UnitTestCase { protected HydeKernel $kernel; diff --git a/tests/Unit/Facades/AssetFacadeUnitTest.php b/tests/Unit/Facades/AssetFacadeUnitTest.php index da5b1573..67d7c3f8 100644 --- a/tests/Unit/Facades/AssetFacadeUnitTest.php +++ b/tests/Unit/Facades/AssetFacadeUnitTest.php @@ -11,9 +11,7 @@ use Hyde\Support\Models\RenderData; use Hyde\Framework\Exceptions\FileNotFoundException; -/** - * @covers \Hyde\Facades\Asset - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\Asset::class)] class AssetFacadeUnitTest extends UnitTestCase { protected function setUp(): void diff --git a/tests/Unit/Facades/AuthorFacadeTest.php b/tests/Unit/Facades/AuthorFacadeTest.php index f4e4a273..64f4e287 100644 --- a/tests/Unit/Facades/AuthorFacadeTest.php +++ b/tests/Unit/Facades/AuthorFacadeTest.php @@ -9,9 +9,7 @@ use Hyde\Framework\Features\Blogging\Models\PostAuthor; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Facades\Author - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\Author::class)] class AuthorFacadeTest extends UnitTestCase { protected static bool $needsKernel = true; @@ -32,7 +30,7 @@ public function testCreate() $author = Author::create('John Doe', 'https://johndoe.com'); $this->assertIsArray($author); - $this->assertFalse(isset($author['username'])); + $this->assertArrayNotHasKey('username', $author); $this->assertSame('John Doe', $author['name']); $this->assertSame('https://johndoe.com', $author['website']); diff --git a/tests/Unit/Facades/HydeFrontFacadeTest.php b/tests/Unit/Facades/HydeFrontFacadeTest.php index e3f42381..6b809334 100644 --- a/tests/Unit/Facades/HydeFrontFacadeTest.php +++ b/tests/Unit/Facades/HydeFrontFacadeTest.php @@ -8,9 +8,7 @@ use Hyde\Facades\HydeFront; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Facades\HydeFront - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\HydeFront::class)] class HydeFrontFacadeTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/Facades/NavigationFacadeTest.php b/tests/Unit/Facades/NavigationFacadeTest.php index 7ece76bd..b53312c6 100644 --- a/tests/Unit/Facades/NavigationFacadeTest.php +++ b/tests/Unit/Facades/NavigationFacadeTest.php @@ -7,9 +7,7 @@ use Hyde\Facades\Navigation; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Facades\Navigation - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\Navigation::class)] class NavigationFacadeTest extends UnitTestCase { public function testItemWithoutLabel() diff --git a/tests/Unit/Facades/RouteFacadeTest.php b/tests/Unit/Facades/RouteFacadeTest.php index e1018322..05560114 100644 --- a/tests/Unit/Facades/RouteFacadeTest.php +++ b/tests/Unit/Facades/RouteFacadeTest.php @@ -12,9 +12,7 @@ use Hyde\Support\Models\Route; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\Facades\Routes - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Facades\Routes::class)] class RouteFacadeTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/Facades/ViteFacadeTest.php b/tests/Unit/Facades/ViteFacadeTest.php index 6e79e286..b0666bc3 100644 --- a/tests/Unit/Facades/ViteFacadeTest.php +++ b/tests/Unit/Facades/ViteFacadeTest.php @@ -10,9 +10,7 @@ use Illuminate\Support\HtmlString; use InvalidArgumentException; -/** - * @covers \Hyde\Facades\Vite - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\Vite::class)] class ViteFacadeTest extends UnitTestCase { use CreatesTemporaryFiles; @@ -105,9 +103,7 @@ public function testAssetsMethodGeneratesCorrectHtmlForMultipleFiles() $this->assertSame($expected, (string) $html); } - /** - * @dataProvider cssFileExtensionsProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('cssFileExtensionsProvider')] public function testAssetsMethodSupportsAllCssFileExtensions(string $extension) { $html = Vite::assets(["resources/css/app.$extension"]); @@ -122,9 +118,7 @@ public function testAssetsMethodSupportsAllCssFileExtensions(string $extension) } } - /** - * @dataProvider jsFileExtensionsProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('jsFileExtensionsProvider')] public function testAssetsMethodSupportsAllJsFileExtensions(string $extension) { $html = Vite::assets(["resources/js/app.$extension"]); @@ -162,29 +156,25 @@ public function testAssetMethodGeneratesCorrectHtmlForCssFile() $this->assertSame($expected, (string) $html); } - public static function cssFileExtensionsProvider(): array + public static function cssFileExtensionsProvider(): \Iterator { - return [ - ['css'], - ['less'], - ['sass'], - ['scss'], - ['styl'], - ['stylus'], - ['pcss'], - ['postcss'], - ['js'], - ]; + yield ['css']; + yield ['less']; + yield ['sass']; + yield ['scss']; + yield ['styl']; + yield ['stylus']; + yield ['pcss']; + yield ['postcss']; + yield ['js']; } - public static function jsFileExtensionsProvider(): array + public static function jsFileExtensionsProvider(): \Iterator { - return [ - ['js'], - ['jsx'], - ['ts'], - ['tsx'], - ['css'], - ]; + yield ['js']; + yield ['jsx']; + yield ['ts']; + yield ['tsx']; + yield ['css']; } } diff --git a/tests/Unit/FeatureEnumTest.php b/tests/Unit/FeatureEnumTest.php index bb1ee28d..033ad0cd 100644 --- a/tests/Unit/FeatureEnumTest.php +++ b/tests/Unit/FeatureEnumTest.php @@ -7,9 +7,7 @@ use Hyde\Testing\UnitTestCase; use Hyde\Enums\Feature; -/** - * @covers \Hyde\Enums\Feature - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Enums\Feature::class)] class FeatureEnumTest extends UnitTestCase { public function testEnumCases() diff --git a/tests/Unit/FeaturedImageUnitTest.php b/tests/Unit/FeaturedImageUnitTest.php index 26ab3ffc..285cc1ab 100644 --- a/tests/Unit/FeaturedImageUnitTest.php +++ b/tests/Unit/FeaturedImageUnitTest.php @@ -11,10 +11,9 @@ use Hyde\Testing\UnitTestCase; /** - * @covers \Hyde\Framework\Features\Blogging\Models\FeaturedImage - * * @see \Hyde\Framework\Testing\Feature\FeaturedImageTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Blogging\Models\FeaturedImage::class)] class FeaturedImageUnitTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/FileConflictExceptionTest.php b/tests/Unit/FileConflictExceptionTest.php index 13116df2..c46d99e6 100644 --- a/tests/Unit/FileConflictExceptionTest.php +++ b/tests/Unit/FileConflictExceptionTest.php @@ -8,9 +8,7 @@ use Hyde\Framework\Exceptions\FileConflictException; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Framework\Exceptions\FileConflictException - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\FileConflictException::class)] class FileConflictExceptionTest extends UnitTestCase { public function testItCanBeInstantiated() diff --git a/tests/Unit/FileFinderTest.php b/tests/Unit/FileFinderTest.php index fadf155d..1602a79f 100644 --- a/tests/Unit/FileFinderTest.php +++ b/tests/Unit/FileFinderTest.php @@ -9,9 +9,7 @@ use Hyde\Testing\CreatesTemporaryFiles; use Hyde\Foundation\Kernel\Filesystem; -/** - * @covers \Hyde\Framework\Actions\Internal\FileFinder - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Actions\Internal\FileFinder::class)] class FileFinderTest extends UnitTestCase { use CreatesTemporaryFiles; diff --git a/tests/Unit/FilesystemFacadeMimeTypeHelperUnitTest.php b/tests/Unit/FilesystemFacadeMimeTypeHelperUnitTest.php index d6dbf8d4..45a7b83f 100644 --- a/tests/Unit/FilesystemFacadeMimeTypeHelperUnitTest.php +++ b/tests/Unit/FilesystemFacadeMimeTypeHelperUnitTest.php @@ -6,25 +6,20 @@ use Hyde\Testing\UnitTestCase; /** - * @covers \Hyde\Facades\Filesystem - * * @see \Hyde\Framework\Testing\Feature\FilesystemFacadeTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\Filesystem::class)] class FilesystemFacadeMimeTypeHelperUnitTest extends UnitTestCase { protected static bool $needsKernel = true; - /** - * @dataProvider mimeTypeProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('mimeTypeProvider')] public function testFindMimeTypeWithKnownExtensions(string $extension, string $expectedMimeType) { $this->assertSame($expectedMimeType, Filesystem::findMimeType("file.$extension")); } - /** - * @dataProvider mimeTypeProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('mimeTypeProvider')] public function testFindMimeTypeWithRemoteUrls(string $extension, string $expectedMimeType) { $this->assertSame($expectedMimeType, Filesystem::findMimeType("https://example.com/file.$extension")); @@ -60,21 +55,19 @@ public function testFindMimeTypeWithCaseSensitivity() $this->assertSame('text/plain', Filesystem::findMimeType('file.TXT')); } - public static function mimeTypeProvider(): array + public static function mimeTypeProvider(): \Iterator { - return [ - ['txt', 'text/plain'], - ['md', 'text/markdown'], - ['html', 'text/html'], - ['css', 'text/css'], - ['svg', 'image/svg+xml'], - ['png', 'image/png'], - ['jpg', 'image/jpeg'], - ['jpeg', 'image/jpeg'], - ['gif', 'image/gif'], - ['json', 'application/json'], - ['js', 'application/javascript'], - ['xml', 'application/xml'], - ]; + yield ['txt', 'text/plain']; + yield ['md', 'text/markdown']; + yield ['html', 'text/html']; + yield ['css', 'text/css']; + yield ['svg', 'image/svg+xml']; + yield ['png', 'image/png']; + yield ['jpg', 'image/jpeg']; + yield ['jpeg', 'image/jpeg']; + yield ['gif', 'image/gif']; + yield ['json', 'application/json']; + yield ['js', 'application/javascript']; + yield ['xml', 'application/xml']; } } diff --git a/tests/Unit/FilesystemFacadeUnitTest.php b/tests/Unit/FilesystemFacadeUnitTest.php index 8aa29c7b..f196a482 100644 --- a/tests/Unit/FilesystemFacadeUnitTest.php +++ b/tests/Unit/FilesystemFacadeUnitTest.php @@ -11,12 +11,11 @@ use Illuminate\Support\LazyCollection; /** - * @covers \Hyde\Facades\Filesystem - * @covers \Hyde\Foundation\Kernel\Filesystem - * @covers \Hyde\Framework\Concerns\Internal\ForwardsIlluminateFilesystem - * * @see \Hyde\Framework\Testing\Feature\FilesystemFacadeTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\Filesystem::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Kernel\Filesystem::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Concerns\Internal\ForwardsIlluminateFilesystem::class)] class FilesystemFacadeUnitTest extends UnitTestCase { protected static bool $needsKernel = true; @@ -334,6 +333,23 @@ public function testEnsureDirectoryExists() Filesystem::ensureDirectoryExists('path'); } + public function testEnsureParentDirectoryExists() + { + $mock = $this->mockFilesystem(); + + $mock->shouldReceive('dirname') + ->with(Hyde::path('file.txt')) + ->once() + ->andReturn(Hyde::path('parent')); + + $mock->shouldReceive('ensureDirectoryExists') + ->with(Hyde::path('parent'), 0755, true) + ->once() + ->andReturnNull(); + + Filesystem::ensureParentDirectoryExists('file.txt'); + } + public function testMakeDirectory() { $this->createExpectation('makeDirectory', true, Hyde::path('path')); diff --git a/tests/Unit/Foundation/FilesystemHasMediaFilesTest.php b/tests/Unit/Foundation/FilesystemHasMediaFilesTest.php index 3f079d98..edfd66b8 100644 --- a/tests/Unit/Foundation/FilesystemHasMediaFilesTest.php +++ b/tests/Unit/Foundation/FilesystemHasMediaFilesTest.php @@ -14,9 +14,7 @@ use Illuminate\Filesystem\Filesystem as BaseFilesystem; use Mockery\MockInterface; -/** - * @covers \Hyde\Foundation\Kernel\Filesystem - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Kernel\Filesystem::class)] class FilesystemHasMediaFilesTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/Foundation/HyperlinkFileHelperRelativeLinkTest.php b/tests/Unit/Foundation/HyperlinkFileHelperRelativeLinkTest.php index 4aa4af46..805c346c 100644 --- a/tests/Unit/Foundation/HyperlinkFileHelperRelativeLinkTest.php +++ b/tests/Unit/Foundation/HyperlinkFileHelperRelativeLinkTest.php @@ -11,9 +11,7 @@ use Illuminate\View\Factory; use Mockery; -/** - * @covers \Hyde\Foundation\Kernel\Hyperlinks::relativeLink - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Kernel\Hyperlinks::class)] class HyperlinkFileHelperRelativeLinkTest extends UnitTestCase { use InteractsWithPages; diff --git a/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php b/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php index 3151a977..930db701 100644 --- a/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php +++ b/tests/Unit/Foundation/HyperlinkFormatHtmlPathTest.php @@ -7,9 +7,7 @@ use Hyde\Hyde; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\Kernel\Hyperlinks::formatLink - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Kernel\Hyperlinks::class)] class HyperlinkFormatHtmlPathTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php b/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php index fa7ed72f..6791e42e 100644 --- a/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php +++ b/tests/Unit/Foundation/HyperlinksUrlPathHelpersTest.php @@ -10,9 +10,7 @@ use Hyde\Testing\FluentTestingHelpers; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\Kernel\Hyperlinks - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Kernel\Hyperlinks::class)] class HyperlinksUrlPathHelpersTest extends UnitTestCase { use FluentTestingHelpers; diff --git a/tests/Unit/FoundationFacadesTest.php b/tests/Unit/FoundationFacadesTest.php index fa56fe07..cf743262 100644 --- a/tests/Unit/FoundationFacadesTest.php +++ b/tests/Unit/FoundationFacadesTest.php @@ -13,11 +13,9 @@ use Hyde\Foundation\HydeKernel; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\Facades\Files - * @covers \Hyde\Foundation\Facades\Pages - * @covers \Hyde\Foundation\Facades\Routes - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Facades\Files::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Facades\Pages::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Facades\Routes::class)] class FoundationFacadesTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/FrontMatterModelTest.php b/tests/Unit/FrontMatterModelTest.php index 09e6c134..a2e0a000 100644 --- a/tests/Unit/FrontMatterModelTest.php +++ b/tests/Unit/FrontMatterModelTest.php @@ -7,9 +7,7 @@ use Hyde\Markdown\Models\FrontMatter; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Markdown\Models\FrontMatter - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Markdown\Models\FrontMatter::class)] class FrontMatterModelTest extends UnitTestCase { public function testConstructorCreatesNewFrontMatterModel() diff --git a/tests/Unit/GenerateBuildManifestTest.php b/tests/Unit/GenerateBuildManifestTest.php index 8b2ec50c..88b3800d 100644 --- a/tests/Unit/GenerateBuildManifestTest.php +++ b/tests/Unit/GenerateBuildManifestTest.php @@ -10,9 +10,7 @@ use function Hyde\unixsum_file; -/** - * @covers \Hyde\Framework\Actions\PostBuildTasks\GenerateBuildManifest - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Actions\PostBuildTasks\GenerateBuildManifest::class)] class GenerateBuildManifestTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/GeneratesSidebarTableOfContentsTest.php b/tests/Unit/GeneratesSidebarTableOfContentsTest.php index e340e1bf..0b0b30ed 100644 --- a/tests/Unit/GeneratesSidebarTableOfContentsTest.php +++ b/tests/Unit/GeneratesSidebarTableOfContentsTest.php @@ -10,10 +10,9 @@ use Hyde\Testing\UnitTestCase; /** - * @covers \Hyde\Framework\Actions\GeneratesTableOfContents - * * @see \Hyde\Framework\Testing\Feature\Views\SidebarTableOfContentsViewTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Actions\GeneratesTableOfContents::class)] class GeneratesSidebarTableOfContentsTest extends UnitTestCase { protected static bool $needsConfig = true; diff --git a/tests/Unit/HeadingRendererUnitTest.php b/tests/Unit/HeadingRendererUnitTest.php index 3724f0f2..e6e271e0 100644 --- a/tests/Unit/HeadingRendererUnitTest.php +++ b/tests/Unit/HeadingRendererUnitTest.php @@ -16,10 +16,9 @@ use Mockery; /** - * @covers \Hyde\Markdown\Processing\HeadingRenderer - * * @see \Hyde\Framework\Testing\Feature\MarkdownHeadingRendererTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Markdown\Processing\HeadingRenderer::class)] class HeadingRendererUnitTest extends UnitTestCase { use UsesRealBladeInUnitTests; @@ -234,17 +233,13 @@ public function testPostProcessHandlesNoHeadingTags() $this->assertSame('This is a warning blockquote
Paragraph
', (new HeadingRenderer())->postProcess($html)); } - /** - * @dataProvider headingIdentifierProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('headingIdentifierProvider')] public function testHeadingIdentifierGeneration($input, $expected) { $this->assertSame($expected, HeadingRenderer::makeIdentifier($input)); } - /** - * @dataProvider headingIdentifierProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('headingIdentifierProvider')] public function testHeadingIdentifierGenerationWithEscapedInput($input, $expected) { $this->assertSame(HeadingRenderer::makeIdentifier($input), HeadingRenderer::makeIdentifier(e($input))); @@ -274,43 +269,37 @@ protected function validateHeadingPermalinkStates(HeadingRenderer $renderer, Chi } } - public static function headingIdentifierProvider(): array + public static function headingIdentifierProvider(): \Iterator { - return [ - // Basic cases - ['Hello World', 'hello-world'], - ['Simple Heading', 'simple-heading'], - ['Heading With Numbers 123', 'heading-with-numbers-123'], - - // Special characters - ['Heading with & symbol', 'heading-with-and-symbol'], - ['Heading with < > symbols', 'heading-with-symbols'], - ['Heading with "quotes"', 'heading-with-quotes'], - ['Heading with / and \\', 'heading-with-and'], - ['Heading with punctuation!?!', 'heading-with-punctuation'], - ['Hyphenated-heading-name', 'hyphenated-heading-name'], - - // Emojis - ['Heading with emoji 🎉', 'heading-with-emoji'], - ['Another emoji 🤔 test', 'another-emoji-test'], - ['Multiple emojis 🎉🤔✨', 'multiple-emojis'], - - // Accented and non-ASCII characters - ['Accented é character', 'accented-e-character'], - ['Café Crème', 'cafe-creme'], - ['Łódź and święto', 'lodz-and-swieto'], - ['中文标题', 'zhong-wen-biao-ti'], - ['日本語の見出し', 'ri-ben-yu-nojian-chu-shi'], - ['한국어 제목', 'hangugeo-jemog'], - - // Edge cases - [' Leading spaces', 'leading-spaces'], - ['Trailing spaces ', 'trailing-spaces'], - [' Surrounded by spaces ', 'surrounded-by-spaces'], - ['----', ''], - ['%%%%%%%', ''], - [' ', ''], - ['1234567890', '1234567890'], - ]; + // Basic cases + yield ['Hello World', 'hello-world']; + yield ['Simple Heading', 'simple-heading']; + yield ['Heading With Numbers 123', 'heading-with-numbers-123']; + // Special characters + yield ['Heading with & symbol', 'heading-with-and-symbol']; + yield ['Heading with < > symbols', 'heading-with-symbols']; + yield ['Heading with "quotes"', 'heading-with-quotes']; + yield ['Heading with / and \\', 'heading-with-and']; + yield ['Heading with punctuation!?!', 'heading-with-punctuation']; + yield ['Hyphenated-heading-name', 'hyphenated-heading-name']; + // Emojis + yield ['Heading with emoji 🎉', 'heading-with-emoji']; + yield ['Another emoji 🤔 test', 'another-emoji-test']; + yield ['Multiple emojis 🎉🤔✨', 'multiple-emojis']; + // Accented and non-ASCII characters + yield ['Accented é character', 'accented-e-character']; + yield ['Café Crème', 'cafe-creme']; + yield ['Łódź and święto', 'lodz-and-swieto']; + yield ['中文标题', 'zhong-wen-biao-ti']; + yield ['日本語の見出し', 'ri-ben-yu-nojian-chu-shi']; + yield ['한국어 제목', 'hangugeo-jemog']; + // Edge cases + yield [' Leading spaces', 'leading-spaces']; + yield ['Trailing spaces ', 'trailing-spaces']; + yield [' Surrounded by spaces ', 'surrounded-by-spaces']; + yield ['----', '']; + yield ['%%%%%%%', '']; + yield [' ', '']; + yield ['1234567890', '1234567890']; } } diff --git a/tests/Unit/HtmlTestingSupportMetaTest.php b/tests/Unit/HtmlTestingSupportMetaTest.php index 3c109d74..bdec65b7 100644 --- a/tests/Unit/HtmlTestingSupportMetaTest.php +++ b/tests/Unit/HtmlTestingSupportMetaTest.php @@ -20,9 +20,8 @@ * * @see \Hyde\Testing\Support\TestView * @see \Hyde\Testing\Support\HtmlTesting - * - * @coversNothing */ +#[\PHPUnit\Framework\Attributes\CoversNothing] class HtmlTestingSupportMetaTest extends UnitTestCase { use TestsBladeViews; diff --git a/tests/Unit/HydeBasePathCanBeChangedTest.php b/tests/Unit/HydeBasePathCanBeChangedTest.php index c4e266e5..bc6fc742 100644 --- a/tests/Unit/HydeBasePathCanBeChangedTest.php +++ b/tests/Unit/HydeBasePathCanBeChangedTest.php @@ -7,11 +7,7 @@ use Hyde\Hyde; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\HydeKernel::getBasePath - * @covers \Hyde\Foundation\HydeKernel::setBasePath - * @covers \Hyde\Foundation\HydeKernel::path - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\HydeKernel::class)] class HydeBasePathCanBeChangedTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/HydeConfigFilesAreMatchingTest.php b/tests/Unit/HydeConfigFilesAreMatchingTest.php index 5a692548..4796af57 100644 --- a/tests/Unit/HydeConfigFilesAreMatchingTest.php +++ b/tests/Unit/HydeConfigFilesAreMatchingTest.php @@ -49,8 +49,8 @@ public function testMarkdownConfigFilesAreMatching() protected function assertFileEqualsIgnoringNewlineType(string $expected, string $actual): void { - static::assertFileExists($expected); - static::assertFileExists($actual); + $this->assertFileExists($expected); + $this->assertFileExists($actual); $this->assertSame(file_get_contents($expected), file_get_contents($actual)); } diff --git a/tests/Unit/HydeFileHelpersTest.php b/tests/Unit/HydeFileHelpersTest.php index d373c9b2..b3a45abc 100644 --- a/tests/Unit/HydeFileHelpersTest.php +++ b/tests/Unit/HydeFileHelpersTest.php @@ -12,9 +12,7 @@ use Hyde\Support\Facades\Render; use Illuminate\Support\Facades\View; -/** - * @covers \Hyde\Foundation\HydeKernel - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\HydeKernel::class)] class HydeFileHelpersTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/HydeGetBasePathHasFallbackTest.php b/tests/Unit/HydeGetBasePathHasFallbackTest.php index 32de083a..64d9da9c 100644 --- a/tests/Unit/HydeGetBasePathHasFallbackTest.php +++ b/tests/Unit/HydeGetBasePathHasFallbackTest.php @@ -7,9 +7,7 @@ use Hyde\Hyde; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\HydeKernel::getBasePath - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\HydeKernel::class)] class HydeGetBasePathHasFallbackTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/HydeHelperFacadeMakeSlugTest.php b/tests/Unit/HydeHelperFacadeMakeSlugTest.php index 0d1279cc..75c271e7 100644 --- a/tests/Unit/HydeHelperFacadeMakeSlugTest.php +++ b/tests/Unit/HydeHelperFacadeMakeSlugTest.php @@ -43,7 +43,7 @@ public function testMakeSlugHelperHandlesMultipleSpaces() public function testMakeSlugHelperHandlesSpecialCharacters() { - $this->assertSame('hello-world', Hyde::makeSlug('Hello & World!')); + $this->assertSame('hello-and-world', Hyde::makeSlug('Hello & World!')); } public function testMakeSlugHelperConvertsUppercaseToLowercase() @@ -111,7 +111,7 @@ public function testMakeSlugHelperHandlesComplexMixedInput() public function testMakeSlugHelperHandlesEdgeCases() { $this->assertSame('', Hyde::makeSlug('')); - $this->assertSame('at', Hyde::makeSlug('!@#$%^&*()')); + $this->assertSame('at-and', Hyde::makeSlug('!@#$%^&*()')); $this->assertSame('', Hyde::makeSlug('... ...')); $this->assertSame('multiple-dashes', Hyde::makeSlug('multiple---dashes')); } diff --git a/tests/Unit/HydeHelperFacadeTest.php b/tests/Unit/HydeHelperFacadeTest.php index f8b5d2df..3a16fa04 100644 --- a/tests/Unit/HydeHelperFacadeTest.php +++ b/tests/Unit/HydeHelperFacadeTest.php @@ -9,9 +9,7 @@ use Hyde\Hyde; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\HydeKernel - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\HydeKernel::class)] class HydeHelperFacadeTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/HydePageDataFactoryTest.php b/tests/Unit/HydePageDataFactoryTest.php index 4590a54a..65b26353 100644 --- a/tests/Unit/HydePageDataFactoryTest.php +++ b/tests/Unit/HydePageDataFactoryTest.php @@ -11,9 +11,7 @@ use Hyde\Pages\MarkdownPage; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Framework\Factories\HydePageDataFactory - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\HydePageDataFactory::class)] class HydePageDataFactoryTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/HydePageSerializableUnitTest.php b/tests/Unit/HydePageSerializableUnitTest.php index 149e184d..17c84d87 100644 --- a/tests/Unit/HydePageSerializableUnitTest.php +++ b/tests/Unit/HydePageSerializableUnitTest.php @@ -12,14 +12,12 @@ use Hyde\Pages\MarkdownPost; use Hyde\Pages\DocumentationPage; -/** - * @covers \Hyde\Pages\Concerns\HydePage - * @covers \Hyde\Pages\HtmlPage - * @covers \Hyde\Pages\BladePage - * @covers \Hyde\Pages\MarkdownPage - * @covers \Hyde\Pages\MarkdownPost - * @covers \Hyde\Pages\DocumentationPage - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\Concerns\HydePage::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\HtmlPage::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\BladePage::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\MarkdownPage::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\MarkdownPost::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\DocumentationPage::class)] class HydePageSerializableUnitTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/IncludesFacadeUnitTest.php b/tests/Unit/IncludesFacadeUnitTest.php index 548132af..99834714 100644 --- a/tests/Unit/IncludesFacadeUnitTest.php +++ b/tests/Unit/IncludesFacadeUnitTest.php @@ -18,11 +18,10 @@ use Hyde\Testing\MocksKernelFeatures; /** - * @covers \Hyde\Support\Includes - * * @see \Hyde\Framework\Testing\Feature\IncludesFacadeTest */ #[AllowDynamicProperties] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Support\Includes::class)] class IncludesFacadeUnitTest extends UnitTestCase { use MocksKernelFeatures; diff --git a/tests/Unit/InteractivePublishCommandHelperTest.php b/tests/Unit/InteractivePublishCommandHelperTest.php index 8b669e08..22198a4a 100644 --- a/tests/Unit/InteractivePublishCommandHelperTest.php +++ b/tests/Unit/InteractivePublishCommandHelperTest.php @@ -10,9 +10,7 @@ use Illuminate\Filesystem\Filesystem; use Mockery; -/** - * @covers \Hyde\Console\Helpers\InteractivePublishCommandHelper - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Console\Helpers\InteractivePublishCommandHelper::class)] class InteractivePublishCommandHelperTest extends UnitTestCase { protected static bool $needsKernel = true; @@ -69,6 +67,7 @@ public function testOnlyFiltersPublishableFiles(): void public function testPublishFiles(): void { + $this->filesystem->shouldReceive('dirname')->times(3)->andReturn(Hyde::path('resources/views/vendor/hyde/layouts')); $this->filesystem->shouldReceive('ensureDirectoryExists')->times(3); $this->filesystem->shouldReceive('copy')->times(3); @@ -80,7 +79,8 @@ public function testPublishFiles(): void $helper->publishFiles(); - $this->filesystem->shouldHaveReceived('ensureDirectoryExists')->with(Hyde::path('resources/views/vendor/hyde/layouts'))->times(3); + $this->filesystem->shouldHaveReceived('dirname')->times(3); + $this->filesystem->shouldHaveReceived('ensureDirectoryExists')->with(Hyde::path('resources/views/vendor/hyde/layouts'), 0755, true)->times(3); $this->filesystem->shouldHaveReceived('copy')->with( Hyde::path('packages/framework/resources/views/layouts/app.blade.php'), diff --git a/tests/Unit/InteractsWithDirectoriesConcernTest.php b/tests/Unit/InteractsWithDirectoriesConcernTest.php index 9d23ff0b..ca2c8778 100644 --- a/tests/Unit/InteractsWithDirectoriesConcernTest.php +++ b/tests/Unit/InteractsWithDirectoriesConcernTest.php @@ -8,9 +8,7 @@ use Hyde\Framework\Concerns\InteractsWithDirectories; use Hyde\Hyde; -/** - * @covers \Hyde\Framework\Concerns\InteractsWithDirectories - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Concerns\InteractsWithDirectories::class)] class InteractsWithDirectoriesConcernTest extends UnitTestCase { use InteractsWithDirectories; diff --git a/tests/Unit/LoadConfigurationTest.php b/tests/Unit/LoadConfigurationTest.php index ff3e966f..c1581ef3 100644 --- a/tests/Unit/LoadConfigurationTest.php +++ b/tests/Unit/LoadConfigurationTest.php @@ -8,11 +8,18 @@ use Hyde\Foundation\Internal\LoadConfiguration; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Foundation\Internal\LoadConfiguration - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Internal\LoadConfiguration::class)] class LoadConfigurationTest extends UnitTestCase { + public static function tearDownAfterClass(): void + { + // Patch PHPUnit craziness by disabling this method + // I don't know why it errors, but I have spent + // far too much of my life trying to fix it. + + // TODO: Check if this is broken after the Pest 4 upgrade. + } + public function testItLoadsRuntimeConfiguration() { $app = new Application(getcwd()); diff --git a/tests/Unit/MarkdownFacadeTest.php b/tests/Unit/MarkdownFacadeTest.php index 654a3e7f..c33090e7 100644 --- a/tests/Unit/MarkdownFacadeTest.php +++ b/tests/Unit/MarkdownFacadeTest.php @@ -9,9 +9,7 @@ use Hyde\Markdown\Models\Markdown; use Hyde\Framework\Services\MarkdownService; -/** - * @covers \Hyde\Markdown\Models\Markdown - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Markdown\Models\Markdown::class)] class MarkdownFacadeTest extends UnitTestCase { public function testRender(): void @@ -27,4 +25,13 @@ public function testRender(): void $this->verifyMockeryExpectations(); } + + public static function tearDownAfterClass(): void + { + // Patch PHPUnit craziness by disabling this method + // I don't know why it errors, but I have spent + // far too much of my life trying to fix it. + + // TODO: Check if this is broken after the Pest 4 upgrade. + } } diff --git a/tests/Unit/MarkdownHelpersTest.php b/tests/Unit/MarkdownHelpersTest.php index 963a9714..711e630f 100644 --- a/tests/Unit/MarkdownHelpersTest.php +++ b/tests/Unit/MarkdownHelpersTest.php @@ -11,10 +11,8 @@ use Hyde\Testing\TestCase; use Illuminate\Support\HtmlString; -/** - * @covers \Hyde\Markdown\Models\MarkdownDocument - * @covers \Hyde\Markdown\Models\Markdown - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Markdown\Models\MarkdownDocument::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Markdown\Models\Markdown::class)] class MarkdownHelpersTest extends TestCase { public function testConstructorCreatesNewMarkdownDocument() diff --git a/tests/Unit/MetaFacadeTest.php b/tests/Unit/MetaFacadeTest.php index 555fc071..7ad80192 100644 --- a/tests/Unit/MetaFacadeTest.php +++ b/tests/Unit/MetaFacadeTest.php @@ -8,9 +8,7 @@ use Hyde\Framework\Features\Metadata\GlobalMetadataBag; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Facades\Meta - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Facades\Meta::class)] class MetaFacadeTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/NavigationDataFactoryUnitTest.php b/tests/Unit/NavigationDataFactoryUnitTest.php index f6ffc8e3..7f209a45 100644 --- a/tests/Unit/NavigationDataFactoryUnitTest.php +++ b/tests/Unit/NavigationDataFactoryUnitTest.php @@ -12,9 +12,7 @@ use Hyde\Framework\Factories\NavigationDataFactory; use Hyde\Framework\Factories\Concerns\CoreDataObject; -/** - * @covers \Hyde\Framework\Factories\NavigationDataFactory - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\NavigationDataFactory::class)] class NavigationDataFactoryUnitTest extends UnitTestCase { protected function setUp(): void diff --git a/tests/Unit/NavigationGroupTest.php b/tests/Unit/NavigationGroupTest.php index 2b9483c2..c66070c4 100644 --- a/tests/Unit/NavigationGroupTest.php +++ b/tests/Unit/NavigationGroupTest.php @@ -13,9 +13,7 @@ use Hyde\Framework\Features\Navigation\NavigationItem; use Hyde\Framework\Features\Navigation\NavigationGroup; -/** - * @covers \Hyde\Framework\Features\Navigation\NavigationGroup - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\NavigationGroup::class)] class NavigationGroupTest extends UnitTestCase { public static function setUpBeforeClass(): void diff --git a/tests/Unit/NavigationItemIsActiveHelperTest.php b/tests/Unit/NavigationItemIsActiveHelperTest.php index d46aa2d7..b056da7e 100644 --- a/tests/Unit/NavigationItemIsActiveHelperTest.php +++ b/tests/Unit/NavigationItemIsActiveHelperTest.php @@ -14,10 +14,9 @@ use Mockery; /** - * @covers \Hyde\Framework\Features\Navigation\NavigationItem - * * @see \Hyde\Framework\Testing\Unit\NavigationItemTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\NavigationItem::class)] class NavigationItemIsActiveHelperTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/NavigationItemTest.php b/tests/Unit/NavigationItemTest.php index 235cc81a..29dee70d 100644 --- a/tests/Unit/NavigationItemTest.php +++ b/tests/Unit/NavigationItemTest.php @@ -14,21 +14,35 @@ use Hyde\Testing\UnitTestCase; use Mockery; use Hyde\Framework\Features\Navigation\NavigationGroup; +use Illuminate\Support\Facades\Facade; /** * This unit test covers the basics of the NavigationItem class. * For the full feature test, see the MainNavigationMenuTest class. * - * @covers \Hyde\Framework\Features\Navigation\NavigationItem * * @see \Hyde\Framework\Testing\Unit\NavigationItemIsActiveHelperTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\NavigationItem::class)] class NavigationItemTest extends UnitTestCase { protected static bool $needsKernel = true; protected static bool $needsConfig = true; protected static bool $needsRender = true; + protected function setUp(): void + { + // Clear any previous render facade instances + Facade::clearResolvedInstance('render'); + } + + protected function tearDown(): void + { + // Clean up mocks after each test + Mockery::close(); + Facade::clearResolvedInstance('render'); + } + public function testConstruct() { $this->assertInstanceOf(NavigationItem::class, new NavigationItem('foo', 'Test')); @@ -110,7 +124,10 @@ public function testFromRoute() public function testToString() { - Render::shouldReceive('getRouteKey')->once()->andReturn('index'); + // Create a fresh mock for this specific test to avoid interference + $mock = Mockery::mock(RenderData::class); + $mock->shouldReceive('getRouteKey')->andReturn('index'); + Render::swap($mock); $this->assertSame('index.html', (string) NavigationItem::create(Routes::get('index'))); } diff --git a/tests/Unit/NavigationMenuUnitTest.php b/tests/Unit/NavigationMenuUnitTest.php index 8de2aba9..8358b461 100644 --- a/tests/Unit/NavigationMenuUnitTest.php +++ b/tests/Unit/NavigationMenuUnitTest.php @@ -10,12 +10,11 @@ use Hyde\Framework\Features\Navigation\MainNavigationMenu; /** - * @covers \Hyde\Framework\Features\Navigation\NavigationMenu - * @covers \Hyde\Framework\Features\Navigation\MainNavigationMenu - * * @see \Hyde\Framework\Testing\Feature\NavigationMenuTest * @see \Hyde\Framework\Testing\Unit\DocumentationSidebarUnitTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\NavigationMenu::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\MainNavigationMenu::class)] class NavigationMenuUnitTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/NumericalPageOrderingHelperUnitTest.php b/tests/Unit/NumericalPageOrderingHelperUnitTest.php index b9fb2073..f317b106 100644 --- a/tests/Unit/NumericalPageOrderingHelperUnitTest.php +++ b/tests/Unit/NumericalPageOrderingHelperUnitTest.php @@ -9,10 +9,9 @@ use Hyde\Framework\Features\Navigation\NumericalPageOrderingHelper; /** - * @covers \Hyde\Framework\Features\Navigation\NumericalPageOrderingHelper - * * @see \Hyde\Framework\Testing\Feature\NumericalPageOrderingHelperTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Navigation\NumericalPageOrderingHelper::class)] class NumericalPageOrderingHelperUnitTest extends UnitTestCase { protected static bool $needsConfig = true; @@ -124,9 +123,8 @@ public function testIdentifiersForDeeplyNestedPagesWithoutNumericalPrefixesAreNo /** * @param class-string<\Hyde\Pages\Concerns\HydePage> $type - * - * @dataProvider pageTypeProvider */ + #[\PHPUnit\Framework\Attributes\DataProvider('pageTypeProvider')] public function testIdentifiersWithNumericalPrefixesAreDetectedForPageType(string $type) { $this->assertTrue(NumericalPageOrderingHelper::hasNumericalPrefix('01-home.'.$type::$fileExtension)); @@ -136,9 +134,8 @@ public function testIdentifiersWithNumericalPrefixesAreDetectedForPageType(strin /** * @param class-string<\Hyde\Pages\Concerns\HydePage> $type - * - * @dataProvider pageTypeProvider */ + #[\PHPUnit\Framework\Attributes\DataProvider('pageTypeProvider')] public function testIdentifiersWithoutNumericalPrefixesAreNotDetectedForPageType(string $type) { $this->assertFalse(NumericalPageOrderingHelper::hasNumericalPrefix('home.'.$type::$fileExtension)); @@ -148,9 +145,8 @@ public function testIdentifiersWithoutNumericalPrefixesAreNotDetectedForPageType /** * @param class-string<\Hyde\Pages\Concerns\HydePage> $type - * - * @dataProvider pageTypeProvider */ + #[\PHPUnit\Framework\Attributes\DataProvider('pageTypeProvider')] public function testIdentifiersWithNumericalPrefixesAreDetectedWhenUsingSnakeCaseDelimitersForPageType(string $type) { $this->assertTrue(NumericalPageOrderingHelper::hasNumericalPrefix('01_home.'.$type::$fileExtension)); @@ -160,9 +156,8 @@ public function testIdentifiersWithNumericalPrefixesAreDetectedWhenUsingSnakeCas /** * @param class-string<\Hyde\Pages\Concerns\HydePage> $type - * - * @dataProvider pageTypeProvider */ + #[\PHPUnit\Framework\Attributes\DataProvider('pageTypeProvider')] public function testSplitNumericPrefixForDeeplyNestedPagesForPageType(string $type) { $this->assertSame([1, 'foo/bar/home.'.$type::$fileExtension], NumericalPageOrderingHelper::splitNumericPrefix('foo/bar/01-home.'.$type::$fileExtension)); diff --git a/tests/Unit/PageModelParsingTest.php b/tests/Unit/PageModelParsingTest.php index e50175a1..358b91ca 100644 --- a/tests/Unit/PageModelParsingTest.php +++ b/tests/Unit/PageModelParsingTest.php @@ -11,13 +11,12 @@ /** * Test the constructor actions and schema constructors for page models. - * - * @covers \Hyde\Framework\Factories\Concerns\HasFactory - * @covers \Hyde\Framework\Factories\NavigationDataFactory - * @covers \Hyde\Framework\Factories\FeaturedImageFactory - * @covers \Hyde\Framework\Factories\HydePageDataFactory - * @covers \Hyde\Framework\Factories\BlogPostDataFactory */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\Concerns\HasFactory::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\NavigationDataFactory::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\FeaturedImageFactory::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\HydePageDataFactory::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Factories\BlogPostDataFactory::class)] class PageModelParsingTest extends UnitTestCase { use CreatesTemporaryFiles; diff --git a/tests/Unit/Pages/BladePageUnitTest.php b/tests/Unit/Pages/BladePageUnitTest.php index 14cec200..0e8ea4b2 100644 --- a/tests/Unit/Pages/BladePageUnitTest.php +++ b/tests/Unit/Pages/BladePageUnitTest.php @@ -13,9 +13,7 @@ use Hyde\Framework\Features\Metadata\PageMetadataBag; use Hyde\Framework\Factories\Concerns\CoreDataObject; -/** - * @covers \Hyde\Pages\BladePage - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\BladePage::class)] class BladePageUnitTest extends BaseHydePageUnitTest { public function testSourceDirectory() diff --git a/tests/Unit/Pages/DocumentationPageUnitTest.php b/tests/Unit/Pages/DocumentationPageUnitTest.php index bc727ef4..3e37ce76 100644 --- a/tests/Unit/Pages/DocumentationPageUnitTest.php +++ b/tests/Unit/Pages/DocumentationPageUnitTest.php @@ -15,9 +15,7 @@ use Hyde\Framework\Factories\Concerns\CoreDataObject; use Hyde\Framework\Features\Metadata\PageMetadataBag; -/** - * @covers \Hyde\Pages\DocumentationPage - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\DocumentationPage::class)] class DocumentationPageUnitTest extends BaseMarkdownPageUnitTest { public function testSourceDirectory() diff --git a/tests/Unit/Pages/HtmlPageTest.php b/tests/Unit/Pages/HtmlPageTest.php index f976cb44..8bcd46e4 100644 --- a/tests/Unit/Pages/HtmlPageTest.php +++ b/tests/Unit/Pages/HtmlPageTest.php @@ -7,9 +7,7 @@ use Hyde\Pages\HtmlPage; use Hyde\Testing\TestCase; -/** - * @covers \Hyde\Pages\HtmlPage - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\HtmlPage::class)] class HtmlPageTest extends TestCase { public function testHtmlPageCanBeCompiled() diff --git a/tests/Unit/Pages/HtmlPageUnitTest.php b/tests/Unit/Pages/HtmlPageUnitTest.php index 4603f594..0838e934 100644 --- a/tests/Unit/Pages/HtmlPageUnitTest.php +++ b/tests/Unit/Pages/HtmlPageUnitTest.php @@ -13,9 +13,7 @@ use Hyde\Framework\Features\Metadata\PageMetadataBag; use Hyde\Framework\Factories\Concerns\CoreDataObject; -/** - * @covers \Hyde\Pages\HtmlPage - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\HtmlPage::class)] class HtmlPageUnitTest extends BaseHydePageUnitTest { public function testSourceDirectory() diff --git a/tests/Unit/Pages/InMemoryPageTest.php b/tests/Unit/Pages/InMemoryPageTest.php index 5ae1ccce..42aef71f 100644 --- a/tests/Unit/Pages/InMemoryPageTest.php +++ b/tests/Unit/Pages/InMemoryPageTest.php @@ -9,10 +9,9 @@ use Hyde\Testing\TestCase; /** - * @covers \Hyde\Pages\InMemoryPage - * * @see \Hyde\Framework\Testing\Unit\Pages\InMemoryPageUnitTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\InMemoryPage::class)] class InMemoryPageTest extends TestCase { public function testConstructWithContentsString() diff --git a/tests/Unit/Pages/InMemoryPageUnitTest.php b/tests/Unit/Pages/InMemoryPageUnitTest.php index acfb0da0..ed76a546 100644 --- a/tests/Unit/Pages/InMemoryPageUnitTest.php +++ b/tests/Unit/Pages/InMemoryPageUnitTest.php @@ -15,10 +15,9 @@ use Hyde\Framework\Factories\Concerns\CoreDataObject; /** - * @covers \Hyde\Pages\InMemoryPage - * * @see \Hyde\Framework\Testing\Unit\Pages\InMemoryPageTest */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\InMemoryPage::class)] class InMemoryPageUnitTest extends BaseHydePageUnitTest { public function testSourceDirectory() diff --git a/tests/Unit/Pages/MarkdownPageUnitTest.php b/tests/Unit/Pages/MarkdownPageUnitTest.php index 1c45d018..2401f58e 100644 --- a/tests/Unit/Pages/MarkdownPageUnitTest.php +++ b/tests/Unit/Pages/MarkdownPageUnitTest.php @@ -15,9 +15,7 @@ use Hyde\Framework\Factories\Concerns\CoreDataObject; use Hyde\Framework\Features\Metadata\PageMetadataBag; -/** - * @covers \Hyde\Pages\MarkdownPage - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\MarkdownPage::class)] class MarkdownPageUnitTest extends BaseMarkdownPageUnitTest { public function testSourceDirectory() diff --git a/tests/Unit/Pages/MarkdownPostParserTest.php b/tests/Unit/Pages/MarkdownPostParserTest.php index 8c933156..0dc3c2c2 100644 --- a/tests/Unit/Pages/MarkdownPostParserTest.php +++ b/tests/Unit/Pages/MarkdownPostParserTest.php @@ -44,8 +44,8 @@ public function testCanParseMarkdownFile() $this->assertInstanceOf(Markdown::class, $post->markdown); $this->assertIsString($post->markdown->body()); $this->assertIsString($post->identifier); - $this->assertTrue(strlen((string) $post->markdown) > 32); - $this->assertTrue(strlen($post->identifier) > 8); + $this->assertGreaterThan(32, strlen((string) $post->markdown)); + $this->assertGreaterThan(8, strlen($post->identifier)); } public function testParsedMarkdownPostContainsValidFrontMatter() diff --git a/tests/Unit/Pages/MarkdownPostUnitTest.php b/tests/Unit/Pages/MarkdownPostUnitTest.php index 7768d9c2..bd72a040 100644 --- a/tests/Unit/Pages/MarkdownPostUnitTest.php +++ b/tests/Unit/Pages/MarkdownPostUnitTest.php @@ -15,9 +15,7 @@ use Hyde\Framework\Factories\Concerns\CoreDataObject; use Hyde\Framework\Features\Metadata\PageMetadataBag; -/** - * @covers \Hyde\Pages\MarkdownPost - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\MarkdownPost::class)] class MarkdownPostUnitTest extends BaseMarkdownPageUnitTest { public function testSourceDirectory() diff --git a/tests/Unit/Pages/PageModelGetFileHelpersTest.php b/tests/Unit/Pages/PageModelGetFileHelpersTest.php index 0586b311..0c632b55 100644 --- a/tests/Unit/Pages/PageModelGetFileHelpersTest.php +++ b/tests/Unit/Pages/PageModelGetFileHelpersTest.php @@ -27,7 +27,7 @@ public function testBladePageFilesHelperReturnsBladePageArray() $array = BladePage::files(); $this->assertCount(3, $array); $this->assertIsArray($array); - $this->assertEquals(['404', 'index', 'test-page'], $array); + $this->assertSame(['404', 'index', 'test-page'], $array); } public function testMarkdownPageFilesHelperReturnsMarkdownPageArray() @@ -37,7 +37,7 @@ public function testMarkdownPageFilesHelperReturnsMarkdownPageArray() $array = MarkdownPage::files(); $this->assertCount(1, $array); $this->assertIsArray($array); - $this->assertEquals(['test-page'], $array); + $this->assertSame(['test-page'], $array); } public function testMarkdownPostFilesHelperReturnsMarkdownPostArray() @@ -47,7 +47,7 @@ public function testMarkdownPostFilesHelperReturnsMarkdownPostArray() $array = MarkdownPost::files(); $this->assertCount(1, $array); $this->assertIsArray($array); - $this->assertEquals(['test-post'], $array); + $this->assertSame(['test-post'], $array); } public function testDocumentationPageFilesHelperReturnsDocumentationPageArray() @@ -57,7 +57,7 @@ public function testDocumentationPageFilesHelperReturnsDocumentationPageArray() $array = DocumentationPage::files(); $this->assertCount(1, $array); $this->assertIsArray($array); - $this->assertEquals(['test-page'], $array); + $this->assertSame(['test-page'], $array); } public function testBladePageAllHelperReturnsBladePageCollection() diff --git a/tests/Unit/Pages/PageModelParseHelperTest.php b/tests/Unit/Pages/PageModelParseHelperTest.php index 885a35a8..f1c69e00 100644 --- a/tests/Unit/Pages/PageModelParseHelperTest.php +++ b/tests/Unit/Pages/PageModelParseHelperTest.php @@ -11,9 +11,7 @@ use Hyde\Pages\MarkdownPost; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Pages\Concerns\HydePage::parse - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Pages\Concerns\HydePage::class)] class PageModelParseHelperTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/PostAuthorTest.php b/tests/Unit/PostAuthorTest.php index f7ad7902..d182c54d 100644 --- a/tests/Unit/PostAuthorTest.php +++ b/tests/Unit/PostAuthorTest.php @@ -13,10 +13,8 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Config; -/** - * @covers \Hyde\Framework\Features\Blogging\Models\PostAuthor - * @covers \Hyde\Foundation\Concerns\HasKernelData - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Features\Blogging\Models\PostAuthor::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Foundation\Concerns\HasKernelData::class)] class PostAuthorTest extends UnitTestCase { use FluentTestingHelpers; @@ -160,7 +158,7 @@ public function testFacadeCreateMethodAcceptsExtraParameters() { $author = Author::create('foo', 'https://example.com'); - $this->assertFalse(isset($author['username'])); + $this->assertArrayNotHasKey('username', $author); $this->assertSame('foo', $author['name']); $this->assertSame('https://example.com', $author['website']); } @@ -169,7 +167,7 @@ public function testFacadeCreateMethodAcceptsAllParameters() { $author = Author::create(...$this->exampleData()); - $this->assertFalse(isset($author['username'])); + $this->assertArrayNotHasKey('username', $author); $this->assertSame('Mr. Hyde', $author['name']); $this->assertSame('https://HydePHP.com', $author['website']); $this->assertSame('A mysterious figure. Is he as evil as he seems? And what did he do with Dr. Jekyll?', $author['bio']); @@ -398,7 +396,7 @@ public function testToArrayMethodReturnsArrayRepresentationOfAuthor() { $author = new PostAuthor('username', 'John Doe', 'https://example.com'); - $this->assertEquals([ + $this->assertSame([ 'username' => 'username', 'name' => 'John Doe', 'website' => 'https://example.com', @@ -409,7 +407,7 @@ public function testJsonSerializeMethodReturnsArrayRepresentationOfAuthor() { $author = new PostAuthor('username', 'John Doe', 'https://example.com'); - $this->assertEquals([ + $this->assertSame([ 'username' => 'username', 'name' => 'John Doe', 'website' => 'https://example.com', @@ -420,7 +418,7 @@ public function testArraySerializeMethodReturnsArrayRepresentationOfAuthor() { $author = new PostAuthor('username', 'John Doe', 'https://example.com'); - $this->assertEquals([ + $this->assertSame([ 'username' => 'username', 'name' => 'John Doe', 'website' => 'https://example.com', diff --git a/tests/Unit/RenderHelperTest.php b/tests/Unit/RenderHelperTest.php index e9919524..02627bbb 100644 --- a/tests/Unit/RenderHelperTest.php +++ b/tests/Unit/RenderHelperTest.php @@ -15,10 +15,8 @@ use Hyde\Support\Models\RenderData; use Illuminate\Support\Facades\View; -/** - * @covers \Hyde\Support\Models\RenderData - * @covers \Hyde\Support\Facades\Render - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Support\Models\RenderData::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Support\Facades\Render::class)] class RenderHelperTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/RouteKeyTest.php b/tests/Unit/RouteKeyTest.php index 7a0c107f..0eb00c91 100644 --- a/tests/Unit/RouteKeyTest.php +++ b/tests/Unit/RouteKeyTest.php @@ -13,9 +13,7 @@ use Hyde\Support\Models\RouteKey; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Support\Models\RouteKey - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Support\Models\RouteKey::class)] class RouteKeyTest extends UnitTestCase { protected static bool $needsConfig = true; diff --git a/tests/Unit/RouteNotFoundExceptionTest.php b/tests/Unit/RouteNotFoundExceptionTest.php index caa8dea1..9e42395f 100644 --- a/tests/Unit/RouteNotFoundExceptionTest.php +++ b/tests/Unit/RouteNotFoundExceptionTest.php @@ -7,9 +7,7 @@ use Hyde\Framework\Exceptions\RouteNotFoundException; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Framework\Exceptions\RouteNotFoundException - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Framework\Exceptions\RouteNotFoundException::class)] class RouteNotFoundExceptionTest extends UnitTestCase { public function testItCanBeInstantiated() diff --git a/tests/Unit/RouteTest.php b/tests/Unit/RouteTest.php index c5157cf0..b1e55ae3 100644 --- a/tests/Unit/RouteTest.php +++ b/tests/Unit/RouteTest.php @@ -10,9 +10,7 @@ use Hyde\Support\Models\RouteKey; use Hyde\Testing\UnitTestCase; -/** - * @covers \Hyde\Support\Models\Route - */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Hyde\Support\Models\Route::class)] class RouteTest extends UnitTestCase { protected static bool $needsKernel = true; diff --git a/tests/Unit/SchemaContractsTest.php b/tests/Unit/SchemaContractsTest.php index 6e83b0f1..be178855 100644 --- a/tests/Unit/SchemaContractsTest.php +++ b/tests/Unit/SchemaContractsTest.php @@ -34,39 +34,39 @@ class SchemaContractsTest extends UnitTestCase public function testSchemasAreNotAccidentallyChanged() { - $this->assertSame([ + $this->assertSame(PageSchema::PAGE_SCHEMA, [ 'title' => 'string', 'description' => 'string', 'canonicalUrl' => 'string', 'navigation' => NavigationSchema::NAVIGATION_SCHEMA, - ], PageSchema::PAGE_SCHEMA); + ]); - $this->assertSame([ + $this->assertSame(NavigationSchema::NAVIGATION_SCHEMA, [ 'label' => 'string', 'priority' => 'int', 'hidden' => 'bool', 'group' => 'string', - ], NavigationSchema::NAVIGATION_SCHEMA); + ]); - $this->assertSame([ + $this->assertSame(BlogPostSchema::BLOG_POST_SCHEMA, [ 'title' => 'string', 'description' => 'string', 'category' => 'string', 'date' => 'string', 'author' => ['string', AuthorSchema::AUTHOR_SCHEMA], 'image' => ['string', FeaturedImageSchema::FEATURED_IMAGE_SCHEMA], - ], BlogPostSchema::BLOG_POST_SCHEMA); + ]); - $this->assertSame([ + $this->assertSame(AuthorSchema::AUTHOR_SCHEMA, [ 'name' => 'string', 'username' => 'string', 'website' => 'string', 'bio' => 'string', 'avatar' => 'string', 'socials' => 'array