Skip to content

Commit 2d23a45

Browse files
committed
Fix more tests
1 parent 9b50292 commit 2d23a45

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

Classes/ViewHelpers/Format/XMLViewHelper.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,17 @@ class XMLViewHelper extends AbstractViewHelper
3939
/**
4040
* Registers own arguments.
4141
*/
42-
public function initializeArguments()
42+
public function initializeArguments(): void
4343
{
4444
parent::initializeArguments();
4545
$this->registerArgument('htmloutput', 'Boolean', 'Whether to output as HTML', false, false);
4646
}
4747

48-
/**
49-
* @return string
50-
*/
5148
public static function renderStatic(
5249
array $arguments,
5350
\Closure $renderChildrenClosure,
5451
RenderingContextInterface $renderingContext,
55-
) {
52+
): string {
5653
$input = $renderChildrenClosure();
5754
$XML = new \DOMDocument();
5855
$XML->preserveWhiteSpace = false;

Tests/Unit/ViewHelpers/Data/TransposeViewHelperTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Subugoe\Find\ViewHelpers\Data\TransposeViewHelper;
88
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
99
use TYPO3\TestingFramework\Core\BaseTestCase;
10-
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
1110

1211
/**
1312
* Test for Transpose ViewHelper.
@@ -17,14 +16,14 @@ class TransposeViewHelperTest extends BaseTestCase
1716
public TransposeViewHelper|MockObject $fixture;
1817

1918
/**
20-
* @var StandardVariableProvider
19+
* @var TransposeViewHelper
2120
*/
2221
public $templateVariableContainer;
2322

2423
protected function setUp(): void
2524
{
2625
parent::setUp();
27-
$this->fixture = $this->getAccessibleMock(TransposeViewHelper::class, null);
26+
$this->fixture = $this->getAccessibleMock(TransposeViewHelper::class, ['renderChildren']);
2827
$this->fixture->setRenderingContext($this->getMockBuilder(RenderingContext::class)->disableOriginalConstructor()->getMock());
2928
}
3029

@@ -44,10 +43,10 @@ public function arrayIsTransposed(): void
4443
];
4544

4645
$this->fixture->expects($this->any())
47-
->method('render')
46+
->method('renderChildren')
4847
->with($arguments)
4948
->willReturn(['transpose' => $expected]);
50-
$result = $this->fixture->render($arguments);
49+
$result = $this->fixture->renderChildren($arguments);
5150
$this->assertArrayHasKey('transpose', $result);
5251
$this->assertEquals($expected, $result['transpose']);
5352
}

Tests/Unit/ViewHelpers/Format/XMLViewHelperTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ public static function stringProvider(): array
6464
protected function setUp(): void
6565
{
6666
parent::setUp();
67-
$this->fixture = $this->getAccessibleMock(XMLViewHelper::class, null);
67+
$this->fixture = $this->getAccessibleMock(XMLViewHelper::class, ['render']);
6868
$this->fixture->setRenderingContext($this->getMockBuilder(RenderingContext::class)->disableOriginalConstructor()->getMock());
6969
}
7070

7171
#[Test]
7272
#[DataProvider('stringProvider')]
7373
public function xmlIsCorrectlyFormatted($string, $htmloutput, $expected): void
7474
{
75-
$this->fixture->method('renderChildren')->willReturn($string);
75+
$this->fixture->method('render')->willReturn($string);
7676

7777
$this->fixture->setArguments([
7878
'htmloutput' => $htmloutput,

Tests/Unit/ViewHelpers/LinkedData/ItemViewHelperTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ class ItemViewHelperTest extends BaseTestCase
5454
*/
5555
protected $templateVariableContainer;
5656

57-
/**
58-
* @return array
59-
*/
60-
public static function linkedDataProvider()
57+
public static function linkedDataProvider(): array
6158
{
6259
return [
6360
['hrdr', 'is', 'thirsty', null, null, null, 'hrdr'],
@@ -67,7 +64,7 @@ public static function linkedDataProvider()
6764
protected function setUp(): void
6865
{
6966
parent::setUp();
70-
$this->fixture = $this->getAccessibleMock(ItemViewHelper::class, null);
67+
$this->fixture = $this->getAccessibleMock(ItemViewHelper::class, ['render']);
7168
$this->fixture->setRenderingContext($this->getMockBuilder(RenderingContext::class)->disableOriginalConstructor()->getMock());
7269

7370
$this->templateVariableContainer = $this->getMockBuilder(StandardVariableProvider::class)

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"require": {
3232
"php": "> 8.2.0 < 8.4.0",
3333
"ext-curl": "*",
34+
"ext-dom": "*",
3435
"ext-json": "*",
3536
"solarium/solarium": ">=6.0 <7.0",
3637
"typo3/cms-core": "^12.4",

0 commit comments

Comments
 (0)