1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kitodo\Dlf\Tests\Unit\ViewHelpers; |
4
|
|
|
|
5
|
|
|
use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
6
|
|
|
use Kitodo\Dlf\ViewHelpers\StdWrapViewHelper; |
7
|
|
|
use TYPO3\CMS\Fluid\View\StandaloneView; |
8
|
|
|
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; |
|
|
|
|
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @covers StdWrapViewHelper |
12
|
|
|
*/ |
13
|
|
|
class StdWrapViewHelperTest extends FunctionalTestCase |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var bool Speed up this test case, it needs no database |
17
|
|
|
*/ |
18
|
|
|
protected $initializeDatabase = false; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @test |
22
|
|
|
*/ |
23
|
|
|
public function renderWithStdWrap(): void |
24
|
|
|
{ |
25
|
|
|
$view = new StandaloneView(); |
26
|
|
|
$view->assign('metadataWrap', |
27
|
|
|
[ |
28
|
|
|
'key' => ['wrap' => '<label>|</label>'], |
29
|
|
|
'value' => ['required' => 1, 'wrap' => '<li>|</li>'], |
30
|
|
|
'all' => ['wrap' => '<article class="shlb-metadata-text-item metadata-title">|</article>'] |
31
|
|
|
] |
32
|
|
|
); |
33
|
|
|
|
34
|
|
|
// A fully filled array with correct values does not make any difference. The rendering result |
35
|
|
|
// is not been influenced by the viewhelpers data parameter. |
36
|
|
|
$view->assign('metaSectionCObj', [0 => ['tilte' => 'A test title']]); |
37
|
|
|
|
38
|
|
|
$view->setTemplateSource( |
39
|
|
|
'<html xmlns:kitodo="http://typo3.org/ns/Kitodo/Dlf/ViewHelpers"> |
40
|
|
|
<kitodo:stdWrap wrap="{metadataWrap.all}" data="{metaCObjData.0}"> |
41
|
|
|
<kitodo:stdWrap wrap="{metadataWrap.key}" data="{metaCObjData.0}">Label</kitodo:stdWrap> |
42
|
|
|
<h2>Title</h2><p>Text</p> |
43
|
|
|
</kitodo:stdWrap> |
44
|
|
|
</html>' |
45
|
|
|
); |
46
|
|
|
|
47
|
|
|
$this->assertXmlStringEqualsXmlString( |
48
|
|
|
'<html xmlns:kitodo="http://typo3.org/ns/Kitodo/Dlf/ViewHelpers"> |
49
|
|
|
<article class="shlb-metadata-text-item metadata-title"> |
50
|
|
|
<label>Label</label> |
51
|
|
|
<h2>Title</h2><p>Text</p> |
52
|
|
|
</article> |
53
|
|
|
</html>', |
54
|
|
|
$view->render() |
55
|
|
|
); |
56
|
|
|
|
57
|
|
|
// Without using the data parameter the rendering result is the same as above. |
58
|
|
|
$view->setTemplateSource( |
59
|
|
|
'<html xmlns:kitodo="http://typo3.org/ns/Kitodo/Dlf/ViewHelpers"> |
60
|
|
|
<kitodo:stdWrap wrap="{metadataWrap.all}"> |
61
|
|
|
<kitodo:stdWrap wrap="{metadataWrap.key}">Label</kitodo:stdWrap> |
62
|
|
|
<h2>Title</h2><p>Text</p> |
63
|
|
|
</kitodo:stdWrap> |
64
|
|
|
</html>' |
65
|
|
|
); |
66
|
|
|
|
67
|
|
|
$this->assertXmlStringEqualsXmlString( |
68
|
|
|
'<html xmlns:kitodo="http://typo3.org/ns/Kitodo/Dlf/ViewHelpers"> |
69
|
|
|
<article class="shlb-metadata-text-item metadata-title"> |
70
|
|
|
<label>Label</label> |
71
|
|
|
<h2>Title</h2><p>Text</p> |
72
|
|
|
</article> |
73
|
|
|
</html>', |
74
|
|
|
$view->render() |
75
|
|
|
); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths