-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use typo3 core YamlFileLoader #54
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,15 +17,35 @@ | |
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use PHPUnit\Framework\TestCase; | ||
use TYPO3\CMS\Core\Configuration\ConfigurationManager; | ||
use TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader; | ||
use TYPO3\CMS\Core\Core\ApplicationContext; | ||
use TYPO3\CMS\Core\Core\Environment; | ||
use TYPO3\CMS\Core\Log\Logger; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
#[CoversClass(ConfigurationFinder::class)] | ||
#[RunTestsInSeparateProcesses] | ||
final class ConfigurationFinderTest extends TestCase | ||
{ | ||
private static string $configPath; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$configurationManager = new ConfigurationManager(); | ||
$GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration(); | ||
|
||
GeneralUtility::addInstance( | ||
YamlFileLoader::class, | ||
GeneralUtility::makeInstance( | ||
YamlFileLoader::class, | ||
$this->createMock(Logger::class), | ||
), | ||
); | ||
Comment on lines
+40
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brotkrueml This may could be done more elegant.. |
||
} | ||
|
||
public static function setUpBeforeClass(): void | ||
{ | ||
Environment::initialize( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I shy away from using GeneralUtility::makeInstance() at this point: when the ConfigurationFinder is utilized, there is no dependency injection container available. This might work now (haven't tested it), but won't bet on it for future TYPO3 versions. Better would be to instantiate manually:
But: as TYPO3 uses here dependency injection already for the logger, this might cause problems in future versions, when other dependencies might be injected. Then this may result in removing this feature and using the plain Symfony YamlFileLoader again.
Another possibility will be to copy the import functionality over to this extension (or the whole class without the logging).
What do you think? @tbal