1717use Helhum \TyposcriptRendering \Renderer \RecordRenderer ;
1818use Helhum \TyposcriptRendering \Renderer \RenderingContext ;
1919use Nimut \TestingFramework \TestCase \UnitTestCase ;
20+ use TYPO3 \CMS \Core \Utility \GeneralUtility ;
21+ use TYPO3 \CMS \Core \Utility \RootlineUtility ;
2022use TYPO3 \CMS \Frontend \Controller \TypoScriptFrontendController ;
2123
2224/**
@@ -34,6 +36,11 @@ protected function setUp()
3436 $ this ->renderer = $ this ->getAccessibleMock ('Helhum \\TyposcriptRendering \\Renderer \\RecordRenderer ' , ['dummy ' ]);
3537 }
3638
39+ protected function tearDown ()
40+ {
41+ GeneralUtility::purgeInstances ();
42+ }
43+
3744 /**
3845 * @return array
3946 */
@@ -102,20 +109,20 @@ public function configurationDataProvider()
102109 public function configurationIsGeneratedCorrectlyFromRequest (array $ requestArguments , array $ expectedConfiguration , $ pageId = '42 ' )
103110 {
104111 /** @var TypoScriptFrontendController|\PHPUnit_Framework_MockObject_MockObject $tsfeMock */
105- $ tsfeMock = $ this ->getMockBuilder (' TYPO3 \\ CMS \\ Frontend \\ Controller \\ TypoScriptFrontendController ' )
112+ $ tsfeMock = $ this ->getMockBuilder (TypoScriptFrontendController::class )
106113 ->disableOriginalConstructor ()
107114 ->getMock ();
108- $ pageRepositoryMock = $ this ->getMockBuilder (' TYPO3 \\ CMS \\ Frontend \\ Page \\ PageRepository ' )->disableOriginalConstructor ()->getMock ();
109- $ pageRepositoryMock ->expects ($ this ->any ())->method ('getRootLine ' )->willReturn (
115+ $ rootlineUtilityMock = $ this ->getMockBuilder (RootlineUtility::class )->disableOriginalConstructor ()->getMock ();
116+ $ rootlineUtilityMock ->expects ($ this ->any ())->method ('get ' )->willReturn (
110117 [
111118 [
112119 'uid ' => '1 ' ,
113120 'pid ' => '0 ' ,
114121 ],
115122 ]
116123 );
124+ GeneralUtility::addInstance (RootlineUtility::class, $ rootlineUtilityMock );
117125 $ tsfeMock ->id = $ pageId ;
118- $ tsfeMock ->sys_page = $ pageRepositoryMock ;
119126 $ contextFixture = new RenderingContext ($ tsfeMock );
120127 $ requestFixture = new Request ($ requestArguments );
121128
0 commit comments