[TASK] Add unit test to cover stdWrap_cObject 38/48638/3
authorElmar Hinz <t3elmar@gmail.com>
Wed, 22 Jun 2016 13:40:51 +0000 (15:40 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Sun, 26 Jun 2016 09:44:04 +0000 (11:44 +0200)
Resolves: #76735
Releases: master
Change-Id: If62c582c7a1fea018761ebffee6244b8ecdfbbb3
Reviewed-on: https://review.typo3.org/48638
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php

index 56a9a27..f97b151 100644 (file)
@@ -1253,6 +1253,38 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             $subject->stdWrap_field('discarded', $conf));
     }
 
+    /**
+     * Check if stdWrap_cObject works properly.
+     *
+     * Show:
+     *
+     * - Delegates to the method cObjGetSingle().
+     * - First parameter is $conf['cObject'].
+     * - Second parameter is $conf['cObject.'].
+     * - Third parameter is '/stdWrap/.cObject'.
+     * - Returns the return.
+     *
+     * @test
+     * @return void
+     */
+    public function stdWrap_cObject()
+    {
+        $debugKey =  '/stdWrap/.cObject';
+        $conf = [
+            'cObject' => $this->getUniqueId('cObject'),
+            'cObject.' => [$this->getUniqueId('cObject.')],
+        ];
+        $subject = $this->getMockBuilder(ContentObjectRenderer::class)
+            ->setMethods(['cObjGetSingle'])->getMock();
+        $subject
+            ->expects($this->once())
+            ->method('cObjGetSingle')
+            ->with($conf['cObject'], $conf['cObject.'], $debugKey)
+            ->willReturn('return');
+        $this->assertSame('return',
+            $subject->stdWrap_cObject('discard', $conf));
+    }
+
     /**
      * Data provider for stdWrap_csConv
      *