[TASK] Adjust contrast colors in diff view
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Tests / Functional / ViewHelpers / Format / ImplodeViewHelperTest.php
1 <?php
2 namespace TYPO3\CMS\Frontend\Tests\Functional\ViewHelpers\Format;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 use TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
17 use TYPO3\CMS\Frontend\ViewHelpers\Format\ImplodeViewHelper;
18
19 /**
20 * Class ImplodeViewHelperTest
21 */
22 class ImplodeViewHelperTest extends ViewHelperBaseTestcase {
23
24 /**
25 * @var ImplodeViewHelper|\PHPUnit_Framework_MockObject_MockObject
26 */
27 protected $subject;
28
29 protected function setUp() {
30 parent::setUp();
31 $this->subject = $this->getMock(ImplodeViewHelper::class, array('renderChildren'));
32 $this->injectDependenciesIntoViewHelper($this->subject);
33 }
34
35 /**
36 * @return array
37 */
38 public function implodeDataProvider() {
39 return [
40 'Join elements with space' => [
41 ['class-a', 'class-b', 'class-c'],
42 ' ',
43 TRUE,
44 'class-a class-b class-c'
45 ],
46 'Join elements with space excluding empty values' => [
47 ['class-a', 'class-b', '', 'class-d'],
48 ' ',
49 TRUE,
50 'class-a class-b class-d'
51 ],
52 'Join elements with space including empty values' => [
53 ['class-a', 'class-b', '', 'class-d'],
54 ' ',
55 FALSE,
56 'class-a class-b class-d'
57 ],
58 'Join elements with /' => [
59 ['class-a', 'class-b', 'class-c'],
60 '/',
61 TRUE,
62 'class-a/class-b/class-c'
63 ],
64 'Join elements with / excluding empty values' => [
65 ['class-a', 'class-b', '', 'class-d'],
66 '/',
67 TRUE,
68 'class-a/class-b/class-d'
69 ],
70 'Join elements with / including empty values' => [
71 ['class-a', 'class-b', '', 'class-d'],
72 '/',
73 FALSE,
74 'class-a/class-b//class-d'
75 ],
76 ];
77 }
78
79 /**
80 * @test
81 * @dataProvider implodeDataProvider
82 */
83 public function ImplodeViewHelperOutputTest($values, $glue, $excludeEmptyValues, $expectedResult) {
84 $actualResult = $this->subject->render($values, $glue, $excludeEmptyValues);
85 $this->assertEquals($expectedResult, $actualResult);
86 }
87
88 }