[TASK] Add unit test to cover stdWrap_prepend 34/48734/4
authorElmar Hinz <t3elmar@gmail.com>
Wed, 29 Jun 2016 10:44:48 +0000 (12:44 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 6 Jul 2016 15:07:23 +0000 (17:07 +0200)
Resolves: #76845
Releases: master
Change-Id: I250f9560cb644c9867f83a302f2cd636034e3435
Reviewed-on: https://review.typo3.org/48734
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php

index 39d4fd0..e8326ac 100644 (file)
@@ -1299,6 +1299,40 @@ class ContentObjectRendererTest extends UnitTestCase
     }
 
     /**
+     * Check if stdWrap_prepend works properly.
+     *
+     * Show:
+     *
+     * - Delegates to the method cObjGetSingle().
+     * - First parameter is $conf['prepend'].
+     * - Second parameter is $conf['prepend.'].
+     * - Third parameter is '/stdWrap/.prepend'.
+     * - Returns the return value prepended to $content.
+     *
+     * @test
+     * @return void
+     */
+    public function stdWrap_prepend()
+    {
+        $debugKey =  '/stdWrap/.prepend';
+        $content = $this->getUniqueId('content');
+        $conf = [
+            'prepend' => $this->getUniqueId('prepend'),
+            'prepend.' => [$this->getUniqueId('prepend.')],
+        ];
+        $return = $this->getUniqueId('return');
+        $subject = $this->getMockBuilder(ContentObjectRenderer::class)
+            ->setMethods(['cObjGetSingle'])->getMock();
+        $subject
+            ->expects($this->once())
+            ->method('cObjGetSingle')
+            ->with($conf['prepend'], $conf['prepend.'], $debugKey)
+            ->willReturn($return);
+        $this->assertSame($return . $content,
+            $subject->stdWrap_prepend($content, $conf));
+    }
+
+    /**
      * Check if stdWrap_cObject works properly.
      *
      * Show: