From a0ea123c505d5802f80af1e9490074d46e9d0564 Mon Sep 17 00:00:00 2001
From: Elmar Hinz <t3elmar@gmail.com>
Date: Wed, 22 Jun 2016 17:51:23 +0200
Subject: [PATCH] [TASK] Add unit test to cover stdWrap_preIfEmptyListNum

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>
---
 .../ContentObjectRendererTest.php             | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
index 944aef6f08e2..c87befb0c1d8 100644
--- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
+++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
@@ -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
      *
-- 
GitLab