diff --git a/.gitattributes b/.gitattributes index f9347ec94..54126231a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,4 +14,5 @@ .styleci.yml export-ignore CHANGELOG.md export-ignore phpunit.xml.dist export-ignore +phpunit9.xml.dist export-ignore UPGRADE.md export-ignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cf3c75569..326ede1ac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,10 @@ jobs: exclude: - php: '8.0' laravel: 10 + - php: '8.0' + phpunit: 10 + - laravel: 9 + phpunit: 10 name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - PHPUnit ${{ matrix.phpunit }} @@ -44,7 +48,12 @@ jobs: composer update --prefer-dist --no-interaction --no-progress - name: Execute tests - run: vendor/bin/phpunit --verbose + if: matrix.phpunit == '9' + run: vendor/bin/phpunit -c phpunit9.xml.dist --verbose + + - name: Execute tests + if: matrix.phpunit != '9' + run: vendor/bin/phpunit -c phpunit.xml.dist stub-tests: runs-on: ubuntu-22.04 @@ -82,7 +91,7 @@ jobs: run: | composer update "laravel/dusk" --prefer-dist --no-interaction --no-progress -W php artisan dusk:install - + - name: Update Chrome Driver run: php artisan dusk:chrome-driver --detect diff --git a/bin/.gitignore b/bin/.gitignore index d593978d2..230e35804 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1 +1,2 @@ chromedriver-* +LICENSE.chromedriver diff --git a/composer.json b/composer.json index 4b0b7fe3e..f1f4c3ce4 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ }, "require-dev": { "mockery/mockery": "^1.4.2", - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^9.5.10|^10.0.1", "orchestra/testbench": "^7.0|^8.0" }, "suggest": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 43944eb06..59a79a707 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,19 +1,18 @@ - diff --git a/phpunit9.xml.dist b/phpunit9.xml.dist new file mode 100644 index 000000000..43944eb06 --- /dev/null +++ b/phpunit9.xml.dist @@ -0,0 +1,23 @@ + + + + + ./tests + + + diff --git a/src/Concerns/ProvidesBrowser.php b/src/Concerns/ProvidesBrowser.php index 0b0275789..12f6f6893 100644 --- a/src/Concerns/ProvidesBrowser.php +++ b/src/Concerns/ProvidesBrowser.php @@ -6,6 +6,7 @@ use Exception; use Illuminate\Support\Collection; use Laravel\Dusk\Browser; +use PHPUnit\Runner\Version; use ReflectionFunction; use Throwable; @@ -227,7 +228,11 @@ protected function createWebDriver() */ protected function getCallerName() { - return str_replace('\\', '_', get_class($this)).'_'.$this->getName(false); + $name = version_compare(Version::id(), '10', '>=') + ? $this->name() + : $this->getName(false); + + return str_replace('\\', '_', get_class($this)).'_'.$name; } /** diff --git a/tests/Concerns/InteractsWithElementsTest.php b/tests/Concerns/InteractsWithElementsTest.php index ea64202f8..a480daae0 100644 --- a/tests/Concerns/InteractsWithElementsTest.php +++ b/tests/Concerns/InteractsWithElementsTest.php @@ -23,7 +23,7 @@ class InteractsWithElementsTest extends TestCase /** @var RemoteWebDriver|MockObject */ protected $driver; - public function dataProviderValueWithValue() + public static function dataProviderValueWithValue() { return [ ['#nuff', 'narf', 'document.querySelector("#nuff").value = "narf";'], diff --git a/tests/ProvidesBrowserTest.php b/tests/ProvidesBrowserTest.php index ef3be07d1..7e4b8d65b 100644 --- a/tests/ProvidesBrowserTest.php +++ b/tests/ProvidesBrowserTest.php @@ -44,7 +44,7 @@ public function test_store_console_logs_for() $this->storeConsoleLogsFor($browsers); } - public function testData() + public static function testData() { return [ ['foo'],