‪TYPO3CMS  9.5
BitmapIconProviderTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪BitmapIconProviderTest extends UnitTestCase
25 {
29  protected ‪$subject;
30 
34  protected ‪$icon;
35 
39  protected function ‪setUp()
40  {
41  $this->subject = new \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider();
42  $this->icon = GeneralUtility::makeInstance(Icon::class);
43  $this->icon->setIdentifier('foo');
44  $this->icon->setSize(‪Icon::SIZE_SMALL);
45  }
46 
51  {
52  $this->subject->prepareIconMarkup($this->icon, ['source' => 'fileadmin/foo.png']);
53  $this->assertEquals('<img src="fileadmin/foo.png" width="16" height="16" />', $this->icon->getMarkup());
54  }
55 
60  {
61  $this->subject->prepareIconMarkup($this->icon, ['source' => '/fileadmin/foo.png']);
62  $this->assertEquals('<img src="/fileadmin/foo.png" width="16" height="16" />', $this->icon->getMarkup());
63  }
64 
69  {
70  $this->subject->prepareIconMarkup($this->icon, ['source' => 'EXT:core/Resources/Public/Images/foo.png']);
71  $this->assertEquals('<img src="typo3/sysext/core/Resources/Public/Images/foo.png" width="16" height="16" />', $this->icon->getMarkup());
72  }
73 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:29
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:25
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\setUp
‪setUp()
Definition: BitmapIconProviderTest.php:37
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\$subject
‪TYPO3 CMS Core Imaging IconProvider BitmapIconProvider $subject
Definition: BitmapIconProviderTest.php:28
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\prepareIconMarkupWithRelativeSourceReturnsInstanceOfIconWithCorrectMarkup
‪prepareIconMarkupWithRelativeSourceReturnsInstanceOfIconWithCorrectMarkup()
Definition: BitmapIconProviderTest.php:48
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\prepareIconMarkupEXTSourceReferenceReturnsInstanceOfIconWithCorrectMarkup
‪prepareIconMarkupEXTSourceReferenceReturnsInstanceOfIconWithCorrectMarkup()
Definition: BitmapIconProviderTest.php:66
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest
Definition: BitmapIconProviderTest.php:25
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\$icon
‪TYPO3 CMS Core Imaging Icon $icon
Definition: BitmapIconProviderTest.php:32
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\prepareIconMarkupWithAbsoluteSourceReturnsInstanceOfIconWithCorrectMarkup
‪prepareIconMarkupWithAbsoluteSourceReturnsInstanceOfIconWithCorrectMarkup()
Definition: BitmapIconProviderTest.php:57
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider
Definition: BitmapIconProviderTest.php:2