‪TYPO3CMS  ‪main
ExtensionManagementUtilityTest.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 
20 use PHPUnit\Framework\MockObject\MockObject;
24 use TYPO3\CMS\Core\Package\PackageManager;
30 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
31 
32 final class ‪ExtensionManagementUtilityTest extends UnitTestCase
33 {
34  protected bool ‪$resetSingletonInstances = true;
35  protected ?PackageManager ‪$backUpPackageManager;
36 
37  protected function ‪setUp(): void
38  {
39  parent::setUp();
41  }
42 
43  protected function ‪tearDown(): void
44  {
46  parent::tearDown();
47  }
48 
49  protected function ‪createMockPackageManagerWithMockPackage(string $packageKey, array $packageMethods = ['getPackagePath', 'getPackageKey']): MockObject&PackageManager
50  {
51  $packagePath = ‪Environment::getVarPath() . '/tests/' . $packageKey . '/';
52  ‪GeneralUtility::mkdir_deep($packagePath);
53  $this->testFilesToDelete[] = $packagePath;
54  $package = $this->getMockBuilder(Package::class)
55  ->disableOriginalConstructor()
56  ->onlyMethods($packageMethods)
57  ->getMock();
58  $packageManager = $this->getMockBuilder(PackageManager::class)
59  ->onlyMethods(['isPackageActive', 'getPackage', 'getActivePackages'])
60  ->disableOriginalConstructor()
61  ->getMock();
62  $package
63  ->method('getPackagePath')
64  ->willReturn($packagePath);
65  $package
66  ->method('getPackageKey')
67  ->willReturn($packageKey);
68  $packageManager
69  ->method('isPackageActive')
70  ->willReturnMap([
71  [null, false],
72  [$packageKey, true],
73  ]);
74  $packageManager
75  ->method('getPackage')
76  ->with(self::equalTo($packageKey))
77  ->willReturn($package);
78  $packageManager
79  ->method('getActivePackages')
80  ->willReturn([$packageKey => $package]);
81  return $packageManager;
82  }
83 
85  // Tests concerning isLoaded
87 
91  {
93  }
94 
96  // Tests concerning extPath
98 
102  {
103  $this->expectException(\BadFunctionCallException::class);
104  $this->expectExceptionCode(1365429656);
105 
106  $packageName = ‪StringUtility::getUniqueId('foo');
107  $packageManager = $this->getMockBuilder(PackageManager::class)
108  ->onlyMethods(['isPackageActive'])
109  ->disableOriginalConstructor()
110  ->getMock();
111  $packageManager->expects(self::once())
112  ->method('isPackageActive')
113  ->with(self::equalTo($packageName))
114  ->willReturn(false);
117  }
118 
122  public function ‪extPathAppendsScriptNameToPath(): void
123  {
124  $package = $this->getMockBuilder(Package::class)
125  ->disableOriginalConstructor()
126  ->onlyMethods(['getPackagePath'])
127  ->getMock();
128  $packageManager = $this->getMockBuilder(PackageManager::class)
129  ->onlyMethods(['isPackageActive', 'getPackage'])
130  ->disableOriginalConstructor()
131  ->getMock();
132  $package->expects(self::once())
133  ->method('getPackagePath')
134  ->willReturn(‪Environment::getPublicPath() . '/foo/');
135  $packageManager->expects(self::once())
136  ->method('isPackageActive')
137  ->with(self::equalTo('foo'))
138  ->willReturn(true);
139  $packageManager->expects(self::once())
140  ->method('getPackage')
141  ->with('foo')
142  ->willReturn($package);
144  self::assertSame(‪Environment::getPublicPath() . '/foo/bar.txt', ‪ExtensionManagementUtility::extPath('foo', 'bar.txt'));
145  }
146 
148  // Utility functions
150 
156  private function ‪generateTCAForTable(string $table): array
157  {
158  ‪$tca = [];
159  ‪$tca[$table] = [];
160  ‪$tca[$table]['columns'] = [
161  'fieldA' => [],
162  'fieldC' => [],
163  ];
164  ‪$tca[$table]['types'] = [
165  'typeA' => ['showitem' => 'fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, fieldD, fieldD1'],
166  'typeB' => ['showitem' => 'fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, fieldD, fieldD1'],
167  'typeC' => ['showitem' => 'fieldC;;paletteD'],
168  ];
169  ‪$tca[$table]['palettes'] = [
170  'paletteA' => ['showitem' => 'fieldX, fieldX1, fieldY'],
171  'paletteB' => ['showitem' => 'fieldX, fieldX1, fieldY'],
172  'paletteC' => ['showitem' => 'fieldX, fieldX1, fieldY'],
173  'paletteD' => ['showitem' => 'fieldX, fieldX1, fieldY'],
174  ];
175  return ‪$tca;
176  }
177 
181  public static function ‪extensionKeyDataProvider(): array
182  {
183  return [
184  'Without underscores' => [
185  'testkey',
186  'tx_testkey',
187  ],
188  'With underscores' => [
189  'this_is_a_test_extension',
190  'tx_thisisatestextension',
191  ],
192  'With user prefix and without underscores' => [
193  'user_testkey',
194  'user_testkey',
195  ],
196  'With user prefix and with underscores' => [
197  'user_test_key',
198  'user_testkey',
199  ],
200  ];
201  }
202 
207  public function ‪getClassNamePrefixForExtensionKey(string $extensionName, string $expectedPrefix): void
208  {
209  self::assertSame($expectedPrefix, ‪ExtensionManagementUtility::getCN($extensionName));
210  }
211 
213  // Tests concerning addToAllTCAtypes
215 
222  {
223  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
224  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
225  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'before:fieldD');
226  // Checking typeA:
227  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, newA, newB, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
228  // Checking typeB:
229  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, newA, newB, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeB']['showitem']);
230  }
231 
239  {
240  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
241  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
242  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:fieldC');
243  // Checking typeA:
244  self::assertEquals('fieldA, fieldB, fieldC;labelC, newA, newB, --palette--;;paletteC, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
245  // Checking typeB:
246  self::assertEquals('fieldA, fieldB, fieldC;labelC, newA, newB, --palette--;;paletteC, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeB']['showitem']);
247  }
248 
256  {
257  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
258  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
259  ‪$GLOBALS['TCA'][$table]['types']['typeD'] = ['showitem' => 'fieldY, --palette--;;standard, fieldZ'];
260  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:--palette--;;standard');
261  // Checking typeD:
262  self::assertEquals('fieldY, --palette--;;standard, newA, newB, fieldA, fieldZ', ‪$GLOBALS['TCA'][$table]['types']['typeD']['showitem']);
263  }
264 
272  {
273  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
274  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
275  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:fieldX1');
276  // Checking typeA:
277  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, newA, newB, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
278  }
279 
287  {
288  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
289  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
290  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'before:fieldD');
291  // Checking typeA:
292  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, newA, newB, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
293  // Checking typeB:
294  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeB']['showitem']);
295  }
296 
304  {
305  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
306  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
307  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'after:fieldC');
308  // Checking typeA:
309  self::assertEquals('fieldA, fieldB, fieldC;labelC, newA, newB, --palette--;;paletteC, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
310  // Checking typeB:
311  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeB']['showitem']);
312  }
313 
318  {
319  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
320  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
321  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'field', 'typeA', 'after:fieldD1');
322 
323  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, fieldD, fieldD1, field', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
324  }
325 
333  {
334  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
335  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
336  $typesBefore = ‪$GLOBALS['TCA'][$table]['types'];
337  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'fieldZ', '', 'replace:fieldX');
338  self::assertEquals($typesBefore, ‪$GLOBALS['TCA'][$table]['types'], 'It\'s wrong that the "types" array changes here - the replaced field is only on palettes');
339  // unchanged because the palette is not used
340  self::assertEquals('fieldX, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
341  self::assertEquals('fieldX, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']);
342  // changed
343  self::assertEquals('fieldZ, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']);
344  self::assertEquals('fieldZ, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']);
345  }
346 
351  {
352  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
353  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
354  $typesBefore = ‪$GLOBALS['TCA'][$table]['types'];
355  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'fieldX, --palette--;;foo', '', 'replace:fieldX');
356  self::assertEquals($typesBefore, ‪$GLOBALS['TCA'][$table]['types'], 'It\'s wrong that the "types" array changes here - the replaced field is only on palettes');
357  // unchanged because the palette is not used
358  self::assertEquals('fieldX, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
359  self::assertEquals('fieldX, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']);
360  // changed
361  self::assertEquals('fieldX, --palette--;;foo, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']);
362  self::assertEquals('fieldX, --palette--;;foo, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']);
363  }
364 
369  {
370  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
371  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
372  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'fieldX, --palette--;;newpalette', '', 'after:palette:paletteC');
373  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldX, --palette--;;newpalette, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
374  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldX, --palette--;;newpalette, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeB']['showitem']);
375  }
376 
380  public function ‪addToAllTCAtypesAddsBeforeDiv(): void
381  {
382  $showitemDiv = '--div--;LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:foobar';
383  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
384  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
385  ‪$GLOBALS['TCA'][$table]['types']['typeD']['showitem'] = $showitemDiv . ', ' . ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem'];
386 
387  ‪ExtensionManagementUtility::addToAllTCAtypes($table, 'fieldX', '', 'before:' . $showitemDiv);
388  self::assertEquals('fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, fieldD, fieldD1, fieldX', ‪$GLOBALS['TCA'][$table]['types']['typeA']['showitem']);
389  self::assertEquals('fieldX, ' . $showitemDiv . ', fieldA, fieldB, fieldC;labelC, --palette--;;paletteC, fieldC1, fieldD, fieldD1', ‪$GLOBALS['TCA'][$table]['types']['typeD']['showitem']);
390  }
391 
399  {
400  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
401  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
402  ‪ExtensionManagementUtility::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'before:fieldY');
403  self::assertEquals('fieldX, fieldX1, newA, newB, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
404  }
405 
413  {
414  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
415  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
416  ‪ExtensionManagementUtility::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:fieldX');
417  self::assertEquals('fieldX, newA, newB, fieldX1, fieldY', ‪$GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
418  }
419 
427  {
428  $table = ‪StringUtility::getUniqueId('tx_coretest_table');
429  ‪$GLOBALS['TCA'] = $this->‪generateTCAForTable($table);
430  ‪ExtensionManagementUtility::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:' . ‪StringUtility::getUniqueId('notExisting'));
431  self::assertEquals('fieldX, fieldX1, fieldY, newA, newB', ‪$GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
432  }
433 
435  {
436  return [
437  'Simple' => [
438  'field_b, field_d, field_c',
439  'field_a, field_b, field_c',
440  'field_d',
441  ],
442  'with linebreaks' => [
443  'field_b, --linebreak--, field_d, --linebreak--, field_c',
444  'field_a, field_b, field_c',
445  '--linebreak--, field_d, --linebreak--',
446  ],
447  'with linebreaks in list and insertion list' => [
448  'field_b, --linebreak--, field_d, --linebreak--, field_c',
449  'field_a, field_b, --linebreak--, field_c',
450  '--linebreak--, field_d, --linebreak--',
451  ],
452  ];
453  }
454 
459  public function ‪removeDuplicatesForInsertionRemovesDuplicates(string $insertionList, string $list, string $expected): void
460  {
462  self::assertSame($expected, $result);
463  }
464 
466  // Tests concerning addFieldsToAllPalettesOfField
468 
473  {
474  ‪$GLOBALS['TCA'] = [
475  'aTable' => [
476  'types' => [
477  'typeA' => [
478  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
479  ],
480  ],
481  'palettes' => [
482  'paletteA' => [
483  'showitem' => 'fieldX, fieldY',
484  ],
485  ],
486  ],
487  ];
488  $expected = ‪$GLOBALS['TCA'];
490  'aTable',
491  'fieldA',
492  'newA'
493  );
494  self::assertEquals($expected, ‪$GLOBALS['TCA']);
495  }
496 
501  {
502  ‪$GLOBALS['TCA'] = [
503  'aTable' => [
504  'columns' => [
505  'fieldA' => [],
506  ],
507  'types' => [
508  'typeA' => [
509  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
510  ],
511  ],
512  'palettes' => [
513  'paletteA' => [
514  'showitem' => 'fieldX, fieldY',
515  ],
516  ],
517  ],
518  ];
519  $expected = [
520  'aTable' => [
521  'columns' => [
522  'fieldA' => [],
523  ],
524  'types' => [
525  'typeA' => [
526  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
527  ],
528  ],
529  'palettes' => [
530  'paletteA' => [
531  'showitem' => 'fieldX, fieldY, dupeA',
532  ],
533  ],
534  ],
535  ];
537  'aTable',
538  'fieldA',
539  'dupeA, dupeA' // Duplicate
540  );
541  self::assertEquals($expected, ‪$GLOBALS['TCA']);
542  }
543 
548  {
549  ‪$GLOBALS['TCA'] = [
550  'aTable' => [
551  'columns' => [
552  'fieldA' => [],
553  ],
554  'types' => [
555  'typeA' => [
556  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
557  ],
558  ],
559  'palettes' => [
560  'paletteA' => [
561  'showitem' => 'existingA',
562  ],
563  ],
564  ],
565  ];
566  $expected = [
567  'aTable' => [
568  'columns' => [
569  'fieldA' => [],
570  ],
571  'types' => [
572  'typeA' => [
573  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
574  ],
575  ],
576  'palettes' => [
577  'paletteA' => [
578  'showitem' => 'existingA',
579  ],
580  ],
581  ],
582  ];
584  'aTable',
585  'fieldA',
586  'existingA'
587  );
588  self::assertEquals($expected, ‪$GLOBALS['TCA']);
589  }
590 
595  {
596  ‪$GLOBALS['TCA'] = [
597  'aTable' => [
598  'columns' => [
599  'fieldA' => [],
600  ],
601  'types' => [
602  'typeA' => [
603  'showitem' => 'fieldA, --palette--;;palette1',
604  ],
605  'typeB' => [
606  'showitem' => 'fieldA;aLabel, --palette--;;palette2',
607  ],
608  ],
609  'palettes' => [
610  'palette1' => [
611  'showitem' => 'fieldX',
612  ],
613  'palette2' => [
614  'showitem' => 'fieldY',
615  ],
616  ],
617  ],
618  ];
619  $expected = [
620  'aTable' => [
621  'columns' => [
622  'fieldA' => [],
623  ],
624  'types' => [
625  'typeA' => [
626  'showitem' => 'fieldA, --palette--;;palette1',
627  ],
628  'typeB' => [
629  'showitem' => 'fieldA;aLabel, --palette--;;palette2',
630  ],
631  ],
632  'palettes' => [
633  'palette1' => [
634  'showitem' => 'fieldX, newA',
635  ],
636  'palette2' => [
637  'showitem' => 'fieldY, newA',
638  ],
639  ],
640  ],
641  ];
643  'aTable',
644  'fieldA',
645  'newA'
646  );
647  self::assertEquals($expected, ‪$GLOBALS['TCA']);
648  }
649 
654  {
655  ‪$GLOBALS['TCA'] = [
656  'aTable' => [
657  'columns' => [
658  'fieldA' => [],
659  ],
660  'types' => [
661  'typeA' => [
662  'showitem' => 'fieldA, --palette--;;palette1',
663  ],
664  ],
665  'palettes' => [
666  'palette1' => [
667  'showitem' => 'fieldX',
668  ],
669  ],
670  ],
671  ];
672  $expected = [
673  'aTable' => [
674  'columns' => [
675  'fieldA' => [],
676  ],
677  'types' => [
678  'typeA' => [
679  'showitem' => 'fieldA, --palette--;;palette1',
680  ],
681  ],
682  'palettes' => [
683  'palette1' => [
684  'showitem' => 'fieldX, newA, newB',
685  ],
686  ],
687  ],
688  ];
690  'aTable',
691  'fieldA',
692  'newA, newB'
693  );
694  self::assertEquals($expected, ‪$GLOBALS['TCA']);
695  }
696 
701  {
702  ‪$GLOBALS['TCA'] = [
703  'aTable' => [
704  'columns' => [
705  'fieldA' => [],
706  ],
707  'types' => [
708  'typeA' => [
709  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
710  ],
711  ],
712  'palettes' => [
713  'paletteA' => [
714  'showitem' => 'existingA, existingB',
715  ],
716  ],
717  ],
718  ];
719  $expected = [
720  'aTable' => [
721  'columns' => [
722  'fieldA' => [],
723  ],
724  'types' => [
725  'typeA' => [
726  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
727  ],
728  ],
729  'palettes' => [
730  'paletteA' => [
731  'showitem' => 'existingA, newA, existingB',
732  ],
733  ],
734  ],
735  ];
737  'aTable',
738  'fieldA',
739  'newA',
740  'before:existingB'
741  );
742  self::assertEquals($expected, ‪$GLOBALS['TCA']);
743  }
744 
749  {
750  ‪$GLOBALS['TCA'] = [
751  'aTable' => [
752  'columns' => [
753  'fieldA' => [],
754  ],
755  'types' => [
756  'typeA' => [
757  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
758  ],
759  ],
760  'palettes' => [
761  'paletteA' => [
762  'showitem' => 'fieldX, fieldY',
763  ],
764  ],
765  ],
766  ];
767  $expected = [
768  'aTable' => [
769  'columns' => [
770  'fieldA' => [],
771  ],
772  'types' => [
773  'typeA' => [
774  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
775  ],
776  ],
777  'palettes' => [
778  'paletteA' => [
779  'showitem' => 'fieldX, fieldY, newA, newB',
780  ],
781  ],
782  ],
783  ];
785  'aTable',
786  'fieldA',
787  'newA, newB',
788  'before:notExisting'
789  );
790  self::assertEquals($expected, ‪$GLOBALS['TCA']);
791  }
792 
797  {
798  ‪$GLOBALS['TCA'] = [
799  'aTable' => [
800  'columns' => [
801  'fieldA' => [],
802  ],
803  'types' => [
804  'typeA' => [
805  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
806  ],
807  ],
808  'palettes' => [
809  'paletteA' => [
810  'showitem' => 'existingA, existingB',
811  ],
812  ],
813  ],
814  ];
815  $expected = [
816  'aTable' => [
817  'columns' => [
818  'fieldA' => [],
819  ],
820  'types' => [
821  'typeA' => [
822  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
823  ],
824  ],
825  'palettes' => [
826  'paletteA' => [
827  'showitem' => 'existingA, newA, existingB',
828  ],
829  ],
830  ],
831  ];
833  'aTable',
834  'fieldA',
835  'newA',
836  'after:existingA'
837  );
838  self::assertEquals($expected, ‪$GLOBALS['TCA']);
839  }
840 
845  {
846  ‪$GLOBALS['TCA'] = [
847  'aTable' => [
848  'columns' => [
849  'fieldA' => [],
850  ],
851  'types' => [
852  'typeA' => [
853  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
854  ],
855  ],
856  'palettes' => [
857  'paletteA' => [
858  'showitem' => 'existingA, existingB',
859  ],
860  ],
861  ],
862  ];
863  $expected = [
864  'aTable' => [
865  'columns' => [
866  'fieldA' => [],
867  ],
868  'types' => [
869  'typeA' => [
870  'showitem' => 'fieldA;labelA, --palette--;;paletteA',
871  ],
872  ],
873  'palettes' => [
874  'paletteA' => [
875  'showitem' => 'existingA, existingB, newA, newB',
876  ],
877  ],
878  ],
879  ];
881  'aTable',
882  'fieldA',
883  'newA, newB',
884  'after:notExistingA'
885  );
886  self::assertEquals($expected, ‪$GLOBALS['TCA']);
887  }
888 
893  {
894  ‪$GLOBALS['TCA'] = [
895  'aTable' => [
896  'columns' => [
897  'fieldA' => [],
898  ],
899  'types' => [
900  'typeA' => [
901  'showitem' => 'fieldA',
902  ],
903  ],
904  ],
905  ];
906  $expected = [
907  'aTable' => [
908  'columns' => [
909  'fieldA' => [],
910  ],
911  'types' => [
912  'typeA' => [
913  'showitem' => 'fieldA, --palette--;;generatedFor-fieldA',
914  ],
915  ],
916  'palettes' => [
917  'generatedFor-fieldA' => [
918  'showitem' => 'newA',
919  ],
920  ],
921  ],
922  ];
924  'aTable',
925  'fieldA',
926  'newA'
927  );
928  self::assertEquals($expected, ‪$GLOBALS['TCA']);
929  }
930 
935  {
936  ‪$GLOBALS['TCA'] = [
937  'aTable' => [
938  'columns' => [
939  'fieldA' => [],
940  ],
941  'types' => [
942  'typeA' => [
943  'showitem' => 'fieldA;labelA',
944  ],
945  ],
946  ],
947  ];
948  $expected = [
949  'aTable' => [
950  'columns' => [
951  'fieldA' => [],
952  ],
953  'types' => [
954  'typeA' => [
955  'showitem' => 'fieldA;labelA, --palette--;;generatedFor-fieldA',
956  ],
957  ],
958  'palettes' => [
959  'generatedFor-fieldA' => [
960  'showitem' => 'newA',
961  ],
962  ],
963  ],
964  ];
966  'aTable',
967  'fieldA',
968  'newA'
969  );
970  self::assertEquals($expected, ‪$GLOBALS['TCA']);
971  }
972 
974  // Tests concerning executePositionedStringInsertion
976 
981  {
982  return [
983  'normal characters' => [
984  'tr0',
985  'tr0',
986  ],
987  'newlines' => [
988  "test\n",
989  'test',
990  ],
991  'newlines with carriage return' => [
992  "test\r\n",
993  'test',
994  ],
995  'tabs' => [
996  "test\t",
997  'test',
998  ],
999  'commas' => [
1000  'test,',
1001  'test',
1002  ],
1003  'multiple commas with trailing spaces' => [
1004  "test,,\t, \r\n",
1005  'test',
1006  ],
1007  ];
1008  }
1009 
1014  public function ‪executePositionedStringInsertionTrimsCorrectCharacters(string $string, string $expectedResult): void
1015  {
1016  $extensionManagementUtility = $this->getAccessibleMock(ExtensionManagementUtility::class, null);
1017  $string = $extensionManagementUtility->_call('executePositionedStringInsertion', $string, '');
1018  self::assertEquals($expectedResult, $string);
1019  }
1020 
1022  // Tests concerning addTcaSelectItem
1024 
1029  {
1030  $this->expectException(\InvalidArgumentException::class);
1031  $this->expectExceptionCode(1303236967);
1032 
1033  ‪ExtensionManagementUtility::addTcaSelectItem('foo', 'bar', [], 'foo', 'not allowed keyword');
1034  }
1035 
1040  {
1041  $this->expectException(\RuntimeException::class);
1042  $this->expectExceptionCode(1303237468);
1043 
1044  ‪$GLOBALS['TCA'] = [];
1046  }
1047 
1051  public static function ‪addTcaSelectItemDataProvider(): array
1052  {
1053  // Every array splits into:
1054  // - relativeToField
1055  // - relativePosition
1056  // - expectedResultArray
1057  return [
1058  'add at end of array' => [
1059  '',
1060  '',
1061  [
1062  0 => ['label' => 'firstElement'],
1063  1 => ['label' => 'matchMe'],
1064  2 => ['label' => 'thirdElement'],
1065  3 => ['label' => 'insertedElement'],
1066  ],
1067  ],
1068  'replace element' => [
1069  'matchMe',
1070  'replace',
1071  [
1072  0 => ['label' => 'firstElement'],
1073  1 => ['label' => 'insertedElement'],
1074  2 => ['label' => 'thirdElement'],
1075  ],
1076  ],
1077  'add element after' => [
1078  'matchMe',
1079  'after',
1080  [
1081  0 => ['label' => 'firstElement'],
1082  1 => ['label' => 'matchMe'],
1083  2 => ['label' => 'insertedElement'],
1084  3 => ['label' => 'thirdElement'],
1085  ],
1086  ],
1087  'add element before' => [
1088  'matchMe',
1089  'before',
1090  [
1091  0 => ['label' => 'firstElement'],
1092  1 => ['label' => 'insertedElement'],
1093  2 => ['label' => 'matchMe'],
1094  3 => ['label' => 'thirdElement'],
1095  ],
1096  ],
1097  'add at end if relative position was not found' => [
1098  'notExistingItem',
1099  'after',
1100  [
1101  0 => ['label' => 'firstElement'],
1102  1 => ['label' => 'matchMe'],
1103  2 => ['label' => 'thirdElement'],
1104  3 => ['label' => 'insertedElement'],
1105  ],
1106  ],
1107  ];
1108  }
1109 
1114  public function ‪addTcaSelectItemInsertsItemAtSpecifiedPosition(string $relativeToField, string $relativePosition, array $expectedResultArray): void
1115  {
1116  ‪$GLOBALS['TCA'] = [
1117  'testTable' => [
1118  'columns' => [
1119  'testField' => [
1120  'config' => [
1121  'items' => [
1122  0 => ['label' => 'firstElement'],
1123  1 => ['label' => 'matchMe'],
1124  2 => ['label' => 'thirdElement'],
1125  ],
1126  ],
1127  ],
1128  ],
1129  ],
1130  ];
1131  ‪ExtensionManagementUtility::addTcaSelectItem('testTable', 'testField', ['label' => 'insertedElement'], $relativeToField, $relativePosition);
1132  self::assertEquals($expectedResultArray, ‪$GLOBALS['TCA']['testTable']['columns']['testField']['config']['items']);
1133  }
1134 
1136  // Tests concerning getExtensionVersion
1138 
1144  {
1145  $this->expectException(\InvalidArgumentException::class);
1146  $this->expectExceptionCode(1294586096);
1147 
1149  }
1150 
1155  {
1156  $uniqueSuffix = ‪StringUtility::getUniqueId('test');
1157  $extensionKey = 'unloadedextension' . $uniqueSuffix;
1158  self::assertEquals('', ‪ExtensionManagementUtility::getExtensionVersion($extensionKey));
1159  }
1160 
1165  {
1166  $uniqueSuffix = ‪StringUtility::getUniqueId('test');
1167  $extensionKey = 'unloadedextension' . $uniqueSuffix;
1168  $packageMetaData = $this->getMockBuilder(MetaData::class)
1169  ->onlyMethods(['getVersion'])
1170  ->setConstructorArgs([$extensionKey])
1171  ->getMock();
1172  $packageMetaData->method('getVersion')->willReturn('1.2.3');
1173  $packageManager = $this->‪createMockPackageManagerWithMockPackage($extensionKey, ['getPackagePath', 'getPackageKey', 'getPackageMetaData']);
1175  $package = $packageManager->getPackage($extensionKey);
1176  $package
1177  ->method('getPackageMetaData')
1178  ->willReturn($packageMetaData);
1180  self::assertEquals('1.2.3', ‪ExtensionManagementUtility::getExtensionVersion($extensionKey));
1181  }
1182 
1184  // Tests concerning loadExtension
1186 
1190  {
1191  $this->expectException(\RuntimeException::class);
1192  $this->expectExceptionCode(1342345486);
1193 
1194  $extensionKey = ‪StringUtility::getUniqueId('test');
1195  $packageManager = $this->‪createMockPackageManagerWithMockPackage($extensionKey);
1198  }
1199 
1201  // Tests concerning unloadExtension
1203 
1207  {
1208  $this->expectException(\RuntimeException::class);
1209  $this->expectExceptionCode(1342345487);
1210 
1211  $packageName = ‪StringUtility::getUniqueId('foo');
1212  $packageManager = $this->getMockBuilder(PackageManager::class)
1213  ->onlyMethods(['isPackageActive'])
1214  ->disableOriginalConstructor()
1215  ->getMock();
1216  $packageManager->expects(self::once())
1217  ->method('isPackageActive')
1218  ->with(self::equalTo($packageName))
1219  ->willReturn(false);
1222  }
1223 
1228  {
1229  $packageName = ‪StringUtility::getUniqueId('foo');
1230  $packageManager = $this->getMockBuilder(PackageManager::class)
1231  ->onlyMethods(['isPackageActive', 'deactivatePackage'])
1232  ->disableOriginalConstructor()
1233  ->getMock();
1234  $packageManager
1235  ->method('isPackageActive')
1236  ->willReturn(true);
1237  $packageManager->expects(self::once())
1238  ->method('deactivatePackage')
1239  ->with($packageName);
1242  }
1243 
1245  // Tests concerning addPlugin
1247 
1252  {
1253  $extKey = 'indexed_search';
1254  $expectedTCA = [
1255  [
1256  'label' => 'label',
1257  'value' => $extKey,
1258  'icon' => 'EXT:' . $extKey . '/Resources/Public/Icons/Extension.png',
1259  'group' => 'default',
1260  'description' => null,
1261  ],
1262  ];
1263  ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] = [];
1264  ‪ExtensionManagementUtility::addPlugin(['label', $extKey], 'list_type', $extKey);
1265  self::assertEquals($expectedTCA, ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items']);
1266  }
1267 
1272  {
1273  $extKey = 'indexed_search';
1274  ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] = [];
1275  ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['itemGroups']['my-second-group'] = 'My second group label from list_type';
1276  ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['itemGroups']['my-third-group'] = 'My third group label from list_type';
1277  ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups']['null-group'] = null;
1278  ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups']['my-group'] = 'My group label from CType';
1279  ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups']['my-third-group'] = 'My third group label from CType';
1280 
1281  // Won't be added since not defined in list_type or CType
1282  ‪ExtensionManagementUtility::addPlugin(['label', $extKey . '_1', '', 'non-existing-group'], 'list_type', $extKey);
1283  // Won't be added since invalid value in CType definition
1284  ‪ExtensionManagementUtility::addPlugin(['label', $extKey . '_2', '', 'null-group'], 'list_type', $extKey);
1285  ‪ExtensionManagementUtility::addPlugin(['label', $extKey . '_3', '', 'my-group'], 'list_type', $extKey);
1286  ‪ExtensionManagementUtility::addPlugin(['label', $extKey . '_4', '', 'my-second-group'], 'list_type', $extKey);
1287  ‪ExtensionManagementUtility::addPlugin(['label', $extKey . '_5', '', 'my-third-group'], 'list_type', $extKey);
1288 
1289  self::assertSame(
1290  [
1291  // Group exists in list_type>itemGroups
1292  'my-second-group' => 'My second group label from list_type',
1293  // Group exists in both - no overwriting
1294  'my-third-group' => 'My third group label from list_type',
1295  // Group exists in CType>itemGroups
1296  'my-group' => 'My group label from CType',
1297  ],
1298  ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['itemGroups']
1299  );
1300  }
1301 
1306  {
1307  $extKey = 'felogin';
1308  $expectedTCA = [
1309  [
1310  'label' => 'label',
1311  'value' => 'felogin',
1312  'icon' => 'content-form-login',
1313  'group' => 'default',
1314  'description' => null,
1315  ],
1316  ];
1317  ‪$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'] = [];
1318  ‪$GLOBALS['TCA']['tt_content']['types']['header'] = ['showitem' => 'header,header_link'];
1319  ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] = [];
1320  ‪ExtensionManagementUtility::addPlugin(['label', $extKey, 'content-form-login'], 'CType', $extKey);
1321  self::assertEquals($expectedTCA, ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items']);
1322  self::assertEquals([$extKey => 'content-form-login'], ‪$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']);
1323  self::assertEquals(‪$GLOBALS['TCA']['tt_content']['types']['header'], ‪$GLOBALS['TCA']['tt_content']['types']['felogin']);
1324  }
1325 
1330  {
1331  $extKey = 'felogin';
1332  $expectedTCA = [
1333  [
1334  'label' => 'label',
1335  'value' => 'felogin',
1336  'icon' => 'content-form-login',
1337  'group' => 'default',
1338  'description' => null,
1339  ],
1340  ];
1341  ‪$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'] = [];
1342  ‪$GLOBALS['TCA']['tt_content']['types']['header'] = ['showitem' => 'header,header_link'];
1343  ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] = [];
1344  ‪ExtensionManagementUtility::addPlugin(new ‪SelectItem('select', 'label', $extKey, 'content-form-login'), 'CType', $extKey);
1345  self::assertEquals($expectedTCA, ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items']);
1346  self::assertEquals([$extKey => 'content-form-login'], ‪$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']);
1347  self::assertEquals(‪$GLOBALS['TCA']['tt_content']['types']['header'], ‪$GLOBALS['TCA']['tt_content']['types']['felogin']);
1348  }
1349 
1350  public static function ‪addTcaSelectItemGroupAddsGroupDataProvider(): array
1351  {
1352  return [
1353  'add the first group' => [
1354  'my_group',
1355  'my_group_label',
1356  null,
1357  null,
1358  [
1359  'my_group' => 'my_group_label',
1360  ],
1361  ],
1362  'add a new group at the bottom' => [
1363  'my_group',
1364  'my_group_label',
1365  'bottom',
1366  [
1367  'default' => 'default_label',
1368  ],
1369  [
1370  'default' => 'default_label',
1371  'my_group' => 'my_group_label',
1372  ],
1373  ],
1374  'add a new group at the top' => [
1375  'my_group',
1376  'my_group_label',
1377  'top',
1378  [
1379  'default' => 'default_label',
1380  ],
1381  [
1382  'my_group' => 'my_group_label',
1383  'default' => 'default_label',
1384  ],
1385  ],
1386  'add a new group after an existing group' => [
1387  'my_group',
1388  'my_group_label',
1389  'after:default',
1390  [
1391  'default' => 'default_label',
1392  'special' => 'special_label',
1393  ],
1394  [
1395  'default' => 'default_label',
1396  'my_group' => 'my_group_label',
1397  'special' => 'special_label',
1398  ],
1399  ],
1400  'add a new group before an existing group' => [
1401  'my_group',
1402  'my_group_label',
1403  'before:default',
1404  [
1405  'default' => 'default_label',
1406  'special' => 'special_label',
1407  ],
1408  [
1409  'my_group' => 'my_group_label',
1410  'default' => 'default_label',
1411  'special' => 'special_label',
1412  ],
1413  ],
1414  'add a new group after a non-existing group moved to bottom' => [
1415  'my_group',
1416  'my_group_label',
1417  'after:default2',
1418  [
1419  'default' => 'default_label',
1420  'special' => 'special_label',
1421  ],
1422  [
1423  'default' => 'default_label',
1424  'special' => 'special_label',
1425  'my_group' => 'my_group_label',
1426  ],
1427  ],
1428  'add a new group which already exists does nothing' => [
1429  'my_group',
1430  'my_group_label',
1431  'does-not-matter',
1432  [
1433  'default' => 'default_label',
1434  'my_group' => 'existing_label',
1435  'special' => 'special_label',
1436  ],
1437  [
1438  'default' => 'default_label',
1439  'my_group' => 'existing_label',
1440  'special' => 'special_label',
1441  ],
1442  ],
1443  ];
1444  }
1445 
1450  public function ‪addTcaSelectItemGroupAddsGroup(string $groupId, string $groupLabel, ?string $position, ?array $existingGroups, array $expectedGroups): void
1451  {
1452  ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config'] = [];
1453  if (is_array($existingGroups)) {
1454  ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups'] = $existingGroups;
1455  }
1456  ‪ExtensionManagementUtility::addTcaSelectItemGroup('tt_content', 'CType', $groupId, $groupLabel, $position);
1457  self::assertEquals($expectedGroups, ‪$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups']);
1458  }
1459 
1464  {
1466  'myprovider',
1467  'auth',
1468  'myclass',
1469  [
1470  'title' => 'My authentication provider',
1471  'description' => 'Authentication with my provider',
1472  'subtype' => 'processLoginDataBE,getUserBE,authUserBE',
1473  'available' => true,
1474  'priority' => 80,
1475  'quality' => 100,
1476  ]
1477  );
1478  }
1479 }
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addService
‪static addService(string $extKey, string $serviceType, string $serviceKey, array $info)
Definition: ExtensionManagementUtility.php:648
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\loadExtensionThrowsExceptionIfExtensionIsLoaded
‪loadExtensionThrowsExceptionIfExtensionIsLoaded()
Definition: ExtensionManagementUtilityTest.php:1189
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addTcaSelectItemInsertsItemAtSpecifiedPosition
‪addTcaSelectItemInsertsItemAtSpecifiedPosition(string $relativeToField, string $relativePosition, array $expectedResultArray)
Definition: ExtensionManagementUtilityTest.php:1114
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldDoesNotAddAnythingIfFieldIsNotRegisteredInColumns
‪addFieldsToAllPalettesOfFieldDoesNotAddAnythingIfFieldIsNotRegisteredInColumns()
Definition: ExtensionManagementUtilityTest.php:472
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToTCATypeBeforeExistingOnes
‪canAddFieldsToTCATypeBeforeExistingOnes()
Definition: ExtensionManagementUtilityTest.php:286
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsFieldsToMultiplePalettes
‪addFieldsToAllPalettesOfFieldAddsFieldsToMultiplePalettes()
Definition: ExtensionManagementUtilityTest.php:594
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsFieldsToPaletteAndSuppressesDuplicates
‪addFieldsToAllPalettesOfFieldAddsFieldsToPaletteAndSuppressesDuplicates()
Definition: ExtensionManagementUtilityTest.php:500
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\getClassNamePrefixForExtensionKey
‪getClassNamePrefixForExtensionKey(string $extensionName, string $expectedPrefix)
Definition: ExtensionManagementUtilityTest.php:207
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\getExtensionVersion
‪static string getExtensionVersion(string $key)
Definition: ExtensionManagementUtility.php:113
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addToAllTCAtypes
‪static addToAllTCAtypes(string $table, string $newFieldsString, string $typeList='', string $position='')
Definition: ExtensionManagementUtility.php:166
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addToAllTCAtypesReplacesExistingOnes
‪addToAllTCAtypesReplacesExistingOnes()
Definition: ExtensionManagementUtilityTest.php:350
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToPaletteAfterExistingOnes
‪canAddFieldsToPaletteAfterExistingOnes()
Definition: ExtensionManagementUtilityTest.php:412
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\removeDuplicatesForInsertionRemovesDuplicates
‪removeDuplicatesForInsertionRemovesDuplicates(string $insertionList, string $list, string $expected)
Definition: ExtensionManagementUtilityTest.php:459
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToPaletteAfterNotExistingOnes
‪canAddFieldsToPaletteAfterNotExistingOnes()
Definition: ExtensionManagementUtilityTest.php:426
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldWithPartOfAlreadyExistingFieldname
‪canAddFieldWithPartOfAlreadyExistingFieldname()
Definition: ExtensionManagementUtilityTest.php:317
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static getPublicPath()
Definition: Environment.php:187
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\removeDuplicatesForInsertionRemovesDuplicatesDataProvider
‪static removeDuplicatesForInsertionRemovesDuplicatesDataProvider()
Definition: ExtensionManagementUtilityTest.php:434
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\unloadExtensionCallsPackageManagerToDeactivatePackage
‪unloadExtensionCallsPackageManagerToDeactivatePackage()
Definition: ExtensionManagementUtilityTest.php:1227
‪TYPO3\CMS\Core\Tests\Unit\Utility
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\$resetSingletonInstances
‪bool $resetSingletonInstances
Definition: ExtensionManagementUtilityTest.php:34
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addTcaSelectItemGroup
‪static addTcaSelectItemGroup(string $table, string $field, string $groupId, string $groupLabel, ?string $position='bottom')
Definition: ExtensionManagementUtility.php:438
‪TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy\removeDuplicatesForInsertion
‪static removeDuplicatesForInsertion($insertionList, $list='')
Definition: ExtensionManagementUtilityAccessibleProxy.php:33
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\generateTCAForTable
‪array generateTCAForTable(string $table)
Definition: ExtensionManagementUtilityTest.php:156
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\$backUpPackageManager
‪PackageManager $backUpPackageManager
Definition: ExtensionManagementUtilityTest.php:35
‪TYPO3\CMS\Core\Utility\GeneralUtility\mkdir_deep
‪static mkdir_deep(string $directory)
Definition: GeneralUtility.php:1649
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\tearDown
‪tearDown()
Definition: ExtensionManagementUtilityTest.php:43
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static getVarPath()
Definition: Environment.php:197
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToAllTCATypesAfterExistingOnes
‪canAddFieldsToAllTCATypesAfterExistingOnes()
Definition: ExtensionManagementUtilityTest.php:238
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded
‪static isLoaded(string $key)
Definition: ExtensionManagementUtility.php:55
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToTCATypeAfterExistingOnes
‪canAddFieldsToTCATypeAfterExistingOnes()
Definition: ExtensionManagementUtilityTest.php:303
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addPluginSetsTcaCorrectlyForGivenExtKeyAsParameter
‪addPluginSetsTcaCorrectlyForGivenExtKeyAsParameter()
Definition: ExtensionManagementUtilityTest.php:1251
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility
Definition: ExtensionManagementUtility.php:32
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\unloadExtensionThrowsExceptionIfExtensionIsNotLoaded
‪unloadExtensionThrowsExceptionIfExtensionIsNotLoaded()
Definition: ExtensionManagementUtilityTest.php:1206
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\isLoadedReturnsFalseIfExtensionIsNotLoaded
‪isLoadedReturnsFalseIfExtensionIsNotLoaded()
Definition: ExtensionManagementUtilityTest.php:90
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addFieldsToAllPalettesOfField
‪static addFieldsToAllPalettesOfField(string $table, string $field, string $addFields, string $insertionPosition='')
Definition: ExtensionManagementUtility.php:294
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToAllTCATypesRespectsPalettes
‪canAddFieldsToAllTCATypesRespectsPalettes()
Definition: ExtensionManagementUtilityTest.php:255
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addFieldsToPalette
‪static addFieldsToPalette(string $table, string $palette, string $addFields, string $insertionPosition='')
Definition: ExtensionManagementUtility.php:347
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\loadExtension
‪static loadExtension(string $extensionKey)
Definition: ExtensionManagementUtility.php:1141
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToTCATypeAndReplaceExistingOnes
‪canAddFieldsToTCATypeAndReplaceExistingOnes()
Definition: ExtensionManagementUtilityTest.php:332
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath
‪static extPath(string $key, string $script='')
Definition: ExtensionManagementUtility.php:82
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addServiceDoesNotFailIfValueIsNotSet
‪addServiceDoesNotFailIfValueIsNotSet()
Definition: ExtensionManagementUtilityTest.php:1463
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addToAllTCAtypesAddsToPaletteIdentifier
‪addToAllTCAtypesAddsToPaletteIdentifier()
Definition: ExtensionManagementUtilityTest.php:368
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\setPackageManager
‪static setPackageManager(PackageManager $packageManager)
Definition: ExtensionManagementUtility.php:41
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsFieldsAtEndIfAfterRequestedDoesNotExist
‪addFieldsToAllPalettesOfFieldAddsFieldsAtEndIfAfterRequestedDoesNotExist()
Definition: ExtensionManagementUtilityTest.php:844
‪TYPO3\CMS\Core\Schema\Struct\SelectItem
Definition: SelectItem.php:21
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addTcaSelectItemGroupAddsGroupDataProvider
‪static addTcaSelectItemGroupAddsGroupDataProvider()
Definition: ExtensionManagementUtilityTest.php:1350
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\getExtensionVersionForNotLoadedExtensionReturnsEmptyString
‪getExtensionVersionForNotLoadedExtensionReturnsEmptyString()
Definition: ExtensionManagementUtilityTest.php:1154
‪TYPO3\CMS\Core\Package\Package
Definition: Package.php:30
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addTcaSelectItemThrowsExceptionIfRelativePositionIsNotOneOfValidKeywords
‪addTcaSelectItemThrowsExceptionIfRelativePositionIsNotOneOfValidKeywords()
Definition: ExtensionManagementUtilityTest.php:1028
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsNewPaletteIfFieldHasNoPaletteYetAndKeepsExistingLabel
‪addFieldsToAllPalettesOfFieldAddsNewPaletteIfFieldHasNoPaletteYetAndKeepsExistingLabel()
Definition: ExtensionManagementUtilityTest.php:934
‪TYPO3\CMS\Core\Package\MetaData
Definition: PackageConstraint.php:16
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\executePositionedStringInsertionTrimsCorrectCharactersDataProvider
‪static executePositionedStringInsertionTrimsCorrectCharactersDataProvider()
Definition: ExtensionManagementUtilityTest.php:980
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldDoesNotAddAFieldThatIsPartOfPaletteAlready
‪addFieldsToAllPalettesOfFieldDoesNotAddAFieldThatIsPartOfPaletteAlready()
Definition: ExtensionManagementUtilityTest.php:547
‪TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy\getPackageManager
‪static getPackageManager()
Definition: ExtensionManagementUtilityAccessibleProxy.php:28
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addPluginAsContentTypeAddsIconAndDefaultItem
‪addPluginAsContentTypeAddsIconAndDefaultItem()
Definition: ExtensionManagementUtilityTest.php:1305
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsAfterExistingIfRequested
‪addFieldsToAllPalettesOfFieldAddsAfterExistingIfRequested()
Definition: ExtensionManagementUtilityTest.php:796
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addPluginAsContentTypeAddsIconAndDefaultItemWithSelectItem
‪addPluginAsContentTypeAddsIconAndDefaultItemWithSelectItem()
Definition: ExtensionManagementUtilityTest.php:1329
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addPlugin
‪static addPlugin(array|SelectItem $itemArray, string $type='list_type', ?string $extensionKey=null)
Definition: ExtensionManagementUtility.php:814
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addPluginSetsCorrectItemGroupsEntry
‪addPluginSetsCorrectItemGroupsEntry()
Definition: ExtensionManagementUtilityTest.php:1271
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addTcaSelectItemThrowsExceptionIfFieldIsNotFoundInTca
‪addTcaSelectItemThrowsExceptionIfFieldIsNotFoundInTca()
Definition: ExtensionManagementUtilityTest.php:1039
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\executePositionedStringInsertionTrimsCorrectCharacters
‪executePositionedStringInsertionTrimsCorrectCharacters(string $string, string $expectedResult)
Definition: ExtensionManagementUtilityTest.php:1014
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\getExtensionVersionForLoadedExtensionReturnsExtensionVersion
‪getExtensionVersionForLoadedExtensionReturnsExtensionVersion()
Definition: ExtensionManagementUtilityTest.php:1164
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addTcaSelectItem
‪static addTcaSelectItem(string $table, string $field, array $item, string $relativeToField='', string $relativePosition='')
Definition: ExtensionManagementUtility.php:391
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsFieldsAtEndIfBeforeRequestedDoesNotExist
‪addFieldsToAllPalettesOfFieldAddsFieldsAtEndIfBeforeRequestedDoesNotExist()
Definition: ExtensionManagementUtilityTest.php:748
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\createMockPackageManagerWithMockPackage
‪createMockPackageManagerWithMockPackage(string $packageKey, array $packageMethods=['getPackagePath', 'getPackageKey'])
Definition: ExtensionManagementUtilityTest.php:49
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsMultipleFields
‪addFieldsToAllPalettesOfFieldAddsMultipleFields()
Definition: ExtensionManagementUtilityTest.php:653
‪$tca
‪$tca
Definition: sys_file_metadata.php:5
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\unloadExtension
‪static unloadExtension(string $extensionKey)
Definition: ExtensionManagementUtility.php:1154
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\getExtensionVersionForEmptyExtensionKeyThrowsException
‪getExtensionVersionForEmptyExtensionKeyThrowsException()
Definition: ExtensionManagementUtilityTest.php:1143
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addTcaSelectItemGroupAddsGroup
‪addTcaSelectItemGroupAddsGroup(string $groupId, string $groupLabel, ?string $position, ?array $existingGroups, array $expectedGroups)
Definition: ExtensionManagementUtilityTest.php:1450
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsNewPaletteIfFieldHasNoPaletteYet
‪addFieldsToAllPalettesOfFieldAddsNewPaletteIfFieldHasNoPaletteYet()
Definition: ExtensionManagementUtilityTest.php:892
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest
Definition: ExtensionManagementUtilityTest.php:33
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\extPathAppendsScriptNameToPath
‪extPathAppendsScriptNameToPath()
Definition: ExtensionManagementUtilityTest.php:122
‪TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy
Definition: ExtensionManagementUtilityAccessibleProxy.php:27
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToAllTCATypesRespectsPositionFieldInPalette
‪canAddFieldsToAllTCATypesRespectsPositionFieldInPalette()
Definition: ExtensionManagementUtilityTest.php:271
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToAllTCATypesBeforeExistingOnes
‪canAddFieldsToAllTCATypesBeforeExistingOnes()
Definition: ExtensionManagementUtilityTest.php:221
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addFieldsToAllPalettesOfFieldAddsBeforeExistingIfRequested
‪addFieldsToAllPalettesOfFieldAddsBeforeExistingIfRequested()
Definition: ExtensionManagementUtilityTest.php:700
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\canAddFieldsToPaletteBeforeExistingOnes
‪canAddFieldsToPaletteBeforeExistingOnes()
Definition: ExtensionManagementUtilityTest.php:398
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\extPathThrowsExceptionIfExtensionIsNotLoaded
‪extPathThrowsExceptionIfExtensionIsNotLoaded()
Definition: ExtensionManagementUtilityTest.php:101
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\setUp
‪setUp()
Definition: ExtensionManagementUtilityTest.php:37
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\extensionKeyDataProvider
‪static extensionKeyDataProvider()
Definition: ExtensionManagementUtilityTest.php:181
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:57
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addToAllTCAtypesAddsBeforeDiv
‪addToAllTCAtypesAddsBeforeDiv()
Definition: ExtensionManagementUtilityTest.php:380
‪TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\addTcaSelectItemDataProvider
‪static addTcaSelectItemDataProvider()
Definition: ExtensionManagementUtilityTest.php:1051
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\getCN
‪static getCN(string $key)
Definition: ExtensionManagementUtility.php:96