‪TYPO3CMS  ‪main
BitmapIconProviderTest.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 
23 use TYPO3\CMS\Core\Imaging\IconSize;
25 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
26 
30 final class ‪BitmapIconProviderTest extends UnitTestCase
31 {
33 
37  protected ‪$icon;
38 
39  protected function ‪setUp(): void
40  {
41  parent::setUp();
42  $this->subject = new ‪BitmapIconProvider();
43  $this->icon = GeneralUtility::makeInstance(Icon::class);
44  $this->icon->setIdentifier('foo');
45  $this->icon->setSize(IconSize::SMALL);
46  }
47 
52  {
53  $this->subject->prepareIconMarkup($this->icon, ['source' => 'fileadmin/foo.png']);
54  self::assertEquals('<img src="fileadmin/foo.png" width="16" height="16" alt="" />', $this->icon->getMarkup());
55  }
56 
61  {
62  $this->subject->prepareIconMarkup($this->icon, ['source' => ‪Environment::getPublicPath() . '/fileadmin/foo.png']);
63  self::assertEquals('<img src="fileadmin/foo.png" width="16" height="16" alt="" />', $this->icon->getMarkup());
64  }
65 
70  {
71  $this->subject->prepareIconMarkup($this->icon, ['source' => 'EXT:core/Resources/Public/Images/foo.png']);
72  self::assertEquals('<img src="typo3/sysext/core/Resources/Public/Images/foo.png" width="16" height="16" alt="" />', $this->icon->getMarkup());
73  }
74 }
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:27
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static getPublicPath()
Definition: Environment.php:187
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\setUp
‪setUp()
Definition: BitmapIconProviderTest.php:38
‪TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider
Definition: BitmapIconProvider.php:27
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\$icon
‪Icon $icon
Definition: BitmapIconProviderTest.php:36
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\prepareIconMarkupWithRelativeSourceReturnsInstanceOfIconWithCorrectMarkup
‪prepareIconMarkupWithRelativeSourceReturnsInstanceOfIconWithCorrectMarkup()
Definition: BitmapIconProviderTest.php:50
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\prepareIconMarkupEXTSourceReferenceReturnsInstanceOfIconWithCorrectMarkup
‪prepareIconMarkupEXTSourceReferenceReturnsInstanceOfIconWithCorrectMarkup()
Definition: BitmapIconProviderTest.php:68
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest
Definition: BitmapIconProviderTest.php:31
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\prepareIconMarkupWithAbsoluteSourceReturnsInstanceOfIconWithCorrectMarkup
‪prepareIconMarkupWithAbsoluteSourceReturnsInstanceOfIconWithCorrectMarkup()
Definition: BitmapIconProviderTest.php:59
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider
Definition: BitmapIconProviderTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider\BitmapIconProviderTest\$subject
‪BitmapIconProvider $subject
Definition: BitmapIconProviderTest.php:32