From 2b1a6eb6361ecf2e3cb5d9ebf8f6c1cbfa2dbafb Mon Sep 17 00:00:00 2001 From: Torben Hansen <derhansen@gmail.com> Date: Sun, 13 Nov 2022 12:43:16 +0100 Subject: [PATCH] [TASK] Replace prophecy in EXT:core TreeDataProviderFactoryTest Resolves: #98806 Releases: main Change-Id: I9e87fd549f0fbc29fc392cc73944d92fbc83ddb8 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76580 Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Klee <typo3-coding@oliverklee.de> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../TreeDataProviderFactoryTest.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php b/typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php index 9fcd501cbb18..d44a3cfa472f 100644 --- a/typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php +++ b/typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php @@ -17,8 +17,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration; -use Prophecy\PhpUnit\ProphecyTrait; use Psr\EventDispatcher\EventDispatcherInterface; +use TYPO3\CMS\Core\EventDispatcher\NoopEventDispatcher; use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderFixture; use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderWithConfigurationFixture; use TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider; @@ -28,8 +28,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class TreeDataProviderFactoryTest extends UnitTestCase { - use ProphecyTrait; - protected function setUp(): void { parent::setUp(); @@ -96,8 +94,8 @@ class TreeDataProviderFactoryTest extends UnitTestCase public function factoryThrowsExceptionIfInvalidConfigurationIsGiven(array $tcaConfiguration, int $expectedExceptionCode): void { if (isset($tcaConfiguration['type']) && $tcaConfiguration['type'] !== 'folder' && is_array($tcaConfiguration['treeConfig'] ?? null)) { - $treeDataProvider = $this->prophesize(DatabaseTreeDataProvider::class); - GeneralUtility::addInstance(DatabaseTreeDataProvider::class, $treeDataProvider->reveal()); + $treeDataProvider = $this->createMock(DatabaseTreeDataProvider::class); + GeneralUtility::addInstance(DatabaseTreeDataProvider::class, $treeDataProvider); } $this->expectException(\InvalidArgumentException::class); @@ -112,8 +110,7 @@ class TreeDataProviderFactoryTest extends UnitTestCase public function configuredDataProviderClassIsInstantiated(): void { $dataProviderMockClassName = TreeDataProviderFixture::class; - $eventDispatcher = $this->prophesize(EventDispatcherInterface::class); - GeneralUtility::addInstance(EventDispatcherInterface::class, $eventDispatcher->reveal()); + GeneralUtility::addInstance(EventDispatcherInterface::class, new NoopEventDispatcher()); $tcaConfiguration = [ 'treeConfig' => ['dataProvider' => $dataProviderMockClassName], @@ -130,8 +127,7 @@ class TreeDataProviderFactoryTest extends UnitTestCase public function configuredDataProviderClassIsInstantiatedWithTcaConfigurationInConstructor(): void { $dataProviderMockClassName = TreeDataProviderWithConfigurationFixture::class; - $eventDispatcher = $this->prophesize(EventDispatcherInterface::class); - GeneralUtility::addInstance(EventDispatcherInterface::class, $eventDispatcher->reveal()); + GeneralUtility::addInstance(EventDispatcherInterface::class, new NoopEventDispatcher()); $tcaConfiguration = [ 'treeConfig' => [ -- GitLab