Skip to content

Commit

Permalink
Replace phpunit.xml and dataprovider with attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Oct 28, 2024
1 parent e833f79 commit 3e9473b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 20 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
shortenArraysForExportThreshold="10"
requireCoverageMetadata="false"
beStrictAboutCoverageMetadata="false"
beStrictAboutOutputDuringTests="true"
displayDetailsOnPhpunitDeprecations="true"
failOnPhpunitDeprecation="true"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix="Test.php">./tests/</directory>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use LaravelDoctrineTest\ORM\TestCase;
use Mockery as m;

use PHPUnit\Framework\Attributes\DataProvider;

Check failure on line 13 in tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.2)

Expected 0 lines between same types of use statement, found 1.
use function class_exists;

Check failure on line 14 in tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.2)

Expected 1 line between different types of use statement, found 0.

/**
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/EntityManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = '',
Expand Down

0 comments on commit 3e9473b

Please sign in to comment.