From 25ed271934298229a6dc746ab726160444f87613 Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Wed, 20 Mar 2024 23:57:31 +0000 Subject: [PATCH] Adding Laravel 11 support --- .github/workflows/run-tests.yml | 2 +- composer.json | 14 +++++----- phpunit.xml.dist | 10 ++++--- tests/Entities/AnalyticsTest.php | 7 ++--- tests/Entities/DescriptionTest.php | 19 ++++++------- tests/Entities/KeywordsTest.php | 15 ++++++----- tests/Entities/MetaCollectionTest.php | 9 ++++--- tests/Entities/MiscTagsTest.php | 15 ++++++----- tests/Entities/OpenGraph/GraphTest.php | 25 ++++++++--------- tests/Entities/TitleTest.php | 37 +++++++++++++------------- tests/Entities/Twitter/CardTest.php | 23 ++++++++-------- tests/Entities/WebmastersTest.php | 11 ++++---- tests/Helpers/MetaTest.php | 19 ++++++------- tests/SeoHelperServiceProviderTest.php | 5 ++-- tests/SeoHelperTest.php | 31 ++++++++++----------- tests/SeoMetaTest.php | 21 ++++++++------- tests/SeoOpenGraphTest.php | 29 ++++++++++---------- tests/SeoTwitterTest.php | 23 ++++++++-------- tests/Traits/SeoableTest.php | 15 ++++++----- 19 files changed, 174 insertions(+), 156 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6dc30dc..649bf06 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1, 8.2, 8.3] + php: [8.2, 8.3] dependency-version: [prefer-lowest, prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} diff --git a/composer.json b/composer.json index d198d6f..b15d427 100644 --- a/composer.json +++ b/composer.json @@ -17,16 +17,16 @@ "type": "library", "license": "MIT", "require": { - "php": "^8.1", - "arcanedev/php-html": "^7.0", - "arcanedev/support": "^10.0" + "php": "^8.2", + "arcanedev/php-html": "^8.0", + "arcanedev/support": "^11.0" }, "require-dev": { "ext-dom": "*", - "laravel/framework": "^10.0", + "laravel/framework": "^11.0", "laravel/pint": "^1.14", - "orchestra/testbench-core": "^8.23.4", - "phpunit/phpunit": "^10.0.7" + "orchestra/testbench-core": "^9.0", + "phpunit/phpunit": "^10.5|^11.0" }, "autoload": { "psr-4": { @@ -48,7 +48,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "6.x-dev" + "dev-develop": "7.x-dev" }, "laravel": { "providers": [ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8604987..5148b2a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,15 +4,17 @@ bootstrap="vendor/autoload.php" colors="true" > + + + ./src + + - ./tests/ + ./tests - - ./src - diff --git a/tests/Entities/AnalyticsTest.php b/tests/Entities/AnalyticsTest.php index e005fe3..93ce5ac 100644 --- a/tests/Entities/AnalyticsTest.php +++ b/tests/Entities/AnalyticsTest.php @@ -9,6 +9,7 @@ use Arcanedev\SeoHelper\Entities\Analytics; use Arcanedev\SeoHelper\Tests\TestCase; use Arcanedev\SeoHelper\Tests\Traits\CanAssertsGoogleAnalytics; +use PHPUnit\Framework\Attributes\Test; /** * Class AnalyticsTest @@ -57,7 +58,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -71,7 +72,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_must_render_empty_on_init(): void { $this->analytics = new Analytics(); @@ -79,7 +80,7 @@ public function it_must_render_empty_on_init(): void static::assertEmpty($this->analytics->render()); } - /** @test */ + #[Test] public function it_can_render(): void { static::assertGoogleAnalytics('UA-12345678-9', $this->analytics->render()); diff --git a/tests/Entities/DescriptionTest.php b/tests/Entities/DescriptionTest.php index 5b61c4d..a1bbc37 100644 --- a/tests/Entities/DescriptionTest.php +++ b/tests/Entities/DescriptionTest.php @@ -10,6 +10,7 @@ use Arcanedev\SeoHelper\Exceptions\InvalidArgumentException; use Arcanedev\SeoHelper\Tests\TestCase; use Illuminate\Support\Str; +use PHPUnit\Framework\Attributes\Test; /** * Class DescriptionTest @@ -51,7 +52,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -65,7 +66,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_make(): void { $this->description = Description::make('Cool description about this package'); @@ -81,7 +82,7 @@ public function it_can_make(): void } } - /** @test */ + #[Test] public function it_can_get_default_description(): void { $content = $this->getDefaultContent(); @@ -89,7 +90,7 @@ public function it_can_get_default_description(): void static::assertSame($content, $this->description->getContent()); } - /** @test */ + #[Test] public function it_can_set_and_get_content(): void { $content = 'Cool description about this package'; @@ -99,7 +100,7 @@ public function it_can_set_and_get_content(): void static::assertSame($content, $this->description->getContent()); } - /** @test */ + #[Test] public function it_can_set_and_get_max_length(): void { $max = 150; @@ -109,7 +110,7 @@ public function it_can_set_and_get_max_length(): void static::assertSame($max, $this->description->getMax()); } - /** @test */ + #[Test] public function it_must_throw_invalid_max_length_value(): void { $this->expectException(InvalidArgumentException::class); @@ -118,7 +119,7 @@ public function it_must_throw_invalid_max_length_value(): void $this->description->setMax(0); } - /** @test */ + #[Test] public function it_can_render(): void { $this->description->set( @@ -131,7 +132,7 @@ public function it_can_render(): void static::assertHtmlStringEqualsHtmlString($expected, $this->description->render()); } - /** @test */ + #[Test] public function it_can_render_empty_description(): void { $this->description->set(''); @@ -140,7 +141,7 @@ public function it_can_render_empty_description(): void static::assertEmpty((string) $this->description); } - /** @test */ + #[Test] public function it_can_render_long_title(): void { $content = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, ullamco laboris aliquip commodo.'; diff --git a/tests/Entities/KeywordsTest.php b/tests/Entities/KeywordsTest.php index e249ba9..d76e6d4 100644 --- a/tests/Entities/KeywordsTest.php +++ b/tests/Entities/KeywordsTest.php @@ -8,6 +8,7 @@ use Arcanedev\SeoHelper\Contracts\Renderable; use Arcanedev\SeoHelper\Entities\Keywords; use Arcanedev\SeoHelper\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; /** * Class KeywordsTest @@ -49,7 +50,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -63,7 +64,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_get_default_content(): void { $content = $this->getDefaultContent(); @@ -72,7 +73,7 @@ public function it_can_get_default_content(): void static::assertSame($content, $this->keywords->getContent()); } - /** @test */ + #[Test] public function it_can_set_and_get_content(): void { $content = $this->getDefaultContent(); @@ -94,7 +95,7 @@ public function it_can_set_and_get_content(): void static::assertSame([$keyword], $this->keywords->getContent()); } - /** @test */ + #[Test] public function it_can_add_a_keyword(): void { $content = $this->getDefaultContent(); @@ -111,7 +112,7 @@ public function it_can_add_a_keyword(): void static::assertSame($content, $this->keywords->getContent()); } - /** @test */ + #[Test] public function it_can_add_many_keywords(): void { $content = $this->getDefaultContent(); @@ -130,7 +131,7 @@ public function it_can_add_many_keywords(): void static::assertSame($content, $this->keywords->getContent()); } - /** @test */ + #[Test] public function it_can_render(): void { $content = $this->getDefaultContent(); @@ -160,7 +161,7 @@ public function it_can_render(): void static::assertHtmlStringEqualsHtmlString($expected, $this->keywords->render()); } - /** @test */ + #[Test] public function it_can_make(): void { $keywords = $this->getDefaultContent(); diff --git a/tests/Entities/MetaCollectionTest.php b/tests/Entities/MetaCollectionTest.php index 8edf861..d0af72f 100644 --- a/tests/Entities/MetaCollectionTest.php +++ b/tests/Entities/MetaCollectionTest.php @@ -8,6 +8,7 @@ use Arcanedev\SeoHelper\Entities\MetaCollection; use Arcanedev\SeoHelper\Tests\TestCase; use Illuminate\Support\Collection; +use PHPUnit\Framework\Attributes\Test; /** * Class MetaCollectionTest @@ -47,7 +48,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -63,7 +64,7 @@ public function it_can_be_instantiated(): void static::assertCount(0, $this->metas); } - /** @test */ + #[Test] public function it_can_add_meta(): void { $this->metas->addOne('robots', 'noindex, nofollow'); @@ -75,7 +76,7 @@ public function it_can_add_meta(): void static::assertCount(2, $this->metas); } - /** @test */ + #[Test] public function it_can_render_meta_tags(): void { $this->metas->addOne('robots', 'noindex, nofollow'); @@ -86,7 +87,7 @@ public function it_can_render_meta_tags(): void static::assertSame($expected, (string) $this->metas); } - /** @test */ + #[Test] public function it_can_render_link_tags(): void { $this->metas->addOne('canonical', $this->baseUrl); diff --git a/tests/Entities/MiscTagsTest.php b/tests/Entities/MiscTagsTest.php index 3c4dcc9..71bcaf6 100644 --- a/tests/Entities/MiscTagsTest.php +++ b/tests/Entities/MiscTagsTest.php @@ -8,6 +8,7 @@ use Arcanedev\SeoHelper\Contracts\Renderable; use Arcanedev\SeoHelper\Entities\MiscTags; use Arcanedev\SeoHelper\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; /** * Class MiscTagsTest @@ -51,7 +52,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -65,7 +66,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_render_canonical(): void { $this->misc->setUrl($url = 'http://laravel.com'); @@ -81,7 +82,7 @@ public function it_can_render_canonical(): void static::assertEmpty((string) $this->misc); } - /** @test */ + #[Test] public function it_can_render_robots(): void { $expected = ''; @@ -95,7 +96,7 @@ public function it_can_render_robots(): void static::assertEmpty((string) $this->misc); } - /** @test */ + #[Test] public function it_can_render_links(): void { $author = 'https://plus.google.com/+AuthorProfile'; @@ -116,7 +117,7 @@ public function it_can_render_links(): void } } - /** @test */ + #[Test] public function it_can_render(): void { $robots = ''; @@ -153,7 +154,7 @@ public function it_can_render(): void ]), $this->misc->render()); } - /** @test */ + #[Test] public function it_can_add_remove_and_reset_tags(): void { static::assertNotEmpty($this->misc->render()); @@ -218,7 +219,7 @@ public function it_can_add_remove_and_reset_tags(): void static::assertEmpty($this->misc->render()); } - /** @test */ + #[Test] public function it_can_make(): void { $this->misc = MiscTags::make([ diff --git a/tests/Entities/OpenGraph/GraphTest.php b/tests/Entities/OpenGraph/GraphTest.php index 2d9f905..514808d 100644 --- a/tests/Entities/OpenGraph/GraphTest.php +++ b/tests/Entities/OpenGraph/GraphTest.php @@ -8,6 +8,7 @@ use Arcanedev\SeoHelper\Contracts\Renderable; use Arcanedev\SeoHelper\Entities\OpenGraph\Graph; use Arcanedev\SeoHelper\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; /** * Class GraphTest @@ -49,7 +50,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -63,7 +64,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_render_defaults(): void { $output = $this->og->render(); @@ -74,7 +75,7 @@ public function it_can_render_defaults(): void static::assertHtmlStringEqualsHtmlString($expected, $output); } - /** @test */ + #[Test] public function it_can_set_and_render_type(): void { $types = [ @@ -94,7 +95,7 @@ public function it_can_set_and_render_type(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_title(): void { $title = 'Hello World'; @@ -107,7 +108,7 @@ public function it_can_set_and_render_title(): void static::assertStringContainsString($expected, (string) $this->og); } - /** @test */ + #[Test] public function it_can_set_and_render_description(): void { $description = 'Hello World detailed description.'; @@ -120,7 +121,7 @@ public function it_can_set_and_render_description(): void static::assertStringContainsString($expected, (string) $this->og); } - /** @test */ + #[Test] public function it_can_set_and_render_url(): void { $url = 'http://www.imdb.com/title/tt0080339/'; @@ -133,7 +134,7 @@ public function it_can_set_and_render_url(): void static::assertStringContainsString($expected, (string) $this->og); } - /** @test */ + #[Test] public function it_can_set_and_render_image(): void { $image = 'http://ia.media-imdb.com/images/M/MV5BNDU2MjE4MTcwNl5BMl5BanBnXkFtZTgwNDExOTMxMDE@._V1_UY1200_CR90,0,630,1200_AL_.jpg'; @@ -146,7 +147,7 @@ public function it_can_set_and_render_image(): void static::assertStringContainsString($expected, (string) $this->og); } - /** @test */ + #[Test] public function it_can_set_and_render_site_name(): void { $siteName = 'My site name'; @@ -159,7 +160,7 @@ public function it_can_set_and_render_site_name(): void static::assertStringContainsString($expected, (string) $this->og); } - /** @test */ + #[Test] public function it_can_add_render_property(): void { $locale = 'en_GB'; @@ -172,7 +173,7 @@ public function it_can_add_render_property(): void static::assertStringContainsString($expected, (string) $this->og); } - /** @test */ + #[Test] public function it_can_add_render_properties(): void { $properties = [ @@ -194,7 +195,7 @@ public function it_can_add_render_properties(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_locale_property(): void { $locales = ['fr_FR', 'en_GB', 'es_ES']; @@ -207,7 +208,7 @@ public function it_can_set_and_render_locale_property(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_alternative_properties(): void { $this->og->setAlternativeLocales(['fr_FR', 'en_GB', 'es_ES']); diff --git a/tests/Entities/TitleTest.php b/tests/Entities/TitleTest.php index 0e25535..b46d4d7 100644 --- a/tests/Entities/TitleTest.php +++ b/tests/Entities/TitleTest.php @@ -10,6 +10,7 @@ use Arcanedev\SeoHelper\Exceptions\InvalidArgumentException; use Arcanedev\SeoHelper\Tests\TestCase; use Illuminate\Support\{Arr, Str}; +use PHPUnit\Framework\Attributes\Test; /** * Class TitleTest @@ -51,7 +52,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -65,7 +66,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_get_default_title(): void { static::assertSame( @@ -74,7 +75,7 @@ public function it_can_get_default_title(): void ); } - /** @test */ + #[Test] public function it_can_set_and_get_title(): void { $title = 'Awesome Title'; @@ -84,7 +85,7 @@ public function it_can_set_and_get_title(): void static::assertSame($title, $this->title->getTitleOnly()); } - /** @test */ + #[Test] public function it_can_get_default_site_name(): void { static::assertSame( @@ -93,7 +94,7 @@ public function it_can_get_default_site_name(): void ); } - /** @test */ + #[Test] public function it_can_set_and_get_site_name(): void { $siteName = 'Company name'; @@ -103,7 +104,7 @@ public function it_can_set_and_get_site_name(): void static::assertSame($siteName, $this->title->getSiteName()); } - /** @test */ + #[Test] public function it_can_get_default_separator(): void { static::assertSame( @@ -112,7 +113,7 @@ public function it_can_get_default_separator(): void ); } - /** @test */ + #[Test] public function it_can_get_and_set_separator(): void { $separator = '|'; @@ -126,7 +127,7 @@ public function it_can_get_and_set_separator(): void static::assertSame(trim($separator), $this->title->getSeparator()); } - /** @test */ + #[Test] public function it_can_get_default_title_position(): void { static::assertSame( @@ -135,7 +136,7 @@ public function it_can_get_default_title_position(): void ); } - /** @test */ + #[Test] public function it_can_switch_title_position(): void { static::assertTrue($this->title->isTitleFirst()); @@ -149,7 +150,7 @@ public function it_can_switch_title_position(): void static::assertTrue($this->title->isTitleFirst()); } - /** @test */ + #[Test] public function it_can_render_default_title(): void { $title = $this->getDefaultTitle(); @@ -160,7 +161,7 @@ public function it_can_render_default_title(): void static::assertHtmlStringEqualsHtmlString($expected, $this->title->render()); } - /** @test */ + #[Test] public function it_can_render_custom_titles(): void { $title = 'Awesome Title'; @@ -225,7 +226,7 @@ public function it_can_render_custom_titles(): void static::assertHtmlStringEqualsHtmlString($expected, $this->title->render()); } - /** @test */ + #[Test] public function it_can_make_title_tag(): void { $title = 'Awesome title'; @@ -246,7 +247,7 @@ public function it_can_make_title_tag(): void static::assertHtmlStringEqualsHtmlString($expected, $this->title->render()); } - /** @test */ + #[Test] public function it_can_toggle_site_name_visibility(): void { $title = 'Awesome title'; @@ -275,7 +276,7 @@ public function it_can_toggle_site_name_visibility(): void static::assertHtmlStringEqualsHtmlString($expected, $this->title->render()); } - /** @test */ + #[Test] public function it_must_throw_title_exception_on_empty_title(): void { $this->expectException(InvalidArgumentException::class); @@ -284,7 +285,7 @@ public function it_must_throw_title_exception_on_empty_title(): void $this->title->set(' '); } - /** @test */ + #[Test] public function it_can_set_and_get_max_length(): void { $this->title->setMax($max = 50); @@ -292,7 +293,7 @@ public function it_can_set_and_get_max_length(): void static::assertSame($max, $this->title->getMax()); } - /** @test */ + #[Test] public function it_can_render_long_title(): void { $title = 'This is my long and awesome title that gonna blown your mind.'; @@ -306,7 +307,7 @@ public function it_can_render_long_title(): void static::assertHtmlStringEqualsHtmlString($expected, $this->title->render()); } - /** @test */ + #[Test] public function it_can_render_title_with_accents(): void { $this->title->set('Ce package est intuitif, exceptionnel et bien sûr opérationnel'); @@ -317,7 +318,7 @@ public function it_can_render_title_with_accents(): void static::assertHtmlStringEqualsHtmlString($expected, $this->title->render()); } - /** @test */ + #[Test] public function it_must_throw_invalid_max_length_value(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Entities/Twitter/CardTest.php b/tests/Entities/Twitter/CardTest.php index 93fada7..332995c 100644 --- a/tests/Entities/Twitter/CardTest.php +++ b/tests/Entities/Twitter/CardTest.php @@ -9,6 +9,7 @@ use Arcanedev\SeoHelper\Entities\Twitter\Card; use Arcanedev\SeoHelper\Exceptions\InvalidTwitterCardException; use Arcanedev\SeoHelper\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; /** * Class CardTest @@ -50,7 +51,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -64,7 +65,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_set_type_and_render(): void { $supported = [ @@ -81,7 +82,7 @@ public function it_can_set_type_and_render(): void } } - /** @test */ + #[Test] public function it_must_throw_invalid_twitter_card_exception_on_unsupported_type(): void { $this->expectException(InvalidTwitterCardException::class); @@ -90,7 +91,7 @@ public function it_must_throw_invalid_twitter_card_exception_on_unsupported_type $this->card->setType('selfie'); } - /** @test */ + #[Test] public function it_can_set_prefix(): void { $prefix = 'twt:'; @@ -105,7 +106,7 @@ public function it_can_set_prefix(): void static::assertStringContainsString($expected, (string) $this->card); } - /** @test */ + #[Test] public function it_can_set_and_render_title(): void { $title = 'Hello world'; @@ -117,7 +118,7 @@ public function it_can_set_and_render_title(): void static::assertStringContainsString($expected, (string) $this->card); } - /** @test */ + #[Test] public function it_can_set_and_render_description(): void { $description = 'Hello world description'; @@ -129,7 +130,7 @@ public function it_can_set_and_render_description(): void static::assertStringContainsString($expected, (string) $this->card); } - /** @test */ + #[Test] public function it_can_set_and_render_site(): void { $site = 'Arcanedev'; @@ -146,7 +147,7 @@ public function it_can_set_and_render_site(): void static::assertStringContainsString($excepted, (string) $this->card); } - /** @test */ + #[Test] public function it_can_add_and_render_one_image(): void { $avatar = 'http://example.com/img/avatar.png'; @@ -157,7 +158,7 @@ public function it_can_add_and_render_one_image(): void static::assertStringContainsString($expected, (string) $this->card); } - /** @test */ + #[Test] public function it_can_add_and_render_multiple_images(): void { $avatar = 'http://example.com/img/avatar.png'; @@ -176,7 +177,7 @@ public function it_can_add_and_render_multiple_images(): void static::assertStringNotContainsString('twitter:image4', $output); } - /** @test */ + #[Test] public function it_can_add_and_render_many_metas(): void { $metas = [ @@ -198,7 +199,7 @@ public function it_can_add_and_render_many_metas(): void } } - /** @test */ + #[Test] public function it_can_reset(): void { $expected = $this->card->render(); diff --git a/tests/Entities/WebmastersTest.php b/tests/Entities/WebmastersTest.php index ec1cdec..a05ea15 100644 --- a/tests/Entities/WebmastersTest.php +++ b/tests/Entities/WebmastersTest.php @@ -8,6 +8,7 @@ use Arcanedev\SeoHelper\Contracts\Renderable; use Arcanedev\SeoHelper\Entities\Webmasters; use Arcanedev\SeoHelper\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; /** * Class WebmastersTest @@ -49,7 +50,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -63,7 +64,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_render_defaults(): void { $expectations = [ @@ -80,7 +81,7 @@ public function it_can_render_defaults(): void } } - /** @test */ + #[Test] public function it_can_make_and_add(): void { $this->webmasters = Webmasters::make([ @@ -100,7 +101,7 @@ public function it_can_make_and_add(): void } } - /** @test */ + #[Test] public function it_can_skip_unsupported_webmasters(): void { $this->webmasters = Webmasters::make([ @@ -111,7 +112,7 @@ public function it_can_skip_unsupported_webmasters(): void static::assertEmpty((string) $this->webmasters); } - /** @test */ + #[Test] public function it_can_reset(): void { static::assertNotEmpty($this->webmasters->render()); diff --git a/tests/Helpers/MetaTest.php b/tests/Helpers/MetaTest.php index 784c2bd..35dd3c0 100644 --- a/tests/Helpers/MetaTest.php +++ b/tests/Helpers/MetaTest.php @@ -9,6 +9,7 @@ use Arcanedev\SeoHelper\Exceptions\InvalidArgumentException; use Arcanedev\SeoHelper\Helpers\Meta; use Arcanedev\SeoHelper\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; /** * Class MetaTest @@ -22,7 +23,7 @@ class MetaTest extends TestCase | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $results = [ @@ -46,7 +47,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_valid(): void { $validMetas = [ @@ -69,7 +70,7 @@ public function it_can_valid(): void } } - /** @test */ + #[Test] public function it_can_render(): void { static::assertSame( @@ -93,7 +94,7 @@ public function it_can_render(): void ); } - /** @test */ + #[Test] public function it_can_make_meta_with_prefix(): void { $meta = Meta::make('hello', 'Hello World', 'name', 'say:'); @@ -111,7 +112,7 @@ public function it_can_make_meta_with_prefix(): void ); } - /** @test */ + #[Test] public function it_can_clean_and_render(): void { $name = 'Awesome name'; @@ -123,7 +124,7 @@ public function it_can_clean_and_render(): void ); } - /** @test */ + #[Test] public function it_can_make_meta_with_custom_name_property(): void { $meta = Meta::make('title', 'Hello World', 'property', 'og:'); @@ -134,7 +135,7 @@ public function it_can_make_meta_with_custom_name_property(): void ); } - /** @test */ + #[Test] public function it_can_set_name_property(): void { $meta = Meta::make('title', 'Hello World'); @@ -148,7 +149,7 @@ public function it_can_set_name_property(): void ); } - /** @test */ + #[Test] public function it_must_throw_an_invalid_argument_exception_on_not_allowed_name(): void { $this->expectException(InvalidArgumentException::class); @@ -157,7 +158,7 @@ public function it_must_throw_an_invalid_argument_exception_on_not_allowed_name( Meta::make('title', 'Hello World')->setNameProperty('foo'); } - /** @test */ + #[Test] public function it_can_render_array_content(): void { $meta = Meta::make('locale:alternate', ['fr_FR', 'es_ES', 'en_GB']); diff --git a/tests/SeoHelperServiceProviderTest.php b/tests/SeoHelperServiceProviderTest.php index ca0be2e..4dfa407 100644 --- a/tests/SeoHelperServiceProviderTest.php +++ b/tests/SeoHelperServiceProviderTest.php @@ -9,6 +9,7 @@ use Arcanedev\Support\Providers\{PackageServiceProvider, ServiceProvider}; use Illuminate\Contracts\Support\DeferrableProvider; use Illuminate\Support\ServiceProvider as IlluminateServiceProvider; +use PHPUnit\Framework\Attributes\Test; /** * Class SeoHelperServiceProviderTest @@ -48,7 +49,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_get_service_provider(): void { $expectations = [ @@ -64,7 +65,7 @@ public function it_can_get_service_provider(): void } } - /** @test */ + #[Test] public function it_can_provides(): void { $expected = [ diff --git a/tests/SeoHelperTest.php b/tests/SeoHelperTest.php index af7e926..ebea805 100644 --- a/tests/SeoHelperTest.php +++ b/tests/SeoHelperTest.php @@ -12,6 +12,7 @@ use Arcanedev\SeoHelper\SeoMeta; use Arcanedev\SeoHelper\SeoOpenGraph; use Illuminate\Support\HtmlString; +use PHPUnit\Framework\Attributes\Test; /** * Class SeoHelperTest @@ -51,7 +52,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -65,7 +66,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_be_instantiated_with_helper(): void { $this->seoHelper = seo_helper(); @@ -80,7 +81,7 @@ public function it_can_be_instantiated_with_helper(): void } } - /** @test */ + #[Test] public function it_can_get_seo_meta(): void { $seoMeta = $this->seoHelper->meta(); @@ -96,7 +97,7 @@ public function it_can_get_seo_meta(): void } } - /** @test */ + #[Test] public function it_can_get_seo_open_graph(): void { $ogs = [ @@ -117,7 +118,7 @@ public function it_can_get_seo_open_graph(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_title(): void { $title = 'Hello World'; @@ -138,7 +139,7 @@ public function it_can_set_and_render_title(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_site_name(): void { $title = 'My Application'; @@ -160,7 +161,7 @@ public function it_can_set_and_render_site_name(): void } } - /** @test */ + #[Test] public function it_can_toggle_site_name_visibility(): void { $title = 'My Application'; @@ -188,7 +189,7 @@ public function it_can_toggle_site_name_visibility(): void ); } - /** @test */ + #[Test] public function it_can_set_and_render_description(): void { $description = 'ARCANEDEV super description'; @@ -206,7 +207,7 @@ public function it_can_set_and_render_description(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_keywords(): void { $keywords = $this->getSeoHelperConfig('keywords.default'); @@ -223,7 +224,7 @@ public function it_can_set_and_render_keywords(): void static::assertStringContainsString($expected, (string) $this->seoHelper); } - /** @test */ + #[Test] public function it_can_set_and_render_image(): void { $this->seoHelper->setImage($imageUrl = 'http://localhost/assets/img/logo.png'); @@ -240,7 +241,7 @@ public function it_can_set_and_render_image(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_url(): void { $this->seoHelper->setUrl($url = 'http://localhost/path'); @@ -257,7 +258,7 @@ public function it_can_set_and_render_url(): void } } - /** @test */ + #[Test] public function it_can_render_all(): void { $output = $this->seoHelper->render(); @@ -265,7 +266,7 @@ public function it_can_render_all(): void static::assertNotEmpty($output); } - /** @test */ + #[Test] public function it_can_render_all_with_html_string_object(): void { $output = $this->seoHelper->renderHtml(); @@ -274,7 +275,7 @@ public function it_can_render_all_with_html_string_object(): void static::assertNotEmpty($output->toHtml()); } - /** @test */ + #[Test] public function it_can_enable_and_disable_open_graph(): void { $needle = 'seoMeta->render()); } - /** @test */ + #[Test] public function it_can_be_instantiated_by_container(): void { $this->seoMeta = $this->app[SeoMetaContract::class]; @@ -97,7 +98,7 @@ public function it_can_be_instantiated_by_container(): void static::assertNotEmpty((string) $this->seoMeta); } - /** @test */ + #[Test] public function it_can_set_and_get_and_render_title(): void { $title = 'Awesome Title'; @@ -142,7 +143,7 @@ public function it_can_set_and_get_and_render_title(): void static::assertSame($separator, $titleEntity->getSeparator()); } - /** @test */ + #[Test] public function it_can_set_and_get_and_render_description(): void { $description = 'Awesome Description'; @@ -167,7 +168,7 @@ public function it_can_set_and_get_and_render_description(): void static::assertSame($description, $descriptionEntity->getContent()); } - /** @test */ + #[Test] public function it_can_set_and_get_and_render_keywords(): void { $keywords = ['keyword-1', 'keyword-2', 'keyword-3', 'keyword-4', 'keyword-5']; @@ -202,7 +203,7 @@ public function it_can_set_and_get_and_render_keywords(): void static::assertSame($keywords, $keywordsEntity->getContent()); } - /** @test */ + #[Test] public function it_can_add_one_keyword(): void { $keywords = ['keyword-1', 'keyword-2', 'keyword-3', 'keyword-4', 'keyword-5']; @@ -222,7 +223,7 @@ public function it_can_add_one_keyword(): void static::assertStringContainsString($expected, (string) $this->seoMeta); } - /** @test */ + #[Test] public function it_can_add_many_keywords(): void { $keywords = ['keyword-1', 'keyword-2', 'keyword-3', 'keyword-4', 'keyword-5']; @@ -242,7 +243,7 @@ public function it_can_add_many_keywords(): void static::assertStringContainsString($expected, (string) $this->seoMeta); } - /** @test */ + #[Test] public function it_can_add_remove_reset_and_render_a_misc_tag(): void { $expectations = [ @@ -325,7 +326,7 @@ public function it_can_add_remove_reset_and_render_a_misc_tag(): void static::assertMetaCollection($miscEntity->all()); } - /** @test */ + #[Test] public function it_can_render_add_reset_webmasters(): void { $expectations = [ @@ -369,7 +370,7 @@ public function it_can_render_add_reset_webmasters(): void static::assertMetaCollection($webmastersEntity->all()); } - /** @test */ + #[Test] public function it_can_set_and_render_google_analytics(): void { static::assertGoogleAnalytics('UA-12345678-9', $this->seoMeta->render()); diff --git a/tests/SeoOpenGraphTest.php b/tests/SeoOpenGraphTest.php index 8d746aa..26f1c51 100644 --- a/tests/SeoOpenGraphTest.php +++ b/tests/SeoOpenGraphTest.php @@ -7,6 +7,7 @@ use Arcanedev\SeoHelper\Contracts\Renderable; use Arcanedev\SeoHelper\Contracts\SeoOpenGraph as SeoOpenGraphContract; use Arcanedev\SeoHelper\SeoOpenGraph; +use PHPUnit\Framework\Attributes\Test; /** * Class SeoOpenGraphTest @@ -48,7 +49,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -62,7 +63,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_render_defaults(): void { $expectations = [ @@ -77,7 +78,7 @@ public function it_can_render_defaults(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_prefix(): void { $this->seoOpenGraph->setPrefix('open-graph:'); @@ -94,7 +95,7 @@ public function it_can_set_and_render_prefix(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_type(): void { $types = [ @@ -114,7 +115,7 @@ public function it_can_set_and_render_type(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_title(): void { $title = 'Hello World'; @@ -127,7 +128,7 @@ public function it_can_set_and_render_title(): void static::assertStringContainsString($expected, (string) $this->seoOpenGraph); } - /** @test */ + #[Test] public function it_can_set_and_render_description(): void { $description = 'Hello World detailed description.'; @@ -140,7 +141,7 @@ public function it_can_set_and_render_description(): void static::assertStringContainsString($expected, (string) $this->seoOpenGraph); } - /** @test */ + #[Test] public function it_can_set_and_render_url(): void { $url = 'http://www.imdb.com/title/tt0080339/'; @@ -153,7 +154,7 @@ public function it_can_set_and_render_url(): void static::assertStringContainsString($expected, (string) $this->seoOpenGraph); } - /** @test */ + #[Test] public function it_can_set_and_render_image(): void { $image = 'http://ia.media-imdb.com/images/M/MV5BNDU2MjE4MTcwNl5BMl5BanBnXkFtZTgwNDExOTMxMDE@._V1_UY1200_CR90,0,630,1200_AL_.jpg'; @@ -166,7 +167,7 @@ public function it_can_set_and_render_image(): void static::assertStringContainsString($expected, (string) $this->seoOpenGraph); } - /** @test */ + #[Test] public function it_can_set_and_render_site_name(): void { $siteName = 'My site name'; @@ -179,7 +180,7 @@ public function it_can_set_and_render_site_name(): void static::assertStringContainsString($expected, (string) $this->seoOpenGraph); } - /** @test */ + #[Test] public function it_can_add_and_render_property(): void { $locales = [ @@ -196,7 +197,7 @@ public function it_can_add_and_render_property(): void } } - /** @test */ + #[Test] public function it_can_add_render_properties(): void { $properties = [ @@ -218,7 +219,7 @@ public function it_can_add_render_properties(): void } } - /** @test */ + #[Test] public function it_can_enable_and_disable(): void { static::assertTrue($this->seoOpenGraph->isEnabled()); @@ -238,7 +239,7 @@ public function it_can_enable_and_disable(): void static::assertNotEmpty($this->seoOpenGraph->render()); } - /** @test */ + #[Test] public function it_can_set_and_render_locale_property(): void { $locales = ['fr_FR', 'en_GB', 'es_ES']; @@ -251,7 +252,7 @@ public function it_can_set_and_render_locale_property(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_alternative_properties(): void { $this->seoOpenGraph->setAlternativeLocales(['fr_FR', 'en_GB', 'es_ES']); diff --git a/tests/SeoTwitterTest.php b/tests/SeoTwitterTest.php index 9a07597..101983f 100644 --- a/tests/SeoTwitterTest.php +++ b/tests/SeoTwitterTest.php @@ -7,6 +7,7 @@ use Arcanedev\SeoHelper\Contracts\Renderable; use Arcanedev\SeoHelper\Contracts\SeoTwitter as SeoTwitterContract; use Arcanedev\SeoHelper\SeoTwitter; +use PHPUnit\Framework\Attributes\Test; /** * Class SeoTwitterTest @@ -48,7 +49,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_be_instantiated(): void { $expectations = [ @@ -62,7 +63,7 @@ public function it_can_be_instantiated(): void } } - /** @test */ + #[Test] public function it_can_render_defaults(): void { $output = $this->seoTwitter->render(); @@ -78,7 +79,7 @@ public function it_can_render_defaults(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_type(): void { $this->seoTwitter->setType('app'); @@ -89,7 +90,7 @@ public function it_can_set_and_render_type(): void static::assertStringContainsString($expected, (string) $this->seoTwitter); } - /** @test */ + #[Test] public function it_can_set_and_render_site(): void { $this->seoTwitter->setSite('Arcanedev'); @@ -100,7 +101,7 @@ public function it_can_set_and_render_site(): void static::assertStringContainsString($expected, (string) $this->seoTwitter); } - /** @test */ + #[Test] public function it_can_set_and_render_title(): void { $this->seoTwitter->setTitle('ARCANEDEV super title'); @@ -111,7 +112,7 @@ public function it_can_set_and_render_title(): void static::assertStringContainsString($expected, (string) $this->seoTwitter); } - /** @test */ + #[Test] public function it_can_set_and_render_description(): void { $this->seoTwitter->setDescription('ARCANEDEV super description'); @@ -122,7 +123,7 @@ public function it_can_set_and_render_description(): void static::assertStringContainsString($expected, (string) $this->seoTwitter); } - /** @test */ + #[Test] public function it_can_add_and_render_image(): void { $this->seoTwitter->addImage('http://example.com/img/avatar.png'); @@ -133,7 +134,7 @@ public function it_can_add_and_render_image(): void static::assertStringContainsString($expected, (string) $this->seoTwitter); } - /** @test */ + #[Test] public function it_can_reset_card(): void { $expected = $this->seoTwitter->render(); @@ -150,7 +151,7 @@ public function it_can_reset_card(): void static::assertSame($expected, $this->seoTwitter->render()); } - /** @test */ + #[Test] public function it_can_add_and_render_a_meta(): void { $this->seoTwitter->addMeta('creator', '@Arcanedev'); @@ -161,7 +162,7 @@ public function it_can_add_and_render_a_meta(): void static::assertStringContainsString($expected, (string) $this->seoTwitter); } - /** @test */ + #[Test] public function it_can_add_and_render_many_metas(): void { $metas = [ @@ -183,7 +184,7 @@ public function it_can_add_and_render_many_metas(): void } } - /** @test */ + #[Test] public function it_can_enable_and_disable(): void { static::assertTrue($this->seoTwitter->isEnabled()); diff --git a/tests/Traits/SeoableTest.php b/tests/Traits/SeoableTest.php index c94ff53..4dd5174 100644 --- a/tests/Traits/SeoableTest.php +++ b/tests/Traits/SeoableTest.php @@ -15,6 +15,7 @@ use Arcanedev\SeoHelper\SeoTwitter; use Arcanedev\SeoHelper\Tests\Stubs\Dummy; use Arcanedev\SeoHelper\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; /** * Class SeoableTest @@ -54,7 +55,7 @@ public function tearDown(): void | ----------------------------------------------------------------- */ - /** @test */ + #[Test] public function it_can_get_main_helper(): void { $seoHelper = $this->dummy->seo(); @@ -70,7 +71,7 @@ public function it_can_get_main_helper(): void } } - /** @test */ + #[Test] public function it_can_get_meta_helper(): void { $seoMeta = $this->dummy->seoMeta(); @@ -86,7 +87,7 @@ public function it_can_get_meta_helper(): void } } - /** @test */ + #[Test] public function it_can_get_open_graph_helper(): void { $seoOpenGraph = $this->dummy->seoGraph(); @@ -102,7 +103,7 @@ public function it_can_get_open_graph_helper(): void } } - /** @test */ + #[Test] public function it_can_get_twitter_card_helper(): void { $seoTwitter = $this->dummy->seoCard(); @@ -117,7 +118,7 @@ public function it_can_get_twitter_card_helper(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_title(): void { $title = 'Hello World'; @@ -140,7 +141,7 @@ public function it_can_set_and_render_title(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_description(): void { $description = 'ARCANEDEV super description'; @@ -161,7 +162,7 @@ public function it_can_set_and_render_description(): void } } - /** @test */ + #[Test] public function it_can_set_and_render_keywords(): void { $keywords = $this->getSeoHelperConfig('keywords.default');