diff --git a/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php b/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php index b6c1331..f66b11e 100644 --- a/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php +++ b/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php @@ -4,13 +4,10 @@ declare(strict_types=1); namespace TTN\Tea\Domain\Repository\Traits; -use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface; /** * This trait for repositories makes the repository ignore the storage page setting when fetching models. - * - * @property ObjectManagerInterface $objectManager */ trait StoragePageAgnosticTrait { diff --git a/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php b/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php index e080515..7962cde 100644 --- a/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php @@ -6,10 +6,8 @@ namespace TTN\Tea\Tests\Functional\Domain\Repository\Product; use TTN\Tea\Domain\Model\Product\Tea; use TTN\Tea\Domain\Repository\Product\TeaRepository; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Domain\Model\FileReference; -use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -31,13 +29,7 @@ class TeaRepositoryTest extends FunctionalTestCase $this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); - $versionInformation = GeneralUtility::makeInstance(Typo3Version::class); - if ($versionInformation->getMajorVersion() >= 11) { - $this->subject = $this->getContainer()->get(TeaRepository::class); - } else { - $objectManager = GeneralUtility::makeInstance(ObjectManager::class); - $this->subject = $objectManager->get(TeaRepository::class); - } + $this->subject = $this->getContainer()->get(TeaRepository::class); } /** diff --git a/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php b/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php index 120383a..5f5ac36 100644 --- a/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php @@ -23,8 +23,13 @@ class TeaRepositoryTest extends UnitTestCase { parent::setUp(); - $objectManager = $this->prophesize(ObjectManagerInterface::class)->reveal(); - $this->subject = new TeaRepository($objectManager); + if (\interface_exists(ObjectManagerInterface::class)) { + $objectManager = $this->prophesize(ObjectManagerInterface::class)->reveal(); + $this->subject = new TeaRepository($objectManager); + } else { + // @phpstan-ignore-next-line This line is valid in TYPO3 12LTS, but PHPStan uses 11LTS. + $this->subject = new TeaRepository(); + } } /**