‪TYPO3CMS  11.5
IconForRecordViewHelperTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Prophecy\Argument;
21 use Prophecy\PhpUnit\ProphecyTrait;
26 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
27 
28 class ‪IconForRecordViewHelperTest extends FunctionalTestCase
29 {
30  use ProphecyTrait;
31 
35  protected ‪$initializeDatabase = false;
36 
41  {
42  $iconProphecy = $this->prophesize(Icon::class);
43  $iconProphecy->render(Argument::any())->willReturn('icon html');
44  $iconFactoryProphecy = $this->prophesize(IconFactory::class);
45  $iconFactoryProphecy->getIconForRecord(Argument::cetera())->willReturn($iconProphecy->reveal());
46  GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
47 
48  $view = new ‪StandaloneView();
49  $view->setTemplateSource('<core:iconForRecord table="tt_content" row="{uid: 123}" size="large" alternativeMarkupIdentifier="inline" />');
50  $view->render();
51 
52  $iconFactoryProphecy->getIconForRecord('tt_content', ['uid' => 123], ‪Icon::SIZE_LARGE)->shouldHaveBeenCalled();
53  $iconProphecy->render('inline')->shouldHaveBeenCalled();
54  }
55 }
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Core\Tests\Functional\ViewHelpers\IconForRecordViewHelperTest\renderRendersIconCallingIconFactoryAccordingToGivenArguments
‪renderRendersIconCallingIconFactoryAccordingToGivenArguments()
Definition: IconForRecordViewHelperTest.php:38
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:34
‪TYPO3\CMS\Core\Tests\Functional\ViewHelpers\IconForRecordViewHelperTest\$initializeDatabase
‪bool $initializeDatabase
Definition: IconForRecordViewHelperTest.php:33
‪TYPO3\CMS\Core\Tests\Functional\ViewHelpers
Definition: IconForRecordViewHelperTest.php:18
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:31
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Core\Tests\Functional\ViewHelpers\IconForRecordViewHelperTest
Definition: IconForRecordViewHelperTest.php:29
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_LARGE
‪const SIZE_LARGE
Definition: Icon.php:40