[TASK] Add unit test to cover stdWrap_postUserFunc 45/48745/3
authorElmar Hinz <t3elmar@gmail.com>
Thu, 30 Jun 2016 10:18:16 +0000 (12:18 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 6 Jul 2016 08:48:04 +0000 (10:48 +0200)
Releases: master
Resolves: #76849
Change-Id: Ibf74561f5339deacf14f1d87038a56e49e98a9f0
Reviewed-on: https://review.typo3.org/48745
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php

index 14b624d..155f1d7 100644 (file)
@@ -4529,6 +4529,37 @@ class ContentObjectRendererTest extends UnitTestCase
         $this->assertSame($return, $subject->stdWrap_typolink($content, $conf));
     }
 
+    /**
+     * Check that stdWrap_postUserFunc works properly.
+     *
+     * Show:
+     *  - Delegates to method callUserFunction.
+     *  - Parameter 1 is $conf['postUserFunc'].
+     *  - Parameter 2 is $conf['postUserFunc.'].
+     *  - Returns the return value.
+     *
+     *  @test
+     *  @return void.
+     */
+    public function stdWrap_postUserFunc()
+    {
+        $content = $this->getUniqueId('content');
+        $conf = [
+            'postUserFunc' => $this->getUniqueId('postUserFunc'),
+            'postUserFunc.' => [$this->getUniqueId('postUserFunc.')],
+        ];
+        $return = $this->getUniqueId('return');
+        $subject = $this->getMockBuilder(ContentObjectRenderer::class)
+            ->setMethods(['callUserFunction'])->getMock();
+        $subject
+            ->expects($this->once())
+            ->method('callUserFunction')
+            ->with($conf['postUserFunc'], $conf['postUserFunc.'])
+            ->willReturn($return);
+        $this->assertSame($return,
+            $subject->stdWrap_postUserFunc($content, $conf));
+    }
+
     ///////////////////////////////
     // Tests concerning getData()
     ///////////////////////////////