TYPO3 CMS  TYPO3_7-6
SpriteManagerTest.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 
18 
23 {
25  // Tests concerning addTcaTypeIcon
27 
31  {
33  $this->assertArrayHasKey('tcarecords--', $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']);
34  }
35 
40  {
42  $this->assertEquals('', $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']['tcarecords--']);
43  }
44 
49  {
50  $table = 'tt_content';
51  $type = 'contains-news';
52  SpriteManager::addTcaTypeIcon($table, $type, '');
53  $this->assertArrayHasKey('tcarecords-' . $table . '-' . $type, $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']);
54  }
55 
60  {
61  $imagePath = 'path/to/my-icon.png';
62  $table = 'tt_content';
63  $type = 'contains-news';
64  SpriteManager::addTcaTypeIcon($table, $type, $imagePath);
65  $this->assertEquals($imagePath, $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']['tcarecords-' . $table . '-' . $type]);
66  }
67 
69  // Tests concerning addSingleIcons
71 
75  {
76  $type = '';
77  $imagePath = 'path/to/my-icon.png';
78  $icons = [$type => $imagePath];
79  $extensionKey = 'dummy';
80  SpriteManager::addSingleIcons($icons, $extensionKey);
81  $this->assertArrayHasKey('extensions-' . $extensionKey . '-' . $type, $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']);
82  }
83 
88  {
89  $type = '';
90  $imagePath = 'path/to/my-icon.png';
91  $icons = [$type => $imagePath];
92  $extensionKey = 'dummy';
93  SpriteManager::addSingleIcons($icons, $extensionKey);
94  $this->assertEquals($imagePath, $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']['extensions-' . $extensionKey . '-' . $type]);
95  }
96 
101  {
102  $type = 'contains-news';
103  $imagePath = 'path/to/my-icon.png';
104  $icons = [$type => $imagePath];
105  $extensionKey = 'dummy';
106  SpriteManager::addSingleIcons($icons, $extensionKey);
107  $this->assertArrayHasKey('extensions-' . $extensionKey . '-' . $type, $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']);
108  }
109 
114  {
115  $type = 'contains-news';
116  $imagePath = 'path/to/my-icon.png';
117  $icons = [$type => $imagePath];
118  $extensionKey = 'dummy';
119  SpriteManager::addSingleIcons($icons, $extensionKey);
120  $this->assertEquals($imagePath, $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons']['extensions-' . $extensionKey . '-' . $type]);
121  }
122 }
static addTcaTypeIcon($table, $type, $iconFile)
static addSingleIcons(array $icons, $extKey='')
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']