[BUGFIX] Warnings in extensionmanager
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 9 Sep 2012 14:26:33 +0000 (16:26 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 9 Sep 2012 14:38:36 +0000 (16:38 +0200)
The patch fixes some rather obvious problems in EXT:extensionmanager
to stabilize the tests. Furthermore the extension dependency
calculation did not work due to missing TCA definition.

Change-Id: I8364f603c5d3c104554838e303f156114f047c16
Resolves: #40771
Releases: 6.0
Reviewed-on: http://review.typo3.org/14476
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php
typo3/sysext/extensionmanager/Configuration/TCA/Extension.php
typo3/sysext/extensionmanager/Tests/Unit/Service/ExtensionManagementServiceTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php

index befa604..6a649b7 100644 (file)
@@ -179,9 +179,12 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function installDependencies(array $installQueue) {
                $resolvedDependencies = array();
-               foreach ($installQueue as $extensionToInstall) {
-                       $this->installUtility->install($extensionToInstall);
-                       $resolvedDependencies['installed'][$extensionToInstall] = $extensionToInstall;
+               foreach ($installQueue as $extensionKey => $extensionDetails) {
+                       $this->installUtility->install($extensionDetails);
+                       if (!is_array($resolvedDependencies['installed'])) {
+                               $resolvedDependencies['installed'] = array();
+                       }
+                       $resolvedDependencies['installed'][$extensionKey] = $extensionDetails;
                }
                return $resolvedDependencies;
        }
index 2cf4e86..0716c29 100644 (file)
@@ -5,7 +5,7 @@ if (!defined('TYPO3_MODE')) {
 $TCA['tx_extensionmanager_domain_model_extension'] = array(
        'ctrl' => $TCA['tx_extensionmanager_domain_model_extension']['ctrl'],
        'interface' => array(
-               'showRecordFieldList' => 'extension_key,version,integer_version,title,description,state,category,last_updated,update_comment,author_name,author_email,md5hash'
+               'showRecordFieldList' => 'extension_key,version,integer_version,title,description,state,category,last_updated,update_comment,author_name,author_email,md5hash,serialized_dependencies'
        ),
        'columns' => array(
                'extension_key' => array(
@@ -127,9 +127,17 @@ $TCA['tx_extensionmanager_domain_model_extension'] = array(
                                'size' => '1',
                        ),
                ),
+               'serialized_dependencies' => array(
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:extensionmanager/Resources/Private/locallang_db.xml:tx_extensionmanager_domain_model_extension.serializedDependencies',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '30',
+                       ),
+               ),
        ),
        'types' => array(
-               '0' => array('showitem' => 'extensionkey;;;;1-1-1, version, integer_version, title;;;;2-2-2, description;;;;3-3-3, state, category, last_updated, update_comment, author_name, author_email, review_state, md5hash')
+               '0' => array('showitem' => 'extensionkey;;;;1-1-1, version, integer_version, title;;;;2-2-2, description;;;;3-3-3, state, category, last_updated, update_comment, author_name, author_email, review_state, md5hash, serialized_dependencies')
        ),
        'palettes' => array(
                '1' => array('showitem' => '')
index 5dc60dd..ff5f101 100644 (file)
@@ -25,6 +25,8 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Service;
  ***************************************************************/
 
 /**
+ * Testcase
+ *
  * @package Extension Manager
  * @subpackage Tests
  */
@@ -35,10 +37,10 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
         * @return void
         */
        public function resolveDependenciesCallsDownloadDependenciesIfDownloadKeyExistsInQueue() {
-               $managementMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService', array(
-                       'downloadDependencies',
-                       'updateDependencies'
-               ));
+               $managementMock = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService',
+                       array('downloadDependencies', 'uninstallDependenciesToBeUpdated')
+               );
                $extensionModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Extension');
                $extensionModelMock->_set('extensionKey', 'foobar');
                $extensionModelMock->_set('version', '1.0.0');
@@ -52,7 +54,7 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                        )
                )));
                $managementMock->_set('downloadQueue', $downloadQueueMock);
-               $managementMock->expects($this->once())->method('downloadDependencies')->with(array('foo' => $extensionModelMock));
+               $managementMock->expects($this->once())->method('downloadDependencies')->with(array('foo' => $extensionModelMock))->will($this->returnValue(array()));
                $managementMock->_call('resolveDependenciesAndInstall', $extensionModelMock);
        }
 
@@ -61,10 +63,10 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
         * @return void
         */
        public function resolveDependenciesCallsUpdateAndDownloadDependenciesIfUpdateKeyExistsInQueue() {
-               $managementMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService', array(
-                       'downloadDependencies',
-                       'uninstallDependenciesToBeUpdated'
-               ));
+               $managementMock = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService',
+                       array('downloadDependencies', 'uninstallDependenciesToBeUpdated')
+               );
                $extensionModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Extension');
                $extensionModelMock->_set('extensionKey', 'foobar');
                $extensionModelMock->_set('version', '1.0.0');
@@ -78,8 +80,8 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                        )
                )));
                $managementMock->_set('downloadQueue', $downloadQueueMock);
-               $managementMock->expects($this->once())->method('downloadDependencies')->with(array('foo' => $extensionModelMock));
-               $managementMock->expects($this->once())->method('uninstallDependenciesToBeUpdated')->with(array('foo' => $extensionModelMock));
+               $managementMock->expects($this->once())->method('downloadDependencies')->with(array('foo' => $extensionModelMock))->will($this->returnValue(array()));
+               $managementMock->expects($this->once())->method('uninstallDependenciesToBeUpdated')->with(array('foo' => $extensionModelMock))->will($this->returnValue(array()));
                $managementMock->_call('resolveDependenciesAndInstall', $extensionModelMock);
        }
 
@@ -197,9 +199,10 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
         * @return void
         */
        public function installDependenciesCallsInstall() {
-               $managementMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService', array(
-                       'dummy'
-               ));
+               $managementMock = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService',
+                       array('dummy')
+               );
                $installQueue = array(
                        'foobar' => array(
                                'key' => 'foobar',
index 6c94f44..7d2cf3c 100644 (file)
@@ -25,12 +25,17 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  ***************************************************************/
 
 /**
+ * Testcase
+ *
  * @package Extension Manager
  * @subpackage Tests
  */
 class FileHandlingUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
-       public $fakedExtensions;
+       /**
+        * @var array List of created fake extensions to be deleted in tearDown() again
+        */
+       protected $fakedExtensions = array();
 
        /**
         * @return void
index 4ef6aca..6f9030f 100644 (file)
@@ -25,6 +25,8 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  ***************************************************************/
 
 /**
+ * Testcase
+ *
  * @package Extension Manager
  * @subpackage Tests
  */
@@ -36,7 +38,10 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        public $extension;
 
-       public $fakedExtensions;
+       /**
+        * @var array List of created fake extensions to be deleted in tearDown() again
+        */
+       protected $fakedExtensions = array();
 
        /**
         * @var \TYPO3\CMS\Extensionmanager\Utility\InstallUtility