[TASK] Cleanup for Package Management 40/40240/10
authorBenjamin Mack <benni@typo3.org>
Wed, 17 Jun 2015 14:49:45 +0000 (16:49 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 8 Jul 2015 17:43:29 +0000 (19:43 +0200)
Removing the last bits for the Package Management area which are not in use.

Releases: master
Resolves: #67564
Change-Id: Ib23e3de5c02393701fb92b53b704f7d0f4748ad5
Reviewed-on: http://review.typo3.org/40240
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php
typo3/sysext/core/Classes/Package/Exception/CorruptPackageException.php [deleted file]
typo3/sysext/core/Classes/Package/FailsafePackageManager.php
typo3/sysext/core/Classes/Package/Package.php
typo3/sysext/core/Classes/Package/PackageInterface.php
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php
typo3/sysext/core/Tests/Unit/Package/PackageTest.php
typo3/sysext/extensionmanager/Classes/Utility/ListUtility.php

index 903dd73..14b03d3 100644 (file)
@@ -16,7 +16,7 @@ namespace TYPO3\CMS\Core\Core;
 
 use Composer\Autoload\ClassMapGenerator;
 use TYPO3\CMS\Core\Package\Exception\MissingPackageManifestException;
-use TYPO3\CMS\Core\Package\Package;
+use TYPO3\CMS\Core\Package\PackageInterface;
 use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
@@ -28,18 +28,18 @@ use TYPO3\CMS\Core\Utility\PathUtility;
 class ClassLoadingInformationGenerator {
 
        /**
-        * @var Package[]
+        * @var PackageInterface[]
         */
        static protected $activeExtensionPackages;
 
        /**
         * Returns class loading information for a single package
         *
-        * @param Package $package The package to generate the class loading info for
+        * @param PackageInterface $package The package to generate the class loading info for
         * @param bool $useRelativePaths If set to TRUE, make the path relative to the current TYPO3 instance (PATH_site)
         * @return array
         */
-       static public function buildClassLoadingInformationForPackage(Package $package, $useRelativePaths = FALSE) {
+       static public function buildClassLoadingInformationForPackage(PackageInterface $package, $useRelativePaths = FALSE) {
                $classMap = array();
                $psr4 = array();
                $packagePath = $package->getPackagePath();
@@ -77,11 +77,11 @@ class ClassLoadingInformationGenerator {
        /**
         * Returns class alias map for given package
         *
-        * @param Package $package The package to generate the class alias info for
+        * @param PackageInterface $package The package to generate the class alias info for
         * @throws \TYPO3\CMS\Core\Error\Exception
         * @return array
         */
-       static public function buildClassAliasMapForPackage(Package $package) {
+       static public function buildClassAliasMapForPackage(PackageInterface $package) {
                $aliasToClassNameMapping = array();
                $classNameToAliasMapping = array();
                $possibleClassAliasFile = $package->getPackagePath() . 'Migrations/Code/ClassAliasMap.php';
@@ -196,7 +196,7 @@ EOF;
        /**
         * Get all packages except the protected ones, as they are covered already
         *
-        * @return Package[]
+        * @return PackageInterface[]
         */
        static protected function getActiveExtensionPackages() {
                if (self::$activeExtensionPackages === NULL) {
@@ -216,10 +216,10 @@ EOF;
        /**
         * Check if the package is a framework package (located in typo3/sysext)
         *
-        * @param Package $package
+        * @param PackageInterface $package
         * @return bool
         */
-       static protected function isFrameworkPackage(Package $package) {
+       static protected function isFrameworkPackage(PackageInterface $package) {
                return $package->getValueFromComposerManifest('type') === 'typo3-cms-framework';
        }
 
diff --git a/typo3/sysext/core/Classes/Package/Exception/CorruptPackageException.php b/typo3/sysext/core/Classes/Package/Exception/CorruptPackageException.php
deleted file mode 100644 (file)
index f93ed14..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Package\Exception;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * "Corrupt Package" Exception
- * Adapted from FLOW for TYPO3 CMS
- */
-class CorruptPackageException extends \TYPO3\CMS\Core\Package\Exception {
-
-}
index 6b3efef..af97783 100644 (file)
@@ -59,7 +59,6 @@ class FailsafePackageManager extends PackageManager {
         * Requires and registers all packages which were defined in packageStatesConfiguration
         *
         * @return void
-        * @throws \TYPO3\CMS\Core\Package\Exception\CorruptPackageException
         */
        protected function registerPackagesFromConfiguration() {
                $this->packageStatesConfiguration['packages']['install']['state'] = 'active';
@@ -85,4 +84,5 @@ class FailsafePackageManager extends PackageManager {
        public function forceSortAndSavePackageStates() {
                parent::sortAndSavePackageStates();
        }
+
 }
index 45da4ab..ca0ff59 100644 (file)
@@ -76,12 +76,6 @@ class Package implements PackageInterface {
        protected $packageMetaData;
 
        /**
-        * The namespace of the classes contained in this package
-        * @var string
-        */
-       protected $namespace;
-
-       /**
         * @var PackageManager
         */
        protected $packageManager;
@@ -110,7 +104,7 @@ class Package implements PackageInterface {
                $this->packageKey = $packageKey;
                $this->packagePath = $packagePath;
                try {
-                       $this->composerManifest = $this->packageManager->getComposerManifest($this->packagePath);
+                       $this->composerManifest = $packageManager->getComposerManifest($this->packagePath);
                } catch (Exception\MissingPackageManifestException $exception) {
                        if (!$this->loadExtensionEmconf()) {
                                throw new Exception\InvalidPackageManifestException('No valid ext_emconf.php file found for package "' . $packageKey . '".', 1360403545);
@@ -151,15 +145,6 @@ class Package implements PackageInterface {
        }
 
        /**
-        * Invokes custom PHP code directly after the package manager has been initialized.
-        *
-        * @param \TYPO3\CMS\Core\Core\Bootstrap $bootstrap The current bootstrap
-        * @return void
-        */
-       public function boot(\TYPO3\CMS\Core\Core\Bootstrap $bootstrap) {
-       }
-
-       /**
         * Returns the package key of this package.
         *
         * @return string
@@ -201,37 +186,9 @@ class Package implements PackageInterface {
        }
 
        /**
-        * Returns the full path to this package's Classes directory
-        *
-        * @return string Path to this package's Classes directory
-        * @api
-        */
-       public function getClassesPath() {
-               return $this->packagePath . self::DIRECTORY_CLASSES;
-       }
-
-       /**
-        * Returns the full path to this package's Resources directory
+        * Fetches MetaData information from ext_emconf.php, used for
+        * resolving dependencies as well.
         *
-        * @return string Path to this package's Resources directory
-        * @api
-        */
-       public function getResourcesPath() {
-               return $this->packagePath . self::DIRECTORY_RESOURCES;
-       }
-
-       /**
-        * Returns the full path to this package's Configuration directory
-        *
-        * @return string Path to this package's Configuration directory
-        * @api
-        */
-       public function getConfigurationPath() {
-               return $this->packagePath . self::DIRECTORY_CONFIGURATION;
-       }
-
-       /**
-        * Fetches MetaData information from ext_emconf.php, used for resolving dependencies as well
         * @return bool
         */
        protected function loadExtensionEmconf() {
@@ -344,57 +301,6 @@ class Package implements PackageInterface {
        }
 
        /**
-        * Returns the PHP namespace of classes in this package, also uses a fallback for extensions without having a "."
-        * in the package key.
-        *
-        * @return string
-        */
-       public function getNamespace() {
-               if (!$this->namespace) {
-                       $packageKey = $this->getPackageKey();
-                       if (strpos($packageKey, '.') === FALSE) {
-                               // Old school with unknown vendor name
-                               $this->namespace =  '*\\' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageKey);
-                       } else {
-                               $this->namespace = str_replace('.', '\\', $packageKey);
-                       }
-               }
-               return $this->namespace;
-       }
-
-       /**
-        * @return array
-        */
-       public function getClassFilesFromAutoloadRegistry() {
-               $autoloadRegistryPath = $this->packagePath . 'ext_autoload.php';
-               if (@file_exists($autoloadRegistryPath)) {
-                       return require $autoloadRegistryPath;
-               }
-               return array();
-       }
-
-       /**
-        * Fetches class aliases registered via Migrations/Code/ClassAliasMap.php
-        *
-        * @return array
-        */
-       public function getClassAliases() {
-               if (!is_array($this->classAliases)) {
-                       try {
-                               $extensionClassAliasMapPathAndFilename = $this->packagePath . 'Migrations/Code/ClassAliasMap.php';
-                               if (@file_exists($extensionClassAliasMapPathAndFilename)) {
-                                       $this->classAliases = require $extensionClassAliasMapPathAndFilename;
-                               }
-                       } catch (\BadFunctionCallException $e) {
-                       }
-                       if (!is_array($this->classAliases)) {
-                               $this->classAliases = array();
-                       }
-               }
-               return $this->classAliases;
-       }
-
-       /**
         * Check whether the given package requirement (like "typo3/flow" or "php") is a composer package or not
         *
         * @param string $requirement the composer requirement string
index b9e4229..3cebaaf 100644 (file)
@@ -24,21 +24,12 @@ interface PackageInterface {
 
        const PATTERN_MATCH_EXTENSIONKEY = '/^[0-9a-z_-]+$/i';
 
-       const DIRECTORY_CLASSES = 'Classes/';
-       const DIRECTORY_CONFIGURATION = 'Configuration/';
-       const DIRECTORY_RESOURCES = 'Resources/';
-
        /**
         * @return array
         */
        public function getPackageReplacementKeys();
 
        /**
-        * @return array
-        */
-       public function getClassFilesFromAutoloadRegistry();
-
-       /**
         * Tells if the package is part of the default factory configuration
         * and therefor activated at first installation.
         *
@@ -56,12 +47,13 @@ interface PackageInterface {
        public function isPartOfMinimalUsableSystem();
 
        /**
-        * Invokes custom PHP code directly after the package manager has been initialized.
+        * Returns contents of Composer manifest - or part there of if a key is given.
         *
-        * @param \TYPO3\CMS\Core\Core\Bootstrap $bootstrap The current bootstrap
-        * @return void
+        * @param string $key Optional. Only return the part of the manifest indexed by 'key'
+        * @return mixed|NULL
+        * @see json_decode for return values
         */
-       public function boot(\TYPO3\CMS\Core\Core\Bootstrap $bootstrap);
+       public function getValueFromComposerManifest($key = NULL);
 
        /**
         * Returns the package meta object of this package.
@@ -79,14 +71,6 @@ interface PackageInterface {
        public function getPackageKey();
 
        /**
-        * Returns the PHP namespace of classes in this package.
-        *
-        * @return string
-        * @api
-        */
-       public function getNamespace();
-
-       /**
         * Tells if this package is protected and therefore cannot be deactivated or deleted
         *
         * @return bool
@@ -110,28 +94,4 @@ interface PackageInterface {
         * @api
         */
        public function getPackagePath();
-
-       /**
-        * Returns the full path to this package's Classes directory
-        *
-        * @return string Path to this package's Classes directory
-        * @api
-        */
-       public function getClassesPath();
-
-       /**
-        * Returns the full path to this package's Resources directory
-        *
-        * @return string Path to this package's Resources directory
-        * @api
-        */
-       public function getResourcesPath();
-
-       /**
-        * Returns the full path to this package's Configuration directory
-        *
-        * @return string Path to this package's Configuration directory
-        * @api
-        */
-       public function getConfigurationPath();
 }
index 437acba..6e125bf 100644 (file)
@@ -49,11 +49,6 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * @var array
         */
-       protected $extAutoloadClassFiles;
-
-       /**
-        * @var array
-        */
        protected $packagesBasePaths = array();
 
        /**
@@ -79,7 +74,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
 
        /**
         * Array of available packages, indexed by package key
-        * @var array
+        * @var PackageInterface[]
         */
        protected $packages = array();
 
@@ -122,7 +117,6 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
                        'local'     => PATH_typo3conf . 'ext',
                        'global'    => PATH_typo3 . 'ext',
                        'sysext'    => PATH_typo3 . 'sysext',
-                       'composer'  => PATH_site . 'Packages',
                );
                $this->packageStatesPathAndFilename = PATH_typo3conf . 'PackageStates.php';
        }
@@ -160,11 +154,6 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
                        $this->initializeCompatibilityLoadedExtArray();
                }
 
-               foreach ($this->activePackages as $package) {
-                       /** @var $package Package */
-                       $package->boot($bootstrap);
-               }
-
                if (!$loadedFromCache) {
                        $this->saveToPackageCache();
                }
@@ -211,7 +200,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
                                'loadedExtArray' => $GLOBALS['TYPO3_LOADED_EXT'],
                                'packageObjectsCacheEntryIdentifier' => $packageObjectsCacheEntryIdentifier
                        );
-                       // add the reflection of the package class
+                       // Add the reflection of the package class
                        $packageClassName = strtolower(Package::class);
                        $reflectionPackageClass = new \ReflectionClass($packageClassName);
                        $packageClassSource = file_get_contents($reflectionPackageClass->getFileName());
@@ -280,19 +269,18 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
        protected function initializePackageObjects() {
                $requiredPackages = array();
                foreach ($this->packages as $packageKey => $package) {
-                       $protected = $package->isProtected();
-                       if ($protected) {
+                       if ($package->isProtected()) {
                                $requiredPackages[$packageKey] = $package;
                        }
                        if (isset($this->packageStatesConfiguration['packages'][$packageKey]['state']) && $this->packageStatesConfiguration['packages'][$packageKey]['state'] === 'active') {
                                $this->activePackages[$packageKey] = $package;
                        }
                }
-               $previousActivePackage = $this->activePackages;
+               $previousActivePackages = $this->activePackages;
                $this->activePackages = array_merge($requiredPackages, $this->activePackages);
                $this->requiredPackageKeys = array_keys($requiredPackages);
 
-               if ($this->activePackages != $previousActivePackage) {
+               if ($this->activePackages != $previousActivePackages) {
                        foreach ($this->requiredPackageKeys as $requiredPackageKey) {
                                $this->packageStatesConfiguration['packages'][$requiredPackageKey]['state'] = 'active';
                        }
@@ -341,9 +329,8 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
                        $packagePaths = $this->scanPackagesInPath($packagesBasePath, $packagePaths);
                }
 
-               foreach ($packagePaths as $composerManifestPath) {
-                       $packagePath = $composerManifestPath;
-                       $packagesBasePath = PATH_site;
+               foreach ($packagePaths as $packagePath) {
+                       $packagesBasePath = $this->packagesBasePath;
                        foreach ($this->packagesBasePaths as $basePath) {
                                if (strpos($packagePath, $basePath) === 0) {
                                        $packagesBasePath = $basePath;
@@ -351,7 +338,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
                                }
                        }
                        try {
-                               $composerManifest = $this->getComposerManifest($composerManifestPath);
+                               $composerManifest = $this->getComposerManifest($packagePath);
                                $packageKey = $this->getPackageKeyFromManifest($composerManifest, $packagePath, $packagesBasePath);
                                $this->composerNameToPackageKeyMap[strtolower($composerManifest->name)] = $packageKey;
                                $this->packageStatesConfiguration['packages'][$packageKey]['composerName'] = $composerManifest->name;
@@ -435,7 +422,6 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
         *
         * @param bool $registerOnlyNewPackages
         * @return void
-        * @throws Exception\CorruptPackageException
         */
        protected function registerPackagesFromConfiguration($registerOnlyNewPackages = FALSE) {
                $packageStatesHasChanged = FALSE;
@@ -466,10 +452,6 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
 
                        $this->registerPackage($package, FALSE);
 
-                       if (!$this->packages[$packageKey] instanceof PackageInterface) {
-                               throw new Exception\CorruptPackageException(sprintf('The package class in package "%s" does not implement PackageInterface.', $packageKey), 1300782488);
-                       }
-
                        $this->packageKeys[strtolower($packageKey)] = $packageKey;
                        if ($stateConfiguration['state'] === 'active') {
                                $this->activePackages[$packageKey] = $this->packages[$packageKey];
@@ -799,7 +781,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
                $fileDescription .= "# This file will be regenerated automatically if it doesn't exist. Deleting this file\n";
                $fileDescription .= "# should, however, never become necessary if you use the package commands.\n";
 
-                       // we do not need the dependencies on disk...
+               // We do not need the dependencies on disk...
                foreach ($this->packageStatesConfiguration['packages'] as &$packageConfiguration) {
                        if (isset($packageConfiguration['dependencies'])) {
                                unset($packageConfiguration['dependencies']);
@@ -839,7 +821,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
         * Returns an array of \TYPO3\CMS\Core\Package objects of all available packages.
         * A package is available, if the package directory contains valid meta information.
         *
-        * @return array Array of PackageInterface
+        * @return PackageInterface[] Array of PackageInterface
         * @api
         */
        public function getAvailablePackages() {
@@ -965,4 +947,5 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
                        return preg_replace('/[^A-Za-z0-9.]/', '', $packageKey);
                }
        }
+
 }
index f36269f..aa014a8 100644 (file)
@@ -15,6 +15,7 @@ use TYPO3\CMS\Core\Package\DependencyResolver;
 use TYPO3\CMS\Core\Package\PackageInterface;
 use org\bovigo\vfs\vfsStream;
 use TYPO3\CMS\Core\Package\PackageManager;
+use TYPO3\CMS\Core\Package\Package;
 use TYPO3\CMS\Core\Service\DependencyOrderingService;
 
 /**
@@ -60,14 +61,14 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @param string $packageKey
-        * @return \TYPO3\CMS\Core\Package\Package
+        * @return Package
         */
        protected function createPackage($packageKey) {
                $packagePath = 'vfs://Test/Packages/Application/' . $packageKey . '/';
                mkdir($packagePath, 0770, TRUE);
                file_put_contents($packagePath . 'ext_emconf.php', '');
                file_put_contents($packagePath . 'composer.json', '');
-               $package = new \TYPO3\CMS\Core\Package\Package($this->packageManager, $packageKey, $packagePath);
+               $package = new Package($this->packageManager, $packageKey, $packagePath);
                $this->packageManager->registerPackage($package);
                $this->packageManager->activatePackage($packageKey);
 
@@ -78,10 +79,10 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getPackageReturnsTheSpecifiedPackage() {
-               $this->createPackage('TYPO3.Flow');
-               $package = $this->packageManager->getPackage('TYPO3.Flow');
+               $this->createPackage('TYPO3.MyPackage');
+               $package = $this->packageManager->getPackage('TYPO3.MyPackage');
 
-               $this->assertInstanceOf(\TYPO3\CMS\Core\Package\PackageInterface::class, $package, 'The result of getPackage() was no valid package object.');
+               $this->assertInstanceOf(Package::class, $package, 'The result of getPackage() was no valid package object.');
        }
 
        /**
@@ -108,7 +109,6 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        $packagePath = 'vfs://Test/Packages/Application/' . $packageKey . '/';
 
                        mkdir($packagePath, 0770, TRUE);
-                       mkdir($packagePath . 'Classes');
                        file_put_contents($packagePath . 'composer.json', '{"name": "' . $packageKey . '", "type": "typo3-test"}');
                }
 
@@ -139,7 +139,6 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        $packagePath = 'vfs://Test/Packages/Application/' . $packageKey . '/';
 
                        mkdir($packagePath, 0770, TRUE);
-                       mkdir($packagePath . 'Classes');
                        file_put_contents($packagePath . 'composer.json', '{"name": "' . $packageKey . '", "type": "typo3-cms-test"}');
                        file_put_contents($packagePath . 'ext_emconf.php', '');
                }
@@ -159,6 +158,7 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
                $packageManager->injectDependencyResolver($dependencyResolver);
 
+               $packageKey = $expectedPackageKeys[0];
                $packageManager->_set('packageStatesConfiguration', array(
                        'packages' => array(
                                $packageKey => array(
@@ -190,7 +190,6 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        $packagePath = 'vfs://Test/Packages/Application/' . $packageKey . '/';
 
                        mkdir($packagePath, 0770, TRUE);
-                       mkdir($packagePath . 'Classes');
                        file_put_contents($packagePath . 'composer.json', '{"name": "' . $packageKey . '", "type": "typo3-cms-test"}');
                        file_put_contents($packagePath . 'ext_emconf.php', '');
                }
index d6a1ac8..04b56a7 100644 (file)
@@ -11,8 +11,9 @@ namespace TYPO3\CMS\Core\Tests\Unit\Package;
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
-use TYPO3\CMS\Core\Package\Package as Package;
+use TYPO3\CMS\Core\Package\Package;
 use org\bovigo\vfs\vfsStream;
+use TYPO3\CMS\Core\Package\PackageManager;
 
 /**
  * Testcase for the package class
@@ -31,7 +32,7 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @expectedException \TYPO3\CMS\Core\Package\Exception\InvalidPackagePathException
         */
        public function constructThrowsPackageDoesNotExistException() {
-               $packageManagerMock = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class);
+               $packageManagerMock = $this->getMock(PackageManager::class);
                $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
                new Package($packageManagerMock, 'Vendor.TestPackage', './ThisPackageSurelyDoesNotExist');
        }
@@ -58,7 +59,7 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                file_put_contents($packagePath . 'composer.json', '{"name": "' . $packageKey . '", "type": "flow-test"}');
                file_put_contents($packagePath . 'ext_emconf.php', '');
 
-               $packageManagerMock = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class);
+               $packageManagerMock = $this->getMock(PackageManager::class);
                $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
                $package = new Package($packageManagerMock, $packageKey, $packagePath);
                $this->assertEquals($packageKey, $package->getPackageKey());
@@ -83,47 +84,20 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $packagePath = 'vfs://Packages/' . str_replace('\\', '/', $packageKey) . '/';
                mkdir($packagePath, 0777, TRUE);
 
-               $packageManagerMock = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class);
+               $packageManagerMock = $this->getMock(PackageManager::class);
                new Package($packageManagerMock, $packageKey, $packagePath);
        }
 
        /**
         * @test
         */
-       public function getNamespaceReturnsThePhpNamespaceCorrespondingToThePackageKey() {
-               $packagePath = 'vfs://Packages/Application/Acme.MyPackage/';
-               mkdir($packagePath, 0777, TRUE);
-               file_put_contents($packagePath . 'composer.json', '{"name": "acme/mypackage", "type": "flow-test"}');
-               file_put_contents($packagePath . 'ext_emconf.php', '');
-
-               $packageManagerMock = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class);
-               $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
-               $package = new Package($packageManagerMock, 'Acme.MyPackage', $packagePath);
-               $this->assertEquals('Acme\\MyPackage', $package->getNamespace());
-       }
-
-       /**
-        * @test
-        */
-       public function getClassesPathReturnsPathToClasses() {
-               $packageManagerMock = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class);
-               $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
-               $package = new Package($packageManagerMock, 'core', PATH_typo3 . 'sysext/core/');
-               $packageClassesPath = $package->getClassesPath();
-               $expected = $package->getPackagePath() . Package::DIRECTORY_CLASSES;
-               $this->assertEquals($expected, $packageClassesPath);
-       }
-
-       /**
-        * @test
-        */
        public function aPackageCanBeFlaggedAsProtected() {
                $packagePath = 'vfs://Packages/Application/Vendor/Dummy/';
                mkdir($packagePath, 0700, TRUE);
                file_put_contents($packagePath . 'composer.json', '{"name": "vendor/dummy", "type": "flow-test"}');
                file_put_contents($packagePath . 'ext_emconf.php', '');
 
-               $packageManagerMock = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class);
+               $packageManagerMock = $this->getMock(PackageManager::class);
                $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
                $package = new Package($packageManagerMock, 'Vendor.Dummy', $packagePath);
 
index 9fdd19f..6c1c794 100644 (file)
@@ -72,11 +72,6 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface {
                $this->emitPackagesMayHaveChangedSignal();
                $extensions = array();
                foreach ($this->packageManager->getAvailablePackages() as $package) {
-                       // Only TYPO3 related packages could be handled by the extension manager
-                       // Composer packages from "Packages" folder will be instantiated as \TYPO3\Flow\Package\Package
-                       if (!($package instanceof \TYPO3\CMS\Core\Package\PackageInterface)) {
-                               continue;
-                       }
                        $installationType = $this->getInstallTypeForPackage($package);
                        $extensions[$package->getPackageKey()] = array(
                                'siteRelPath' => str_replace(PATH_site, '', $package->getPackagePath()),