Skip to content

Commit

Permalink
Update tests to only register either the annotation or attribute driv…
Browse files Browse the repository at this point in the history
…er to avoid unintended overwrites due to namespaces
  • Loading branch information
mbabker committed Feb 19, 2024
1 parent ea1aea7 commit 6489401
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 33 deletions.
16 changes: 4 additions & 12 deletions tests/Gedmo/Mapping/LoggableORMMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ public static function dataLoggableObject(): \Generator
{
if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedLoggable::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedLoggable::class];
}

Expand Down Expand Up @@ -121,9 +119,7 @@ public static function dataLoggableObjectWithCompositeKey(): \Generator

if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedLoggableComposite::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedLoggableComposite::class];
}

Expand Down Expand Up @@ -166,9 +162,7 @@ public static function dataLoggableObjectWithCompositeKeyAndRelation(): \Generat

if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedLoggableCompositeRelation::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedLoggableCompositeRelation::class];
}

Expand Down Expand Up @@ -214,9 +208,7 @@ public static function dataLoggableObjectWithEmbedded(): \Generator
{
if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedLoggableWithEmbedded::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedLoggableWithEmbedded::class];
}
}
Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Mapping/ORMMappingTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ final protected function createChainedMappingDriver(): MappingDriverChain

if (PHP_VERSION_ID >= 80000) {
$chain->addDriver(new AttributeDriver([]), 'Gedmo\Tests\Mapping\Fixture');
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
$chain->addDriver(new AnnotationDriver(new AnnotationReader()), 'Gedmo\Tests\Mapping\Fixture');
}

Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Mapping/SluggableMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ public static function dataSluggableObject(): \Generator

if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedSluggable::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedSluggable::class];
}
}
Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Mapping/SoftDeleteableMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ public static function dataSoftDeleteableObject(): \Generator

if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedSoftDeleteable::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedSoftDeleteable::class];
}

Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Mapping/SortableMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public static function dataSortableObject(): \Generator

if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedSortable::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedSortable::class];
}

Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Mapping/TimestampableMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public static function dataTimestampableObject(): \Generator
{
if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedCategory::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedCategory::class];
}

Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Mapping/TranslatableMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ public static function dataSortableObject(): \Generator

if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedUser::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedUser::class];
}

Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Mapping/UploadableMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ public static function dataUploadableObject(): \Generator

if (PHP_VERSION_ID >= 80000) {
yield 'Model with attributes' => [AnnotatedUploadable::class];
}

if (class_exists(AnnotationDriver::class)) {
} elseif (class_exists(AnnotationDriver::class)) {
yield 'Model with annotations' => [AnnotatedUploadable::class];
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Gedmo/Timestampable/AttributeChangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* @requires PHP >= 8.0
*
* @todo This test requires {@see ChangeTest} to have been run first to load the {@see TimestampableListenerStub}
*/
final class AttributeChangeTest extends BaseTestCaseORM
{
Expand Down

0 comments on commit 6489401

Please sign in to comment.