From: Elmar Hinz Date: Wed, 22 Jun 2016 13:40:51 +0000 (+0200) Subject: [TASK] Add unit test to cover stdWrap_cObject X-Git-Tag: TYPO3_8-2-0~43 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/5edb9b52536c8291a82b9a9c5a0062d8dedf3c84 [TASK] Add unit test to cover stdWrap_cObject Resolves: #76735 Releases: master Change-Id: If62c582c7a1fea018761ebffee6244b8ecdfbbb3 Reviewed-on: https://review.typo3.org/48638 Reviewed-by: Daniel Goerz Tested-by: Daniel Goerz Tested-by: Bamboo TYPO3com Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php index 56a9a270685d..f97b15100c36 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php @@ -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 *