diff --git a/src/Test/AbstractDtoTestCase.php b/src/Test/AbstractDtoTestCase.php new file mode 100644 index 0000000..e907373 --- /dev/null +++ b/src/Test/AbstractDtoTestCase.php @@ -0,0 +1,37 @@ +getAttributes(CoversClass::class, ReflectionAttribute::IS_INSTANCEOF); + $testedAttributes = false; + foreach ($attributes as $attribute) { + if ($attribute->getName() === 'PHPUnit\Framework\Attributes\CoversClass') { + $testedAttributes = true; + $config = $this->getAccessorPairConfig(); + static::assertAccessorPairs($attribute->getArguments()[0], $config); + } + } + static::assertTrue($testedAttributes, 'Missing CoversClass attribute'); + } + + protected function getAccessorPairConfig(): ConstraintConfig + { + return (new ConstraintConfig())->setAssertPropertyDefaults(true); + } +}