Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit a9441ee

Browse files
committed
[BUGFIX] Use page record decided by TSFE
Close: FluidTYPO3/flux#1177
1 parent cc984b6 commit a9441ee

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Classes/Controller/PageController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ public function rawAction()
9595
*/
9696
public function getRecord()
9797
{
98-
return $this->workspacesAwareRecordService->getSingle($this->fluxTableName, '*', $GLOBALS['TSFE']->id);
98+
return $GLOBALS['TSFE']->page ?? null;
9999
}
100100
}

Tests/Unit/Controller/PageControllerTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use FluidTYPO3\Fluidpages\Tests\Fixtures\Controller\DummyPageController;
1515
use FluidTYPO3\Fluidpages\Tests\Unit\AbstractTestCase;
1616
use FluidTYPO3\Flux\Provider\Provider;
17-
use FluidTYPO3\Flux\Service\WorkspacesAwareRecordService;
1817
use TYPO3\CMS\Core\Utility\GeneralUtility;
1918
use TYPO3\CMS\Fluid\View\TemplateView;
2019

@@ -38,15 +37,13 @@ public function testPerformsInjections()
3837
/**
3938
* @return void
4039
*/
41-
public function testGetRecordDelegatesToRecordService()
40+
public function testGetRecordReadsFromTypoScriptFrontendController()
4241
{
42+
$GLOBALS['TSFE'] = (object) ['page' => ['foo' => 'bar']];
4343
/** @var PageController $subject */
4444
$subject = $this->getMockBuilder('FluidTYPO3\\Fluidpages\\Controller\\PageController')->setMethods(array('dummy'))->getMock();
45-
/** @var WorkspacesAwareRecordService|\PHPUnit_Framework_MockObject_MockObject $mockService */
46-
$mockService = $this->getMockBuilder('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService')->setMethods(array('getSingle'))->getMock();
47-
$mockService->expects($this->once())->method('getSingle');
48-
$subject->injectWorkspacesAwareRecordService($mockService);
49-
$subject->getRecord();
45+
$record = $subject->getRecord();
46+
$this->assertSame(['foo' => 'bar'], $record);
5047
}
5148

5249
public function testInitializeProvider()

0 commit comments

Comments
 (0)