Skip to content

Commit

Permalink
Merge pull request #63 from ARCANEDEV/laravel-11
Browse files Browse the repository at this point in the history
Adding Laravel 11 support
  • Loading branch information
arcanedev-maroc authored Mar 20, 2024
2 parents 78ec868 + 25ed271 commit 88bb830
Show file tree
Hide file tree
Showing 19 changed files with 174 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -48,7 +48,7 @@
},
"extra": {
"branch-alias": {
"dev-develop": "6.x-dev"
"dev-develop": "7.x-dev"
},
"laravel": {
"providers": [
Expand Down
10 changes: 6 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
bootstrap="vendor/autoload.php"
colors="true"
>
<source>
<include>
<directory>./src</directory>
</include>
</source>
<testsuites>
<testsuite name="Package Test Suite">
<directory>./tests/</directory>
<directory>./tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory>./src</directory>
</include>
<report>
<clover outputFile="build/coverage/clover.xml"/>
<html outputDirectory="build/coverage/html"/>
Expand Down
7 changes: 4 additions & 3 deletions tests/Entities/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,7 +58,7 @@ public function tearDown(): void
| -----------------------------------------------------------------
*/

/** @test */
#[Test]
public function it_can_be_instantiated(): void
{
$expectations = [
Expand All @@ -71,15 +72,15 @@ public function it_can_be_instantiated(): void
}
}

/** @test */
#[Test]
public function it_must_render_empty_on_init(): void
{
$this->analytics = new Analytics();

static::assertEmpty($this->analytics->render());
}

/** @test */
#[Test]
public function it_can_render(): void
{
static::assertGoogleAnalytics('UA-12345678-9', $this->analytics->render());
Expand Down
19 changes: 10 additions & 9 deletions tests/Entities/DescriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -51,7 +52,7 @@ public function tearDown(): void
| -----------------------------------------------------------------
*/

/** @test */
#[Test]
public function it_can_be_instantiated(): void
{
$expectations = [
Expand All @@ -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');
Expand All @@ -81,15 +82,15 @@ public function it_can_make(): void
}
}

/** @test */
#[Test]
public function it_can_get_default_description(): void
{
$content = $this->getDefaultContent();

static::assertSame($content, $this->description->getContent());
}

/** @test */
#[Test]
public function it_can_set_and_get_content(): void
{
$content = 'Cool description about this package';
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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(
Expand All @@ -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('');
Expand All @@ -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.';
Expand Down
15 changes: 8 additions & 7 deletions tests/Entities/KeywordsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -49,7 +50,7 @@ public function tearDown(): void
| -----------------------------------------------------------------
*/

/** @test */
#[Test]
public function it_can_be_instantiated(): void
{
$expectations = [
Expand All @@ -63,7 +64,7 @@ public function it_can_be_instantiated(): void
}
}

/** @test */
#[Test]
public function it_can_get_default_content(): void
{
$content = $this->getDefaultContent();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 5 additions & 4 deletions tests/Entities/MetaCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,7 +48,7 @@ public function tearDown(): void
| -----------------------------------------------------------------
*/

/** @test */
#[Test]
public function it_can_be_instantiated(): void
{
$expectations = [
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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);
Expand Down
15 changes: 8 additions & 7 deletions tests/Entities/MiscTagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -51,7 +52,7 @@ public function tearDown(): void
| -----------------------------------------------------------------
*/

/** @test */
#[Test]
public function it_can_be_instantiated(): void
{
$expectations = [
Expand All @@ -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');
Expand All @@ -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 = '<meta name="robots" content="noindex, nofollow">';
Expand All @@ -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';
Expand All @@ -116,7 +117,7 @@ public function it_can_render_links(): void
}
}

/** @test */
#[Test]
public function it_can_render(): void
{
$robots = '<meta name="robots" content="noindex, nofollow">';
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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([
Expand Down
Loading

0 comments on commit 88bb830

Please sign in to comment.