Skip to content

Commit

Permalink
Merge pull request #8 from juampi92/chore/upgrade-phpunit10
Browse files Browse the repository at this point in the history
Upgrade phpunit to v10
  • Loading branch information
juampi92 authored Mar 16, 2023
2 parents d77b408 + 3ef3cde commit 9f2d590
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
/vendor/
/coverage/
.phpunit.result.cache
/.phpunit.cache

composer.lock
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
24 changes: 12 additions & 12 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Permissions Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Permissions Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
</php>
</phpunit>
3 changes: 0 additions & 3 deletions src/Parser/HTMLParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public function grabTextFrom(string $xpath): ?string
}

/**
* @param string $xpath
* @param string|array<string> $attributes
* @return string|array<string, string|null>|null
*/
Expand All @@ -37,9 +36,7 @@ public function grabAttributeFrom(string $xpath, $attributes)
}

/**
* @param string $xpath
* @param string|array<string>|null $attribute
* @return array
*/
public function grabMultiple(string $xpath, $attribute = null): array
{
Expand Down
1 change: 0 additions & 1 deletion src/Support/Memo.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ trait Memo
/**
* @template TValue
*
* @param string $key
* @param callable(): TValue $value
* @return TValue
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/ArrayPluckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/AssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down Expand Up @@ -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()],
Expand Down

0 comments on commit 9f2d590

Please sign in to comment.