[TASK] Shorten the extend class in all unit tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Imaging / IconProvider / BitmapIconProviderTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Unit\Imaging\IconProvider;
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
17 use TYPO3\CMS\Core\Imaging\Icon;
18 use TYPO3\CMS\Core\Utility\GeneralUtility;
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20
21 /**
22 * Testcase for \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider
23 */
24 class BitmapIconProviderTest extends UnitTestCase
25 {
26 /**
27 * @var \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider
28 */
29 protected $subject;
30
31 /**
32 * @var \TYPO3\CMS\Core\Imaging\Icon
33 */
34 protected $icon;
35
36 /**
37 * Set up
38 */
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
47 /**
48 * @test
49 */
50 public function prepareIconMarkupWithRelativeSourceReturnsInstanceOfIconWithCorrectMarkup()
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
56 /**
57 * @test
58 */
59 public function prepareIconMarkupWithAbsoluteSourceReturnsInstanceOfIconWithCorrectMarkup()
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
65 /**
66 * @test
67 */
68 public function prepareIconMarkupEXTSourceReferenceReturnsInstanceOfIconWithCorrectMarkup()
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 }