Commit e3ad2bd0 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Daniel Goerz
Browse files

[TASK] Move iconFactory initialization out of loop

Resolves: #91459
Relates: #91302
Releases: master
Change-Id: Ic4af3247d7557a6c12a8d538e85795c507eab69a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64561


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
parent 4bb09190
......@@ -520,6 +520,7 @@ abstract class AbstractItemProvider
}
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
while ($foreignRow = $queryResult->fetch()) {
BackendUtility::workspaceOL($foreignTable, $foreignRow);
......@@ -546,7 +547,6 @@ abstract class AbstractItemProvider
}
} else {
// Else, determine icon based on record type, or a generic fallback
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon = $iconFactory->mapRecordTypeToIconIdentifier($foreignTable, $foreignRow);
}
// Add the item
......
......@@ -121,6 +121,7 @@ class TcaSelectTreeItemsTest extends UnitTestCase
$iconFactoryProphecy = $this->prophesize(IconFactory::class);
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
$fileRepositoryProphecy = $this->prophesize(FileRepository::class);
$fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled();
......@@ -191,6 +192,7 @@ class TcaSelectTreeItemsTest extends UnitTestCase
$iconFactoryProphecy = $this->prophesize(IconFactory::class);
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
$fileRepositoryProphecy = $this->prophesize(FileRepository::class);
$fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment