[TASK] Add unit test to cover stdWrap_preIfEmptyListNum 44/48644/2
authorElmar Hinz <t3elmar@gmail.com>
Wed, 22 Jun 2016 15:51:23 +0000 (17:51 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 22 Jun 2016 19:44:50 +0000 (21:44 +0200)
Releases: master
Resolves: #76743
Change-Id: Ib9e05e74bc88db4b1e9467c2f295c35de0fbc1c3
Reviewed-on: https://review.typo3.org/48644
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>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php

index 944aef6..c87befb 100644 (file)
@@ -911,6 +911,45 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         }
     }
 
+    /**
+     * Check if stdWrap_preIfEmptyListNum works properly.
+     *
+     * Show:
+     *
+     * - Delegates to method listNum.
+     * - Parameter 1 is $content.
+     * - Parameter 2 is $conf['preIfEmptyListNum'].
+     * - Parameter 3 is $conf['preIfEmptyListNum.']['splitChar'].
+     * - Returns the return value.
+     *
+     * @test
+     * @return void
+     */
+    public function stdWrap_preIfEmptyListNum()
+    {
+        $content = $this->getUniqueId('content');
+        $conf = [
+            'preIfEmptyListNum' => $this->getUniqueId('preIfEmptyListNum'),
+            'preIfEmptyListNum.' => [
+                'splitChar' => $this->getUniqueId('splitChar')
+            ],
+        ];
+        $return = $this->getUniqueId('return');
+        $subject = $this->getMockBuilder(ContentObjectRenderer::class)
+            ->setMethods(['listNum'])->getMock();
+        $subject
+            ->expects($this->once())
+            ->method('listNum')
+            ->with(
+                $content,
+                $conf['preIfEmptyListNum'],
+                $conf['preIfEmptyListNum.']['splitChar']
+            )
+            ->willReturn($return);
+        $this->assertSame($return,
+            $subject->stdWrap_preIfEmptyListNum($content, $conf));
+    }
+
     /**
      * Data provider for stdWrap_csConv
      *