Skip to content

Commit

Permalink
ignore ObjectStorage for LazyProxy Check
Browse files Browse the repository at this point in the history
  • Loading branch information
sHorst committed Jun 1, 2024
1 parent 8b440b6 commit 9e1b46c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Classes/Domain/Model/AnnotationTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use TYPO3\CMS\Extbase\Annotation\ORM\Transient;
use TYPO3\CMS\Extbase\Annotation\Validate;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

/**
* Annotation Test for class specified in testedClass Parameter
Expand Down Expand Up @@ -149,18 +150,28 @@ public function testAnnotations(): void
// Lazy objects should not leak outside the object

$nullable = false;
$objectStorage = false;
// check, that all types exists
foreach ($all_types as $class) {
if ($class === 'null') {
$nullable = true;
continue;
}

if ($class === ObjectStorage::class) {
$objectStorage = true;
}

if (!class_exists($class)) {
$this->fail('Class ' . $class . ' does not exists');
}
}

if ($objectStorage) {
// do not test anything, since this will utilize LazyObjectStorage and not LazyLoadingProxy
continue;
}

self::assertContains(LazyLoadingProxy::class, $all_types, $prop->getName() . ': Needs to hold LazyLoadingProxy');

// make sure, one is LazyLoadingProxy and remove it from types
Expand Down

0 comments on commit 9e1b46c

Please sign in to comment.