diff --git a/.github/workflows/phpunit-l10.yml b/.github/workflows/phpunit-l10.yml index 820fb95..fa76222 100644 --- a/.github/workflows/phpunit-l10.yml +++ b/.github/workflows/phpunit-l10.yml @@ -46,5 +46,8 @@ jobs: composer require "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --no-progress composer update --${{ matrix.dependency }} --prefer-dist --no-interaction --no-suggest --no-progress + - name: Migrate configuration file + run: vendor/bin/phpunit --migrate-configuration || true + - name: Execute tests run: vendor/bin/phpunit diff --git a/.github/workflows/phpunit-l11.yml b/.github/workflows/phpunit-l11.yml index e9c8cdf..5358e0a 100644 --- a/.github/workflows/phpunit-l11.yml +++ b/.github/workflows/phpunit-l11.yml @@ -46,5 +46,8 @@ jobs: composer require "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update composer update --${{ matrix.dependency }} --prefer-dist --no-interaction --no-suggest + - name: Migrate configuration file + run: vendor/bin/phpunit --migrate-configuration + - name: Execute tests run: vendor/bin/phpunit diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4f93b8c..c518307 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,7 +12,7 @@ processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> - + tests diff --git a/tests/Components/LinkTest.php b/tests/Components/LinkTest.php index d34fcdc..8460fbe 100644 --- a/tests/Components/LinkTest.php +++ b/tests/Components/LinkTest.php @@ -6,6 +6,15 @@ class LinkTest extends TestCase { + protected function getEnvironmentSetUp($app) + { + if (method_exists($app, 'usePublicPath')) { + $app->usePublicPath(dirname(__DIR__).'/files'); + } else { + $app->instance('path.public', dirname(__DIR__).'/files'); + } + } + protected function tearDown(): void { $this->artisan('view:clear'); @@ -20,8 +29,6 @@ public function it_renders_the_component() 'subresource-integrity.mix_sri_path' => './tests/files/mix-sri.json', ]); - $this->app->instance('path.public', dirname(__DIR__).'/files'); - $view = View::file(dirname(__DIR__).'/files/link.blade.php', ['mix' => false, 'crossOrigin' => null])->render(); $expected = <<<'HTML' @@ -40,8 +47,6 @@ public function it_uses_mix_when_the_mix_attribute_is_passed() 'subresource-integrity.mix_sri_path' => './tests/files/mix-sri.json', ]); - $this->app->instance('path.public', dirname(__DIR__).'/files'); - $view = View::file(dirname(__DIR__).'/files/link.blade.php', ['mix' => true, 'crossOrigin' => null])->render(); $expected = <<<'HTML' @@ -60,8 +65,6 @@ public function it_uses_the_crossorigin_attribute_if_passed() 'subresource-integrity.mix_sri_path' => './tests/files/mix-sri.json', ]); - $this->app->instance('path.public', dirname(__DIR__).'/files'); - $view = View::file(dirname(__DIR__).'/files/link.blade.php', ['mix' => false, 'crossOrigin' => 'test'])->render(); $expected = <<<'HTML' diff --git a/tests/Components/ScriptTest.php b/tests/Components/ScriptTest.php index 61c01c4..116a00d 100644 --- a/tests/Components/ScriptTest.php +++ b/tests/Components/ScriptTest.php @@ -6,6 +6,15 @@ class ScriptTest extends TestCase { + protected function getEnvironmentSetUp($app) + { + if (method_exists($app, 'usePublicPath')) { + $app->usePublicPath(dirname(__DIR__).'/files'); + } else { + $app->instance('path.public', dirname(__DIR__).'/files'); + } + } + protected function tearDown(): void { $this->artisan('view:clear'); @@ -20,8 +29,6 @@ public function it_renders_the_component() 'subresource-integrity.mix_sri_path' => './tests/files/mix-sri.json', ]); - $this->app->instance('path.public', dirname(__DIR__).'/files'); - $view = View::file(dirname(__DIR__).'/files/script.blade.php', ['mix' => false, 'crossOrigin' => 'anonymous'])->render(); $expected = <<<'HTML' @@ -40,8 +47,6 @@ public function it_uses_mix_when_the_mix_attribute_is_passed() 'subresource-integrity.mix_sri_path' => './tests/files/mix-sri.json', ]); - $this->app->instance('path.public', dirname(__DIR__).'/files'); - $view = View::file(dirname(__DIR__).'/files/script.blade.php', ['mix' => true, 'crossOrigin' => 'anonymous'])->render(); $expected = <<<'HTML' @@ -60,8 +65,6 @@ public function it_uses_the_crossorigin_attribute_if_passed() 'subresource-integrity.mix_sri_path' => './tests/files/mix-sri.json', ]); - $this->app->instance('path.public', dirname(__DIR__).'/files'); - $view = View::file(dirname(__DIR__).'/files/script.blade.php', ['mix' => false, 'crossOrigin' => 'test'])->render(); $expected = <<<'HTML'