diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 678dc65..559f26a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,6 +72,7 @@ jobs: --coverage-clover coverage.xml --coverage-text --log-junit junit.xml + ${{ matrix.dependencies == 'low' && '--config phpunit10.xml.dist' || '' }} - name: Submit code coverage if: ${{ always() }} diff --git a/.gitignore b/.gitignore index 4ef8e9f..4414391 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ vendor/ composer.lock .generated -.phpunit.result.cache +.phpunit.cache diff --git a/composer.json b/composer.json index 5252fd5..a212d00 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require-dev": { "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.3 || ^10", + "phpunit/phpunit": "^10 || ^11", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..14408c4 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,20 @@ + + + + + tests + + + + + src + + + diff --git a/phpunit.xml b/phpunit10.xml.dist similarity index 70% rename from phpunit.xml rename to phpunit10.xml.dist index 3a48d1b..05c6692 100644 --- a/phpunit.xml +++ b/phpunit10.xml.dist @@ -1,14 +1,13 @@ - + cacheDirectory=".phpunit.cache" + requireCoverageMetadata="true" + beStrictAboutCoverageMetadata="false"> + src diff --git a/tests/AttributeDriverTest.php b/tests/AttributeDriverTest.php index 7d1645d..4a58ae6 100644 --- a/tests/AttributeDriverTest.php +++ b/tests/AttributeDriverTest.php @@ -8,10 +8,13 @@ EntityManagerInterface, Mapping, }; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -/** - * @covers Firehed\Mocktrine\InMemoryEntityManager - */ +#[CoversClass(InMemoryEntityManager::class)] +#[Small] class AttributeDriverTest extends InMemoryEntityManagerTest { public function setUp(): void diff --git a/tests/CriteriaEvaluatorFactoryTest.php b/tests/CriteriaEvaluatorFactoryTest.php index 3693bd5..3d73d02 100644 --- a/tests/CriteriaEvaluatorFactoryTest.php +++ b/tests/CriteriaEvaluatorFactoryTest.php @@ -5,10 +5,13 @@ namespace Firehed\Mocktrine; use Doctrine\Persistence\Mapping\ClassMetadata; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -/** - * @covers Firehed\Mocktrine\CriteriaEvaluatorFactory - */ +#[CoversClass(CriteriaEvaluatorFactory::class)] +#[Small] class CriteriaEvaluatorFactoryTest extends \PHPUnit\Framework\TestCase { public function testGetInstanceReturnsSingleton(): void diff --git a/tests/CriteriaEvaluatorTest.php b/tests/CriteriaEvaluatorTest.php index 6de9dac..4c75217 100644 --- a/tests/CriteriaEvaluatorTest.php +++ b/tests/CriteriaEvaluatorTest.php @@ -10,10 +10,13 @@ use Doctrine\ORM\Mapping\Driver\AnnotationDriver; use Doctrine\Persistence\Mapping\ClassMetadata; use Firehed\Mocktrine\Entities\GrabBag; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -/** - * @covers Firehed\Mocktrine\CriteriaEvaluator - */ +#[CoversClass(CriteriaEvaluator::class)] +#[Small] class CriteriaEvaluatorTest extends \PHPUnit\Framework\TestCase { /** @var InMemoryRepository */ diff --git a/tests/InMemoryEntityManagerTest.php b/tests/InMemoryEntityManagerTest.php index 50f3b04..c5fa899 100644 --- a/tests/InMemoryEntityManagerTest.php +++ b/tests/InMemoryEntityManagerTest.php @@ -8,10 +8,13 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; use Doctrine\Persistence\ObjectRepository; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -/** - * @covers Firehed\Mocktrine\InMemoryEntityManager - */ +#[CoversClass(InMemoryEntityManager::class)] +#[Small] class InMemoryEntityManagerTest extends \PHPUnit\Framework\TestCase { protected function getEntityManager(): InMemoryEntityManager diff --git a/tests/InMemoryRepositoryTest.php b/tests/InMemoryRepositoryTest.php index 2ff58d3..2283609 100644 --- a/tests/InMemoryRepositoryTest.php +++ b/tests/InMemoryRepositoryTest.php @@ -12,12 +12,15 @@ use Doctrine\ORM\Mapping\MappingException; use Doctrine\Persistence\Mapping\Driver\MappingDriver; use Error; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; use TypeError; use UnexpectedValueException; -/** - * @covers Firehed\Mocktrine\InMemoryRepository - */ +#[CoversClass(InMemoryRepository::class)] +#[Small] class InMemoryRepositoryTest extends \PHPUnit\Framework\TestCase { private MappingDriver $driver; diff --git a/tests/XmlDriverTest.php b/tests/XmlDriverTest.php index 1e6e778..7e023d2 100644 --- a/tests/XmlDriverTest.php +++ b/tests/XmlDriverTest.php @@ -8,10 +8,13 @@ EntityManagerInterface, Mapping, }; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -/** - * @covers Firehed\Mocktrine\InMemoryEntityManager - */ +#[CoversClass(InMemoryEntityManager::class)] +#[Small] class XmlDriverTest extends InMemoryEntityManagerTest { protected function getEntityManager(): InMemoryEntityManager