From 07ed73154d07220b112f66b60dd02866cb5e2030 Mon Sep 17 00:00:00 2001 From: Juan Pablo Barreto Date: Thu, 16 Mar 2023 10:40:33 +0100 Subject: [PATCH 1/2] Upgrade phpunit to v10 --- .gitattributes | 14 ++++++++++++++ .github/workflows/run-tests.yml | 6 ++++-- .gitignore | 1 + composer.json | 5 ++--- phpunit.xml.dist | 24 ++++++++++++------------ tests/ArrayPluckTest.php | 2 +- tests/AssertionsTest.php | 4 ++-- 7 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bec56a6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Path-based git attributes +# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html + +# Ignore all test and documentation with "export-ignore". +/.github export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/phpunit.xml.dist export-ignore +/tests export-ignore +/.editorconfig export-ignore +/.php_cs.dist.php export-ignore +/UPGRADING.md export-ignore +/phpstan.neon.dist export-ignore +/phpstan-baseline.neon export-ignore diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8350a25..ac26426 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,10 +13,11 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.0, 8.1] + php: [8.0, 8.1, 8.2] + phpunit: [^8.3, 9.*, 10.*] stability: [prefer-lowest, prefer-stable] - name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} + name: P${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - name: Checkout code @@ -35,6 +36,7 @@ jobs: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Install dependencies run: | + composer require "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: Execute tests run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index 9f1c2df..5e5124e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ /vendor/ /coverage/ .phpunit.result.cache +/.phpunit.cache composer.lock diff --git a/composer.json b/composer.json index 4f168ce..c60157e 100644 --- a/composer.json +++ b/composer.json @@ -19,14 +19,13 @@ "require": { "php": "^8.0.2", "illuminate/macroable": "^7.0|^8.0|^9.0", - "phpunit/phpunit": "^8.3|^9.0", + "phpunit/phpunit": "^8.3|^9.0|^10.0", "spatie/url": "^1.3.4|^2.0", "symfony/dom-crawler": "^5.4|^6.1" }, "require-dev": { "laravel/pint": "^1.0", - "phpstan/phpstan": "^1.0", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan": "^1.8" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 817bec2..b222853 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,15 @@ - - - - src/ - - - - - tests - - - + + + + src/ + + + + + tests + + + diff --git a/tests/ArrayPluckTest.php b/tests/ArrayPluckTest.php index ca36a49..4898d2a 100644 --- a/tests/ArrayPluckTest.php +++ b/tests/ArrayPluckTest.php @@ -18,7 +18,7 @@ public function test_should_pluck_array(array $expected, array $items, string $k ); } - public function pluckDataProvider(): array + public static function pluckDataProvider(): array { return [ 'It plucks the values' => [ diff --git a/tests/AssertionsTest.php b/tests/AssertionsTest.php index 6d4f72a..228ba35 100644 --- a/tests/AssertionsTest.php +++ b/tests/AssertionsTest.php @@ -51,7 +51,7 @@ public function test_should_break_on_assertions_case_2(callable $evaluation): vo $evaluation($testSeo); } - public function breakAssertionsCase2DataProvider(): array + public static function breakAssertionsCase2DataProvider(): array { return [ 'Empty canonical' => [fn (TestSEO $testSEO) => $testSEO->assertCanonicalIsEmpty()], @@ -96,7 +96,7 @@ public function test_should_break_on_assertions_case_3(callable $evaluation): vo $evaluation($testSeo); } - public function breakAssertionsCase3DataProvider(): array + public static function breakAssertionsCase3DataProvider(): array { return [ 'More than one h1' => [fn (TestSEO $testSEO) => $testSEO->assertThereIsOnlyOneH1()], From 3ef3cde7a9c41ff4067681569463f6f560b6e690 Mon Sep 17 00:00:00 2001 From: juampi92 Date: Thu, 16 Mar 2023 09:41:11 +0000 Subject: [PATCH 2/2] Fix styling --- src/Parser/HTMLParser.php | 3 --- src/Support/Memo.php | 1 - 2 files changed, 4 deletions(-) diff --git a/src/Parser/HTMLParser.php b/src/Parser/HTMLParser.php index 0202f89..19bc5fb 100644 --- a/src/Parser/HTMLParser.php +++ b/src/Parser/HTMLParser.php @@ -21,7 +21,6 @@ public function grabTextFrom(string $xpath): ?string } /** - * @param string $xpath * @param string|array $attributes * @return string|array|null */ @@ -37,9 +36,7 @@ public function grabAttributeFrom(string $xpath, $attributes) } /** - * @param string $xpath * @param string|array|null $attribute - * @return array */ public function grabMultiple(string $xpath, $attribute = null): array { diff --git a/src/Support/Memo.php b/src/Support/Memo.php index 225d08e..de17fbe 100644 --- a/src/Support/Memo.php +++ b/src/Support/Memo.php @@ -9,7 +9,6 @@ trait Memo /** * @template TValue * - * @param string $key * @param callable(): TValue $value * @return TValue */