[TASK] Update caching framework to latest FLOW3 version
[Packages/TYPO3.CMS.git] / tests / t3lib / class.t3lib_extmgmTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2011 Oliver Hader <oliver@typo3.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Testcase for class t3lib_extMgm
27 *
28 * @author Oliver Hader <oliver@typo3.org>
29 * @author Oliver Klee <typo3-coding@oliverklee.de>
30 *
31 * @package TYPO3
32 * @subpackage t3lib
33 */
34 class t3lib_extmgmTest extends tx_phpunit_testcase {
35 /**
36 * backup of defined GLOBALS
37 *
38 * @var array
39 */
40 protected $globals = array();
41
42 public function setUp() {
43 $this->globals = array(
44 'TYPO3_CONF_VARS' => serialize($GLOBALS['TYPO3_CONF_VARS']),
45 'TYPO3_LOADED_EXT' => serialize($GLOBALS['TYPO3_LOADED_EXT']),
46 'TCA' => serialize($GLOBALS['TCA']),
47 );
48 }
49
50 public function tearDown() {
51 t3lib_extMgm::clearExtensionKeyMap();
52
53 foreach ($this->globals as $key => $value) {
54 $GLOBALS[$key] = unserialize($value);
55 }
56 }
57
58
59 //////////////////////
60 // Utility functions
61 //////////////////////
62
63 /**
64 * Generates a basic TCA for a given table.
65 *
66 * @param string $table name of the table, must not be empty
67 * @return array generated TCA for the given table, will not be empty
68 */
69 private function generateTCAForTable($table) {
70 $tca = array();
71 $tca[$table] = array();
72 $tca[$table]['columns'] = array(
73 'fieldA' => array(),
74 'fieldC' => array(),
75 );
76 $tca[$table]['types'] = array(
77 'typeA' => array('showitem' => 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, fieldD'),
78 'typeB' => array('showitem' => 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, fieldD'),
79 'typeC' => array('showitem' => 'fieldC;;paletteD'),
80 );
81 $tca[$table]['palettes'] = array(
82 'paletteA' => array('showitem' => 'fieldX, fieldY'),
83 'paletteB' => array('showitem' => 'fieldX, fieldY'),
84 'paletteC' => array('showitem' => 'fieldX, fieldY'),
85 'paletteD' => array('showitem' => 'fieldX, fieldY'),
86 );
87
88 return $tca;
89 }
90
91 /**
92 * Returns the fixtures path for this testcase relative to PATH_site.
93 *
94 * @return string the fixtures path for this testcase, will not be empty
95 */
96 private function determineFixturesPath() {
97 return t3lib_div::makeInstance('Tx_Phpunit_Service_TestFinder')
98 ->getRelativeCoreTestsPath() . 't3lib/fixtures/';
99 }
100
101
102 /////////////////////////////////////////////
103 // Tests concerning getExtensionKeyByPrefix
104 /////////////////////////////////////////////
105
106 /**
107 * @test
108 * @see t3lib_extMgm::getExtensionKeyByPrefix
109 */
110 public function getExtensionKeyByPrefixForLoadedExtensionWithUnderscoresReturnsExtensionKey() {
111 t3lib_extMgm::clearExtensionKeyMap();
112
113 $uniqueSuffix = uniqid('test');
114 $extensionKey = 'tt_news' . $uniqueSuffix;
115 $extensionPrefix = 'tx_ttnews' . $uniqueSuffix;
116
117 $GLOBALS['TYPO3_LOADED_EXT'][$extensionKey] = array();
118
119 $this->assertEquals(
120 $extensionKey,
121 t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix)
122 );
123 }
124
125 /**
126 * @test
127 * @see t3lib_extMgm::getExtensionKeyByPrefix
128 */
129 public function getExtensionKeyByPrefixForLoadedExtensionWithoutUnderscoresReturnsExtensionKey() {
130 t3lib_extMgm::clearExtensionKeyMap();
131
132 $uniqueSuffix = uniqid('test');
133 $extensionKey = 'kickstarter' . $uniqueSuffix;
134 $extensionPrefix = 'tx_kickstarter' . $uniqueSuffix;
135
136 $GLOBALS['TYPO3_LOADED_EXT'][$extensionKey] = array();
137
138 $this->assertEquals(
139 $extensionKey,
140 t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix)
141 );
142 }
143
144 /**
145 * @test
146 * @see t3lib_extMgm::getExtensionKeyByPrefix
147 */
148 public function getExtensionKeyByPrefixForNotLoadedExtensionReturnsFalse(){
149 t3lib_extMgm::clearExtensionKeyMap();
150
151 $uniqueSuffix = uniqid('test');
152 $extensionKey = 'unloadedextension' . $uniqueSuffix;
153 $extensionPrefix = 'tx_unloadedextension' . $uniqueSuffix;
154
155 $this->assertFalse(
156 t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix)
157 );
158 }
159
160
161 //////////////////////////////////////
162 // Tests concerning addToAllTCAtypes
163 //////////////////////////////////////
164
165 /**
166 * Tests whether fields can be add to all TCA types and duplicate fields are considered.
167 * @test
168 * @see t3lib_extMgm::addToAllTCAtypes()
169 */
170 public function canAddFieldsToAllTCATypesBeforeExistingOnes() {
171 $table = uniqid('tx_coretest_table');
172 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
173
174 t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'before:fieldD');
175
176 // Checking typeA:
177 $this->assertEquals(
178 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, newA, newB, fieldD',
179 $GLOBALS['TCA'][$table]['types']['typeA']['showitem']
180 );
181 // Checking typeB:
182 $this->assertEquals(
183 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, newA, newB, fieldD',
184 $GLOBALS['TCA'][$table]['types']['typeB']['showitem']
185 );
186 }
187
188 /**
189 * Tests whether fields can be add to all TCA types and duplicate fields are considered.
190 * @test
191 * @see t3lib_extMgm::addToAllTCAtypes()
192 */
193 public function canAddFieldsToAllTCATypesAfterExistingOnes() {
194 $table = uniqid('tx_coretest_table');
195 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
196
197 t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:fieldC');
198
199 // Checking typeA:
200 $this->assertEquals(
201 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, newA, newB, fieldD',
202 $GLOBALS['TCA'][$table]['types']['typeA']['showitem']
203 );
204 // Checking typeB:
205 $this->assertEquals(
206 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, newA, newB, fieldD',
207 $GLOBALS['TCA'][$table]['types']['typeB']['showitem']
208 );
209 }
210
211 /**
212 * Tests whether fields can be add to a TCA type before existing ones
213 * @test
214 * @see t3lib_extMgm::addToAllTCAtypes()
215 */
216 public function canAddFieldsToTCATypeBeforeExistingOnes() {
217 $table = uniqid('tx_coretest_table');
218 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
219
220 t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'before:fieldD');
221
222 // Checking typeA:
223 $this->assertEquals(
224 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, newA, newB, fieldD',
225 $GLOBALS['TCA'][$table]['types']['typeA']['showitem']
226 );
227 // Checking typeB:
228 $this->assertEquals(
229 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, fieldD',
230 $GLOBALS['TCA'][$table]['types']['typeB']['showitem']
231 );
232 }
233
234 /**
235 * Tests whether fields can be add to a TCA type after existing ones
236 * @test
237 * @see t3lib_extMgm::addToAllTCAtypes()
238 */
239 public function canAddFieldsToTCATypeAfterExistingOnes() {
240 $table = uniqid('tx_coretest_table');
241 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
242
243 t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'after:fieldC');
244
245 // Checking typeA:
246 $this->assertEquals(
247 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, newA, newB, fieldD',
248 $GLOBALS['TCA'][$table]['types']['typeA']['showitem']
249 );
250 // Checking typeB:
251 $this->assertEquals(
252 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, fieldD',
253 $GLOBALS['TCA'][$table]['types']['typeB']['showitem']
254 );
255 }
256
257 /**
258 * Test wheter replacing other TCA fields works as promissed
259 * @test
260 * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
261 */
262 public function canAddFieldsToTCATypeAndReplaceExistingOnes() {
263 $table = uniqid('tx_coretest_table');
264 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
265
266 $typesBefore = $GLOBALS['TCA'][$table]['types'];
267
268 t3lib_extMgm::addToAllTCAtypes($table, 'fieldZ', '', 'replace:fieldX');
269
270 $this->assertEquals(
271 $typesBefore,
272 $GLOBALS['TCA'][$table]['types'],
273 'It\'s wrong that the "types" array changes here - the replaced field is only on palettes'
274 );
275
276 // unchanged because the palette is not used
277 $this->assertEquals(
278 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
279 );
280 // unchanged because the palette is not used
281 $this->assertEquals(
282 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']
283 );
284
285 $this->assertEquals(
286 'fieldZ, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']
287 );
288
289 $this->assertEquals(
290 'fieldZ, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']
291 );
292 }
293
294
295
296 ///////////////////////////////////////////////////
297 // Tests concerning addFieldsToAllPalettesOfField
298 ///////////////////////////////////////////////////
299
300 /**
301 * Tests whether fields can be added to a palette before existing elements.
302 * @test
303 * @see t3lib_extMgm::addFieldsToPalette()
304 */
305 public function canAddFieldsToPaletteBeforeExistingOnes() {
306 $table = uniqid('tx_coretest_table');
307 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
308
309 t3lib_extMgm::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'before:fieldY');
310
311 $this->assertEquals(
312 'fieldX, newA, newB, fieldY',
313 $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
314 );
315 }
316
317 /**
318 * Tests whether fields can be added to a palette after existing elements.
319 * @test
320 * @see t3lib_extMgm::addFieldsToPalette()
321 */
322 public function canAddFieldsToPaletteAfterExistingOnes() {
323 $table = uniqid('tx_coretest_table');
324 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
325
326 t3lib_extMgm::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:fieldX');
327
328 $this->assertEquals(
329 'fieldX, newA, newB, fieldY',
330 $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
331 );
332 }
333
334 /**
335 * Tests whether fields can be added to a palette after a not existing elements.
336 * @test
337 * @see t3lib_extMgm::addFieldsToPalette()
338 */
339 public function canAddFieldsToPaletteAfterNotExistingOnes() {
340 $table = uniqid('tx_coretest_table');
341 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
342
343 t3lib_extMgm::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:' . uniqid('notExisting'));
344
345 $this->assertEquals(
346 'fieldX, fieldY, newA, newB',
347 $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
348 );
349 }
350
351 /**
352 * Tests whether fields can be added to all palettes of a regular field before existing ones.
353 * @test
354 * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
355 */
356 public function canAddFieldsToAllPalettesOfFieldBeforeExistingOnes() {
357 $table = uniqid('tx_coretest_table');
358 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
359
360 t3lib_extMgm::addFieldsToAllPalettesOfField($table, 'fieldC', 'newA, newA, newB, fieldX', 'before:fieldY');
361
362 $this->assertEquals(
363 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
364 );
365 $this->assertEquals(
366 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']
367 );
368 $this->assertEquals(
369 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']
370 );
371 $this->assertEquals(
372 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']
373 );
374 }
375
376 /**
377 * Tests whether fields can be added to all palettes of a regular field after existing ones.
378 * @test
379 * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
380 */
381 public function canAddFieldsToAllPalettesOfFieldAfterExistingOnes() {
382 $table = uniqid('tx_coretest_table');
383 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
384
385 t3lib_extMgm::addFieldsToAllPalettesOfField($table, 'fieldC', 'newA, newA, newB, fieldX', 'after:fieldX');
386
387 $this->assertEquals(
388 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
389 );
390 $this->assertEquals(
391 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']
392 );
393 $this->assertEquals(
394 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']
395 );
396 $this->assertEquals(
397 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']
398 );
399 }
400
401 /**
402 * Tests whether fields can be added to all palettes of a regular field after a not existing field.
403 * @test
404 * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
405 */
406 public function canAddFieldsToAllPalettesOfFieldAfterNotExistingOnes() {
407 $table = uniqid('tx_coretest_table');
408 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
409
410 t3lib_extMgm::addFieldsToAllPalettesOfField($table, 'fieldC', 'newA, newA, newB, fieldX', 'after:' . uniqid('notExisting'));
411
412 $this->assertEquals(
413 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
414 );
415 $this->assertEquals(
416 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']
417 );
418 $this->assertEquals(
419 'fieldX, fieldY, newA, newB', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']
420 );
421 $this->assertEquals(
422 'fieldX, fieldY, newA, newB', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']
423 );
424 }
425
426 /**
427 * Tests whether fields are added to a new palette that did not exist before.
428 * @test
429 * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
430 */
431 public function canAddFieldsToAllPalettesOfFieldWithoutPaletteExistingBefore() {
432 $table = uniqid('tx_coretest_table');
433 $GLOBALS['TCA'] = $this->generateTCAForTable($table);
434
435 t3lib_extMgm::addFieldsToAllPalettesOfField($table, 'fieldA', 'newA, newA, newB, fieldX');
436
437 $this->assertEquals(
438 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
439 );
440 $this->assertEquals(
441 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']
442 );
443 $this->assertEquals(
444 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']
445 );
446 $this->assertEquals(
447 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']
448 );
449 $this->assertEquals(
450 'newA, newB, fieldX', $GLOBALS['TCA'][$table]['palettes']['generatedFor-fieldA']['showitem']
451 );
452 }
453
454
455 /////////////////////////////////////////
456 // Tests concerning addTcaSelectItem
457 /////////////////////////////////////////
458
459 /**
460 * @test
461 * @expectedException InvalidArgumentException
462 */
463 public function addTcaSelectItemThrowsExceptionIfTableIsNotOfTypeString() {
464 t3lib_extMgm::addTcaSelectItem(array(), 'foo', array());
465 }
466
467 /**
468 * @test
469 * @expectedException InvalidArgumentException
470 */
471 public function addTcaSelectItemThrowsExceptionIfFieldIsNotOfTypeString() {
472 t3lib_extMgm::addTcaSelectItem('foo', array(), array());
473 }
474
475 /**
476 * @test
477 * @expectedException InvalidArgumentException
478 */
479 public function addTcaSelectItemThrowsExceptionIfRelativeToFieldIsNotOfTypeString() {
480 t3lib_extMgm::addTcaSelectItem('foo', 'bar', array(), array());
481 }
482
483 /**
484 * @test
485 * @expectedException InvalidArgumentException
486 */
487 public function addTcaSelectItemThrowsExceptionIfRelativePositionIsNotOfTypeString() {
488 t3lib_extMgm::addTcaSelectItem('foo', 'bar', array(), 'foo', array());
489 }
490
491 /**
492 * @test
493 * @expectedException InvalidArgumentException
494 */
495 public function addTcaSelectItemThrowsExceptionIfRelativePositionIsNotOneOfValidKeywords() {
496 t3lib_extMgm::addTcaSelectItem('foo', 'bar', array(), 'foo', 'not allowed keyword');
497 }
498
499 /**
500 * @test
501 * @expectedException RuntimeException
502 */
503 public function addTcaSelectItemThrowsExceptionIfFieldIsNotFoundInTca() {
504 $GLOBALS['TCA'] = array();
505 t3lib_extMgm::addTcaSelectItem('foo', 'bar', array());
506 }
507
508 /**
509 * Data provider for addTcaSelectItemInsertsItemAtSpecifiedPosition
510 */
511 public function addTcaSelectItemDataProvider() {
512 // Every array splits into:
513 // - relativeToField
514 // - relativePosition
515 // - expectedResultArray
516 return array(
517 'add at end of array' => array(
518 '',
519 '',
520 array(
521 0 => array('firstElement'),
522 1 => array('matchMe'),
523 2 => array('thirdElement'),
524 3 => array('insertedElement'),
525 ),
526 ),
527 'replace element' => array(
528 'matchMe',
529 'replace',
530 array(
531 0 => array('firstElement'),
532 1 => array('insertedElement'),
533 2 => array('thirdElement'),
534 ),
535 ),
536 'add element after' => array(
537 'matchMe',
538 'after',
539 array(
540 0 => array('firstElement'),
541 1 => array('matchMe'),
542 2 => array('insertedElement'),
543 3 => array('thirdElement'),
544 ),
545 ),
546 'add element before' => array(
547 'matchMe',
548 'before',
549 array(
550 0 => array('firstElement'),
551 1 => array('insertedElement'),
552 2 => array('matchMe'),
553 3 => array('thirdElement'),
554 ),
555 ),
556 'add at end if relative position was not found' => array(
557 'notExistingItem',
558 'after',
559 array(
560 0 => array('firstElement'),
561 1 => array('matchMe'),
562 2 => array('thirdElement'),
563 3 => array('insertedElement'),
564 ),
565 ),
566 );
567 }
568
569 /**
570 * @test
571 * @dataProvider addTcaSelectItemDataProvider
572 */
573 public function addTcaSelectItemInsertsItemAtSpecifiedPosition($relativeToField, $relativePosition, $expectedResultArray) {
574 $GLOBALS['TCA'] = array(
575 'testTable' => array(
576 'columns' => array(
577 'testField' => array(
578 'config' => array(
579 'items' => array(
580 '0' => array('firstElement'),
581 '1' => array('matchMe'),
582 2 => array('thirdElement'),
583 ),
584 ),
585 ),
586 ),
587 ),
588 );
589 t3lib_extMgm::addTcaSelectItem('testTable', 'testField', array('insertedElement'), $relativeToField, $relativePosition);
590 $this->assertEquals($expectedResultArray, $GLOBALS['TCA']['testTable']['columns']['testField']['config']['items']);
591 }
592
593
594 /////////////////////////////////////////
595 // Tests concerning getExtensionVersion
596 /////////////////////////////////////////
597
598 /**
599 * Data provider for negative getExtensionVersion() tests.
600 *
601 * @return array
602 */
603 public function getExtensionVersionFaultyDataProvider() {
604 return array(
605 array(''),
606 array(0),
607 array(new stdClass()),
608 array(TRUE),
609 );
610 }
611
612 /**
613 * @test
614 * @expectedException InvalidArgumentException
615 * @dataProvider getExtensionVersionFaultyDataProvider
616 */
617 public function getExtensionVersionForFaultyExtensionKeyThrowsException($key) {
618 t3lib_extMgm::getExtensionVersion($key);
619 }
620
621 /**
622 * @test
623 */
624 public function getExtensionVersionForNotLoadedExtensionReturnsEmptyString() {
625 t3lib_extMgm::clearExtensionKeyMap();
626
627 $uniqueSuffix = uniqid('test');
628 $extensionKey = 'unloadedextension' . $uniqueSuffix;
629
630 $this->assertEquals(
631 '',
632 t3lib_extMgm::getExtensionVersion($extensionKey)
633 );
634 }
635
636 /**
637 * @test
638 */
639 public function getExtensionVersionForLoadedExtensionReturnsExtensionVersion() {
640 t3lib_extMgm::clearExtensionKeyMap();
641
642 $uniqueSuffix = uniqid('test');
643 $extensionKey = 'unloadedextension' . $uniqueSuffix;
644
645 $GLOBALS['TYPO3_LOADED_EXT'][$extensionKey] = array(
646 'siteRelPath' => $this->determineFixturesPath(),
647 );
648 $this->assertEquals(
649 '1.2.3',
650 t3lib_extMgm::getExtensionVersion($extensionKey)
651 );
652 }
653
654 /**
655 * @test
656 */
657 public function getEnabledExtensionListConsidersRequiredExtensions() {
658 $testrequiRedExtension = uniqid('test');
659 $GLOBALS['TYPO3_CONF_VARS']['EXT']['requiredExt'] = $testrequiRedExtension;
660
661 $extensions = explode(',', t3lib_extMgm::getEnabledExtensionList());
662 $this->assertTrue(in_array($testrequiRedExtension, $extensions));
663 }
664
665 /**
666 * @test
667 */
668 public function getEnabledExtensionListConsidersRequiredAndIgnoredExtensions() {
669 $testRequiredExtension = uniqid('test');
670 $testIgnoredExtension = uniqid('test');
671 $GLOBALS['TYPO3_CONF_VARS']['EXT']['requiredExt'] = $testRequiredExtension . ',' . $testIgnoredExtension;
672 $GLOBALS['TYPO3_CONF_VARS']['EXT']['ignoredExt'] = $testIgnoredExtension;
673
674 $extensions = explode(',', t3lib_extMgm::getEnabledExtensionList());
675 $this->assertTrue(in_array($testRequiredExtension, $extensions));
676 $this->assertFalse(in_array($testIgnoredExtension, $extensions));
677 }
678 }
679 ?>