From 3fc55917b28cae2110d7885587c9e7f6156e7372 Mon Sep 17 00:00:00 2001
From: Elmar Hinz <t3elmar@gmail.com>
Date: Thu, 23 Jun 2016 13:29:56 +0200
Subject: [PATCH] [TASK] Refactor unit test to cover stdWrap_strPad

Resolves: #76756
Releases: master
Change-Id: I78d1b112cd6f292cc19b28779c760bf5289d8c07
Reviewed-on: https://review.typo3.org/48653
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../ContentObjectRendererTest.php             | 120 +++++++++---------
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
index c87befb0c1d8..1004bf9566b6 100644
--- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
+++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
@@ -1294,112 +1294,112 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @return array
+     * Data provider for stdWrap_strPad.
+     *
+     * @return array [$expect, $content, $conf]
      */
     public function stdWrap_strPadDataProvider()
     {
-        return array(
-            'pad string with default settings and length 10' => array(
+        return [
+            'pad string with default settings and length 10' => [
+                'Alien     ',
                 'Alien',
-                array(
+                [
                     'length' => '10',
-                ),
-                'Alien     ',
-            ),
-            'pad string with padWith -= and type left and length 10' => array(
+                ],
+            ],
+            'pad string with padWith -= and type left and length 10' => [
+                '-=-=-Alien',
                 'Alien',
-                array(
+                [
                     'length' => '10',
                     'padWith' => '-=',
                     'type' => 'left',
-                ),
-                '-=-=-Alien',
-            ),
-            'pad string with padWith _ and type both and length 10' => array(
+                ],
+            ],
+            'pad string with padWith _ and type both and length 10' => [
+                '__Alien___',
                 'Alien',
-                array(
+                [
                     'length' => '10',
                     'padWith' => '_',
                     'type' => 'both',
-                ),
-                '__Alien___',
-            ),
-            'pad string with padWith 0 and type both and length 10' => array(
+                ],
+            ],
+            'pad string with padWith 0 and type both and length 10' => [
+                '00Alien000',
                 'Alien',
-                array(
+                [
                     'length' => '10',
                     'padWith' => '0',
                     'type' => 'both',
-                ),
-                '00Alien000',
-            ),
-            'pad string with padWith ___ and type both and length 6' => array(
+                ],
+            ],
+            'pad string with padWith ___ and type both and length 6' => [
+                'Alien_',
                 'Alien',
-                array(
+                [
                     'length' => '6',
                     'padWith' => '___',
                     'type' => 'both',
-                ),
-                'Alien_',
-            ),
-            'pad string with padWith _ and type both and length 12, using stdWrap for length' => array(
+                ],
+            ],
+            'pad string with padWith _ and type both and length 12, using stdWrap for length' => [
+                '___Alien____',
                 'Alien',
-                array(
+                [
                     'length' => '1',
-                    'length.' => array(
+                    'length.' => [
                         'wrap' => '|2',
-                    ),
+                    ],
                     'padWith' => '_',
                     'type' => 'both',
-                ),
-                '___Alien____',
-            ),
-            'pad string with padWith _ and type both and length 12, using stdWrap for padWidth' => array(
+                ],
+            ],
+            'pad string with padWith _ and type both and length 12, using stdWrap for padWidth' => [
+                '-_=Alien-_=-',
                 'Alien',
-                array(
+                [
                     'length' => '12',
                     'padWith' => '_',
-                    'padWith.' => array(
+                    'padWith.' => [
                         'wrap' => '-|=',
-                    ),
+                    ],
                     'type' => 'both',
-                ),
-                '-_=Alien-_=-',
-            ),
-            'pad string with padWith _ and type both and length 12, using stdWrap for type' => array(
+                ],
+            ],
+            'pad string with padWith _ and type both and length 12, using stdWrap for type' => [
+                '_______Alien',
                 'Alien',
-                array(
+                [
                     'length' => '12',
                     'padWith' => '_',
                     'type' => 'both',
                     // make type become "left"
-                    'type.' => array(
+                    'type.' => [
                         'substring' => '2,1',
                         'wrap' => 'lef|',
-                    ),
-                ),
-                '_______Alien',
-            ),
-        );
+                    ],
+                ],
+            ],
+        ];
     }
 
     /**
-     * Test for the stdWrap function "strPad"
+     * Check if stdWrap_strPad works properly.
      *
-     * @param string $content
-     * @param array $conf
-     * @param string $expected
-     *
-     * @dataProvider stdWrap_strPadDataProvider
      * @test
+     * @dataProvider stdWrap_strPadDataProvider
+     * @param string $expect The expected output.
+     * @param string $content The given input.
+     * @param array $conf The configuration of 'strPad.'.
+     * @return void
      */
-    public function stdWrap_strPad($content, $conf, $expected)
+    public function stdWrap_strPad($expect, $content, $conf)
     {
-        $conf = array(
-            'strPad.' => $conf
-        );
+        $conf = ['strPad.' => $conf];
         $result = $this->subject->stdWrap_strPad($content, $conf);
-        $this->assertEquals($expected, $result);
+        $this->assertSame($expect, $result);
     }
 
     /**
-- 
GitLab