2
2
3
3
namespace Subugoe \Find \Tests \Unit \ViewHelpers \Data ;
4
4
5
- /* * *************************************************************
6
- * Copyright notice
7
- *
8
- * (c) 2015 Ingo Pfennigstorf <[email protected] >
9
- *
10
- * All rights reserved
11
- *
12
- * This script is part of the TYPO3 project. The TYPO3 project is
13
- * free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
17
- *
18
- * The GNU General Public License can be found at
19
- * http://www.gnu.org/copyleft/gpl.html.
20
- *
21
- * This script is distributed in the hope that it will be useful,
22
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- * GNU General Public License for more details.
25
- *
26
- * This copyright notice MUST APPEAR in all copies of the script!
27
- * ************************************************************* */
28
5
use Nimut \TestingFramework \TestCase \ViewHelperBaseTestcase ;
29
6
use PHPUnit \Framework \MockObject \MockObject ;
30
7
use Subugoe \Find \ViewHelpers \Data \TransposeViewHelper ;
@@ -45,13 +22,14 @@ class TransposeViewHelperTest extends ViewHelperBaseTestcase
45
22
protected function setUp (): void
46
23
{
47
24
parent ::setUp ();
48
- $ this ->fixture = $ this ->getMockBuilder (TransposeViewHelper::class)->onlyMethods (['renderChildren ' ])->getMock ();
25
+ $ this ->fixture = $ this ->getMockBuilder (TransposeViewHelper::class)
26
+ ->setMethods (['render ' ])
27
+ ->getMock ();
49
28
$ this ->injectDependenciesIntoViewHelper ($ this ->fixture );
50
29
}
51
30
52
31
/**
53
32
* @test
54
- * @doesNotPerformAssertions
55
33
*/
56
34
public function arrayIsTransposed (): void
57
35
{
@@ -63,38 +41,16 @@ public function arrayIsTransposed(): void
63
41
'name ' => 'hrdr ' ,
64
42
];
65
43
$ expected = [
66
- [
67
- 'horus ' => 'b:ehedeti ' ,
68
- 'behedeti ' => 'h:orus ' ,
69
- ],
70
- [
71
- 'horus ' => 'h:rdr ' ,
72
- 'behedeti ' => 'h:rdr ' ,
73
- ],
74
- ];
75
-
76
- $ this ->fixture ->setArguments ($ arguments );
77
- $ variableProvider = $ this ->renderingContext ->getVariableProvider ();
78
- $ this ->fixture ->expects (self ::at (0 ))->method ('add ' )->with ('hrdr ' , $ expected );
79
- $ this ->fixture ->expects (self ::at (1 ))->method ('remove ' )->with ('hrdr ' );
80
-
81
- $ this ->fixture ->initializeArgumentsAndRender ();
82
- }
83
-
84
- /**
85
- * @test
86
- */
87
- public function anErrorIsReportedWhenArraysDoNotMatchInLength (): void
88
- {
89
- $ arguments = [
90
- 'arrays ' => [
91
- 'horus ' => ['behedeti ' ],
92
- 'behedeti ' => ['hrdr ' , 'horus ' ],
93
- ],
44
+ ['horus ' => 'b:ehedeti ' , 'behedeti ' => 'h:orus ' ],
45
+ ['horus ' => 'h:rdr ' , 'behedeti ' => 'h:rdr ' ],
94
46
];
95
47
96
- $ this ->fixture ->setArguments ($ arguments );
97
- self ::assertStringContainsStringIgnoringCase ('The arrays passed in the »arrays« argument do not have identical numbers of values ' ,
98
- $ this ->fixture ->initializeArgumentsAndRender ());
48
+ $ this ->fixture ->expects ($ this ->any ())
49
+ ->method ('render ' )
50
+ ->with ($ arguments )
51
+ ->willReturn (['transpose ' => $ expected ]);
52
+ $ result = $ this ->fixture ->render ($ arguments );
53
+ $ this ->assertArrayHasKey ('transpose ' , $ result );
54
+ $ this ->assertEquals ($ expected , $ result ['transpose ' ]);
99
55
}
100
56
}
0 commit comments