From 3e9473b2d9c78a6b3d962c8933af204d52843aa6 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Mon, 28 Oct 2024 17:50:08 -0600 Subject: [PATCH] Replace phpunit.xml and dataprovider with attributes --- .gitignore | 2 +- phpunit.xml | 38 ++++++++++--------- .../PrimaryReadReplicaConnectionTest.php | 4 +- tests/Feature/EntityManagerFactoryTest.php | 4 +- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index ff5dc42b..ba8e64dc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ composer.phar composer.lock .DS_Store .phpcs-cache -.phpunit.result.cache +.phpunit.cache /tests/Stubs/storage/framework/views/* !/tests/Stubs/storage/framework/views/.gitkeep diff --git a/phpunit.xml b/phpunit.xml index 493fd4a7..165b475a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,24 +1,26 @@ - - - - src/ - - + cacheDirectory=".phpunit.cache" + executionOrder="depends,defects" + shortenArraysForExportThreshold="10" + requireCoverageMetadata="false" + beStrictAboutCoverageMetadata="false" + beStrictAboutOutputDuringTests="true" + displayDetailsOnPhpunitDeprecations="true" + failOnPhpunitDeprecation="true" + failOnRisky="true" + failOnWarning="true"> - - ./tests/ + + tests + + + + src + + diff --git a/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php b/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php index 2d69dd17..2e6317bc 100644 --- a/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php +++ b/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php @@ -10,6 +10,7 @@ use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; +use PHPUnit\Framework\Attributes\DataProvider; use function class_exists; /** @@ -93,9 +94,8 @@ public static function getPrimaryReplicaConnectionData(): array * @param mixed[] $resolvedBaseSettings * @param mixed[] $settings * @param mixed[] $expectedOutput - * - * @dataProvider getPrimaryReplicaConnectionData */ + #[DataProvider('getPrimaryReplicaConnectionData')] public function testPrimaryReplicaConnection(array $resolvedBaseSettings, array $settings, array $expectedOutput): void { $this->assertEquals( diff --git a/tests/Feature/EntityManagerFactoryTest.php b/tests/Feature/EntityManagerFactoryTest.php index bd2d65e5..af9434a2 100644 --- a/tests/Feature/EntityManagerFactoryTest.php +++ b/tests/Feature/EntityManagerFactoryTest.php @@ -38,6 +38,7 @@ use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; +use PHPUnit\Framework\Attributes\DataProvider; use Psr\Cache\CacheItemPoolInterface; use ReflectionException; use ReflectionObject; @@ -1072,9 +1073,8 @@ public static function getTestPrimaryReadReplicaConnectionData(): array * Check if config is handled correctly. * * @param mixed[] $inputConfig - * - * @dataProvider getTestPrimaryReadReplicaConnectionData */ + #[DataProvider('getTestPrimaryReadReplicaConnectionData')] public function testPrimaryReadReplicaConnection( array $inputConfig, string $expectedException = '',