Skip to content

Commit e9ede26

Browse files
authored
Merge pull request #74 from helhum/10-compat
2 parents b24369d + 0ca955b commit e9ede26

File tree

5 files changed

+33
-10
lines changed

5 files changed

+33
-10
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ before_install:
2626
- phpenv config-rm xdebug.ini
2727

2828
install:
29-
- composer require typo3/minimal=$TYPO3_VERSION
29+
- composer require --dev typo3/minimal=$TYPO3_VERSION
3030

3131
script:
3232
- >
@@ -51,6 +51,21 @@ script:
5151
jobs:
5252
fast_finish: true
5353
include:
54+
- stage: test
55+
php: 7.4
56+
env: TYPO3_VERSION=^10.4
57+
- stage: test
58+
php: 7.3
59+
env: TYPO3_VERSION=^10.4
60+
- stage: test
61+
php: 7.2
62+
env: TYPO3_VERSION=^10.4
63+
- stage: test
64+
php: 7.4
65+
env: TYPO3_VERSION=^9.5
66+
- stage: test
67+
php: 7.3
68+
env: TYPO3_VERSION=^9.5
5469
- stage: test
5570
php: 7.2
5671
env: TYPO3_VERSION=^9.5

Classes/Renderer/RecordRenderer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Helhum\TyposcriptRendering\Mvc\Request;
1717
use Helhum\TyposcriptRendering\Mvc\Response;
1818
use TYPO3\CMS\Core\Utility\GeneralUtility;
19+
use TYPO3\CMS\Core\Utility\RootlineUtility;
1920
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
2021

2122
/**
@@ -84,7 +85,7 @@ protected function resolveRenderingConfiguration(Request $request, RenderingCont
8485

8586
if ($table === 'pages') {
8687
// Allow rendering of a root page which has pid === 0 and would be denied otherwise
87-
$rootLine = $renderingContext->getFrontendController()->sys_page->getRootLine($id);
88+
$rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $id)->get();
8889
// $rootLine[0] is the root page. Check if the page we're going to render is a root page.
8990
// We explicitly ignore the case where the to be rendered id is in another root line (multi domain setup)
9091
// as this would require an additional record lookup. The use case for this is very limited anyway

Tests/Unit/Renderer/RecordRendererTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use Helhum\TyposcriptRendering\Renderer\RecordRenderer;
1818
use Helhum\TyposcriptRendering\Renderer\RenderingContext;
1919
use Nimut\TestingFramework\TestCase\UnitTestCase;
20+
use TYPO3\CMS\Core\Utility\GeneralUtility;
21+
use TYPO3\CMS\Core\Utility\RootlineUtility;
2022
use 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

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"license": "GPL-2.0-or-later",
2323
"require": {
2424
"php": "^7.2",
25-
"typo3/cms-core": "^9.5"
25+
"typo3/cms-core": "^9.5 || ^10.4"
2626
},
2727
"require-dev": {
28-
"nimut/testing-framework": "^4.0",
28+
"nimut/testing-framework": "^4.0 || ^5.0",
2929
"typo3/minimal": "^9.5"
3030
},
3131
"autoload": {

ext_emconf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
'version' => '2.2.2',
1414
'constraints' => [
1515
'depends' => [
16-
'php' => '7.2.0-7.3.999',
17-
'typo3' => '9.5.0-9.5.99',
16+
'php' => '7.2.0-7.4.999',
17+
'typo3' => '9.5.0-10.4.99',
1818
],
1919
'conflicts' => [
2020
],

0 commit comments

Comments
 (0)