[TASK] EM: Refactor Configuration handling 59/17759/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 26 Jan 2013 16:29:33 +0000 (17:29 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 28 Jan 2013 12:45:07 +0000 (13:45 +0100)
commit1bb99075ea31d8a731f3e0ad764ffa06c2813dac
tree9db42ee40268983e3c15dd50564e0332e4042bbb
parent4380d352ae16cb698bc0ec22502aa02bdbf83d88
[TASK] EM: Refactor Configuration handling

Classes ConfigurationUtility and ConfigurationItemRepository handle
the extension managers extension configuration settings.

Configuration sources are ext_conf_template.txt files,
LocalConfiguration.php and the extension manager configuration
forms. They all have different formats and structures, thus
the code to merge all that is not exactly easy.

This patch shifts some code around in order to make the current
handling better understandable for easier debugging. The API is
still not as simple as it should be, but for now some
code smell is solved:

* Use @inject annotation for dependency injection to reduce
  number of code lines.
* Remove dependency injected objects if possible and rely on
  injection of objectManager only if the object is not widely
  used in the class.
* Disentangle a method call chain from InstallUtility to
  ConfigurationUtility back to InstallUtility by removing method
  writeExtensionTypoScriptStyleConfigurationToLocalconf() from
  InstallUtility and merging functionality with
  ConfigurationUtility->writeConfiguration().
* Remove public method createArrayFromConstants() from
  ConfigurationItemRepository and move to ConfigurationUtility
  under new name
  getDefaultConfigurationFromExtConfTemplateAsFlatItemArray().
* Rename ConfigurationItemRepository->findByExtension() to
  findByExtensionKey() and always let it return an
  ObjectStorage, even if empty.
* Simplify several method signatures, mostly of protected methods
  to one parameter only, moving only the extension key around.
* Better encapsulating of low level code in protected methods
  instead of duplicated low level code in in entry methods
  or controller logic.
* Resolve code smell in unit tests with better mocking and
  structured tests.

Change-Id: I441280a3907e2487cd7fe7ba1856e9ef04c72a42
Resolves: #44818
Releases: 6.1, 6.0
Reviewed-on: https://review.typo3.org/17759
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/Controller/ConfigurationController.php
typo3/sysext/extensionmanager/Classes/Domain/Repository/ConfigurationItemRepository.php
typo3/sysext/extensionmanager/Classes/Utility/ConfigurationUtility.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Repository/ConfigurationItemRepositoryTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ConfigurationUtilityTest.php