diff --git a/typo3/sysext/core/Tests/Unit/Configuration/Loader/PageTsConfigLoaderTest.php b/typo3/sysext/core/Tests/Unit/Configuration/Loader/PageTsConfigLoaderTest.php index dbf6e4f7c0a18b30cc7ef5ff6f03a803bde4470f..8dce931a326e4c8f14c83d20c0c91374625f0d0f 100644 --- a/typo3/sysext/core/Tests/Unit/Configuration/Loader/PageTsConfigLoaderTest.php +++ b/typo3/sysext/core/Tests/Unit/Configuration/Loader/PageTsConfigLoaderTest.php @@ -17,8 +17,6 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Unit\Configuration\Loader; -use Prophecy\Argument; -use Prophecy\PhpUnit\ProphecyTrait; use Psr\EventDispatcher\EventDispatcherInterface; use TYPO3\CMS\Core\Configuration\Event\ModifyLoadedPageTsConfigEvent; use TYPO3\CMS\Core\Configuration\Loader\PageTsConfigLoader; @@ -26,8 +24,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class PageTsConfigLoaderTest extends UnitTestCase { - use ProphecyTrait; - /** * @test */ @@ -37,10 +33,10 @@ class PageTsConfigLoaderTest extends UnitTestCase 'default' => $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'], ]; $expectedString = implode('"\n[GLOBAL]\n"', $expected); - $eventDispatcher = $this->prophesize(EventDispatcherInterface::class); - $subject = new PageTsConfigLoader($eventDispatcher->reveal()); + $eventDispatcherMock = $this->createMock(EventDispatcherInterface::class); + $subject = new PageTsConfigLoader($eventDispatcherMock); $event = new ModifyLoadedPageTsConfigEvent($expected, []); - $eventDispatcher->dispatch(Argument::type(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); + $eventDispatcherMock->method('dispatch')->with(self::isInstanceOf(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); $result = $subject->collect([]); self::assertSame($expected, $result); @@ -59,10 +55,10 @@ class PageTsConfigLoaderTest extends UnitTestCase 'page_27' => '', ]; $rootLine = [['uid' => 0, 'pid' => 0], ['uid' => 13, 'TSconfig' => 'waiting for = love'], ['uid' => 27, 'TSconfig' => '']]; - $eventDispatcher = $this->prophesize(EventDispatcherInterface::class); + $eventDispatcherMock = $this->createMock(EventDispatcherInterface::class); $event = new ModifyLoadedPageTsConfigEvent($expected, $rootLine); - $eventDispatcher->dispatch(Argument::type(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); - $subject = new PageTsConfigLoader($eventDispatcher->reveal()); + $eventDispatcherMock->method('dispatch')->with(self::isInstanceOf(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); + $subject = new PageTsConfigLoader($eventDispatcherMock); $result = $subject->collect($rootLine); self::assertSame($expected, $result); } @@ -80,10 +76,10 @@ class PageTsConfigLoaderTest extends UnitTestCase 'page_27' => '', ]; $rootLine = [['uid' => 13, 'TSconfig' => 'waiting for = love', 'tsconfig_includes' => 'EXT:core/Tests/Unit/Configuration/Loader/Fixtures/included.typoscript'], ['uid' => 27, 'TSconfig' => '']]; - $eventDispatcher = $this->prophesize(EventDispatcherInterface::class); + $eventDispatcherMock = $this->createMock(EventDispatcherInterface::class); $event = new ModifyLoadedPageTsConfigEvent($expected, $rootLine); - $eventDispatcher->dispatch(Argument::type(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); - $subject = new PageTsConfigLoader($eventDispatcher->reveal()); + $eventDispatcherMock->method('dispatch')->with(self::isInstanceOf(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); + $subject = new PageTsConfigLoader($eventDispatcherMock); $result = $subject->collect($rootLine); self::assertSame($expected, $result); } @@ -100,10 +96,10 @@ class PageTsConfigLoaderTest extends UnitTestCase ]; $expectedString = implode("\n[GLOBAL]\n", $expected); $rootLine = [['uid' => 13, 'TSconfig' => 'waiting for = love', 'tsconfig_includes' => 'EXT:core/Tests/Unit/Configuration/Loader/Fixtures/me_does_not_exist.typoscript'], ['uid' => 27, 'TSconfig' => '']]; - $eventDispatcher = $this->prophesize(EventDispatcherInterface::class); + $eventDispatcherMock = $this->createMock(EventDispatcherInterface::class); $event = new ModifyLoadedPageTsConfigEvent($expected, $rootLine); - $eventDispatcher->dispatch(Argument::type(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); - $subject = new PageTsConfigLoader($eventDispatcher->reveal()); + $eventDispatcherMock->method('dispatch')->with(self::isInstanceOf(ModifyLoadedPageTsConfigEvent::class))->willReturn($event); + $subject = new PageTsConfigLoader($eventDispatcherMock); $result = $subject->collect($rootLine); self::assertSame($expected, $result);