diff --git a/app/code/Magento/Backend/App/Router.php b/app/code/Magento/Backend/App/Router.php index fbcacd862a2195e8d580146c6eb1bbdf27d89550..8d4a75438e8eb18c21c4791e48f702f448357edb 100644 --- a/app/code/Magento/Backend/App/Router.php +++ b/app/code/Magento/Backend/App/Router.php @@ -10,21 +10,11 @@ namespace Magento\Backend\App; class Router extends \Magento\Framework\App\Router\Base { - /** - * @var \Magento\Backend\App\ConfigInterface - */ - protected $_backendConfig; - /** * @var \Magento\Framework\UrlInterface $url */ protected $_url; - /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_coreConfig; - /** * List of required request parameters * Order sensitive @@ -46,92 +36,6 @@ class Router extends \Magento\Framework\App\Router\Base */ protected $pathPrefix = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE; - /** - * @param \Magento\Framework\App\Router\ActionList $actionList - * @param \Magento\Framework\App\ActionFactory $actionFactory - * @param \Magento\Framework\App\DefaultPathInterface $defaultPath - * @param \Magento\Framework\App\ResponseFactory $responseFactory - * @param \Magento\Framework\App\Route\ConfigInterface $routeConfig - * @param \Magento\Framework\UrlInterface $url - * @param string $routerId - * @param \Magento\Framework\Code\NameBuilder $nameBuilder - * @param \Magento\Framework\App\Router\PathConfigInterface $pathConfig - * @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig - * @param \Magento\Backend\App\ConfigInterface $backendConfig - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) - */ - public function __construct( - \Magento\Framework\App\Router\ActionList $actionList, - \Magento\Framework\App\ActionFactory $actionFactory, - \Magento\Framework\App\DefaultPathInterface $defaultPath, - \Magento\Framework\App\ResponseFactory $responseFactory, - \Magento\Framework\App\Route\ConfigInterface $routeConfig, - \Magento\Framework\UrlInterface $url, - $routerId, - \Magento\Framework\Code\NameBuilder $nameBuilder, - \Magento\Framework\App\Router\PathConfigInterface $pathConfig, - \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, - \Magento\Backend\App\ConfigInterface $backendConfig - ) { - parent::__construct( - $actionList, - $actionFactory, - $defaultPath, - $responseFactory, - $routeConfig, - $url, - $routerId, - $nameBuilder, - $pathConfig - ); - $this->_coreConfig = $coreConfig; - $this->_backendConfig = $backendConfig; - $this->_url = $url; - } - - /** - * Get router default request path - * @return string - */ - protected function _getDefaultPath() - { - return (string)$this->_backendConfig->getValue('web/default/admin'); - } - - /** - * Check whether URL for corresponding path should use https protocol - * - * @param string $path - * @return bool - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _shouldBeSecure($path) - { - return substr( - (string)$this->_coreConfig->getValue('web/unsecure/base_url', 'default'), - 0, - 5 - ) === 'https' || $this->_backendConfig->isSetFlag( - 'web/secure/use_in_adminhtml' - ) && substr( - (string)$this->_coreConfig->getValue('web/secure/base_url', 'default'), - 0, - 5 - ) === 'https'; - } - - /** - * Retrieve current secure url - * - * @param \Magento\Framework\App\RequestInterface $request - * @return string - */ - protected function _getCurrentSecureUrl($request) - { - return $this->_url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); - } - /** * Check whether redirect should be used for secure routes * diff --git a/app/code/Magento/Backend/Model/AdminPathConfig.php b/app/code/Magento/Backend/Model/AdminPathConfig.php new file mode 100644 index 0000000000000000000000000000000000000000..14e0a715cb12ca0f86546cb886477714106ac78f --- /dev/null +++ b/app/code/Magento/Backend/Model/AdminPathConfig.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Backend\Model; + +use Magento\Framework\App\Router\PathConfigInterface; +use Magento\Store\Model\Store; + +/** + * Path config to be used in adminhtml area + */ +class AdminPathConfig implements PathConfigInterface +{ + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $coreConfig; + + /** + * @var \Magento\Backend\App\ConfigInterface + */ + protected $backendConfig; + + /** + * @var \Magento\Framework\UrlInterface + */ + protected $url; + + /** + * Constructor + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig + * @param \Magento\Backend\App\ConfigInterface $backendConfig + * @param \Magento\Framework\UrlInterface $url + */ + public function __construct( + \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, + \Magento\Backend\App\ConfigInterface $backendConfig, + \Magento\Framework\UrlInterface $url + ) { + $this->coreConfig = $coreConfig; + $this->backendConfig = $backendConfig; + $this->url = $url; + } + + /** + * {@inheritdoc} + * + * @param \Magento\Framework\App\RequestInterface $request + * @return string + */ + public function getCurrentSecureUrl(\Magento\Framework\App\RequestInterface $request) + { + return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); + } + + /** + * {@inheritdoc} + * + * @param string $path + * @return bool + */ + public function shouldBeSecure($path) + { + return parse_url( + (string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'), + PHP_URL_SCHEME + ) === 'https' + || $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML) + && parse_url( + (string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'), + PHP_URL_SCHEME + ) === 'https'; + } + + /** + * {@inheritdoc} + * + * @return string + */ + public function getDefaultPath() + { + return $this->backendConfig->getValue('web/default/admin'); + } +} diff --git a/app/code/Magento/Backend/Test/Unit/Model/AdminPathConfigTest.php b/app/code/Magento/Backend/Test/Unit/Model/AdminPathConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..224fa3d2b630cd2f2da8efbb7dd49fd8feea212b --- /dev/null +++ b/app/code/Magento/Backend/Test/Unit/Model/AdminPathConfigTest.php @@ -0,0 +1,112 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Backend\Test\Unit\Model; + +use Magento\Backend\Model\AdminPathConfig; +use Magento\Store\Model\Store; + +class AdminPathConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $coreConfig; + + /** + * @var \Magento\Backend\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $backendConfig; + + /** + * @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $url; + + /** + * @var AdminPathConfig + */ + protected $adminPathConfig; + + public function setUp() + { + $this->coreConfig = $this->getMockForAbstractClass( + 'Magento\Framework\App\Config\ScopeConfigInterface', + [], + '', + false + ); + $this->backendConfig = $this->getMockForAbstractClass('Magento\Backend\App\ConfigInterface', [], '', false); + $this->url = $this->getMockForAbstractClass( + 'Magento\Framework\UrlInterface', + [], + '', + false, + true, + true, + ['getBaseUrl'] + ); + $this->adminPathConfig = new AdminPathConfig($this->coreConfig, $this->backendConfig, $this->url); + } + + public function testGetCurrentSecureUrl() + { + $request = $this->getMockForAbstractClass( + 'Magento\Framework\App\RequestInterface', + [], + '', + false, + true, + true, + ['getPathInfo'] + ); + $request->expects($this->once())->method('getPathInfo')->willReturn('/info'); + $this->url->expects($this->once())->method('getBaseUrl')->with('link', true)->willReturn('localhost/'); + $this->assertEquals('localhost/info', $this->adminPathConfig->getCurrentSecureUrl($request)); + } + + /** + * @param $unsecureBaseUrl + * @param $useSecureInAdmin + * @param $secureBaseUrl + * @param $expected + * @dataProvider shouldBeSecureDataProvider + */ + public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureBaseUrl, $expected) + { + $coreConfigValueMap = [ + [\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default', null, $unsecureBaseUrl], + [\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'default', null, $secureBaseUrl], + ]; + $this->coreConfig->expects($this->any())->method('getValue')->will($this->returnValueMap($coreConfigValueMap)); + $this->backendConfig->expects($this->any())->method('isSetFlag')->willReturn($useSecureInAdmin); + $this->assertEquals($expected, $this->adminPathConfig->shouldBeSecure('')); + } + + /** + * @return array + */ + public function shouldBeSecureDataProvider() + { + return [ + ['http://localhost/', false, 'default', false], + ['http://localhost/', true, 'default', false], + ['https://localhost/', false, 'default', true], + ['https://localhost/', true, 'default', true], + ['http://localhost/', false, 'https://localhost/', false], + ['http://localhost/', true, 'https://localhost/', true], + ['https://localhost/', true, 'https://localhost/', true], + ]; + } + + public function testGetDefaultPath() + { + $this->backendConfig->expects($this->once()) + ->method('getValue') + ->with('web/default/admin') + ->willReturn('default/path'); + $this->assertEquals('default/path', $this->adminPathConfig->getDefaultPath()); + } +} diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index cccd487a9f5662ca3ee4ec187ecb4a4942ce8f9e..fd969977eb0df3f8aad3239ddc768a248f35155e 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -127,4 +127,5 @@ <argument name="xFrameOpt" xsi:type="const">Magento\Framework\App\Response\XFrameOptPlugin::BACKEND_X_FRAME_OPT</argument> </arguments> </type> + <preference for="Magento\Framework\App\Router\PathConfigInterface" type="Magento\Backend\Model\AdminPathConfig" /> </config> diff --git a/app/code/Magento/Developer/Console/Command/CssDeployCommand.php b/app/code/Magento/Developer/Console/Command/CssDeployCommand.php index 27f5c8658ca0294ea72a9540ac106757a222c86c..4abf04b34f01f82ef58b214bf442202634949664 100644 --- a/app/code/Magento/Developer/Console/Command/CssDeployCommand.php +++ b/app/code/Magento/Developer/Console/Command/CssDeployCommand.php @@ -219,22 +219,23 @@ class CssDeployCommand extends Command ] ); + $rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT); $sourceFile = $this->assetSource->findSource($asset); - $content = \file_get_contents($sourceFile); + $relativePath = $rootDir->getRelativePath($sourceFile); + $content = $rootDir->readFile($relativePath); $chain = $this->chainFactory->create( [ 'asset' => $asset, 'origContent' => $content, 'origContentType' => $asset->getContentType(), - 'origAssetPath' => $asset->getFilePath() + 'origAssetPath' => $relativePath ] ); $processedCoreFile = $sourceFileGenerator->generateFileTree($chain); $targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW); - $rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT); $source = $rootDir->getRelativePath($processedCoreFile); $destination = $asset->getPath(); $rootDir->copyFile($source, $destination, $targetDir); diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php index 5d49f932b72c441fb1c39969a1035a60e212384b..d274aa003133d2bd6a8bebc061113cb6e94cfd5d 100644 --- a/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php @@ -113,6 +113,8 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase ->method('create') ->with('less') ->willReturn($this->getMock('Magento\Framework\View\Asset\SourceFileGeneratorInterface')); + $asset = $this->getMockForAbstractClass('Magento\Framework\View\Asset\LocalInterface'); + $asset->expects($this->once())->method('getContentType')->willReturn('type'); $this->assetRepo->expects($this->once()) ->method('createAsset') ->with( @@ -123,18 +125,28 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase 'locale' => 'en_US' ] ) - ->willReturn( - $this->getMockForAbstractClass('Magento\Framework\View\Asset\LocalInterface') - ); + ->willReturn($asset); $this->assetSource->expects($this->once())->method('findSource')->willReturn('/dev/null'); - $this->chainFactory->expects($this->once())->method('create')->willReturn( - $this->getMock('Magento\Framework\View\Asset\PreProcessor\Chain', [], [], '', false) - ); + $this->chainFactory->expects($this->once()) + ->method('create') + ->with( + [ + 'asset' => $asset, + 'origContent' => 'content', + 'origContentType' => 'type', + 'origAssetPath' => 'relative/path', + ] + ) + ->willReturn($this->getMock('Magento\Framework\View\Asset\PreProcessor\Chain', [], [], '', false)); - $this->filesystem->expects($this->atLeastOnce())->method('getDirectoryWrite')->willReturn( + $rootDir = $this->getMock('\Magento\Framework\Filesystem\Directory\WriteInterface', [], [], '', false); + $this->filesystem->expects($this->at(0))->method('getDirectoryWrite')->willReturn($rootDir); + $this->filesystem->expects($this->at(1))->method('getDirectoryWrite')->willReturn( $this->getMock('\Magento\Framework\Filesystem\Directory\WriteInterface', [], [], '', false) ); + $rootDir->expects($this->atLeastOnce())->method('getRelativePath')->willReturn('relative/path'); + $rootDir->expects($this->once())->method('readFile')->willReturn('content'); $this->validator->expects($this->once())->method('isValid')->with('en_US')->willReturn(true); diff --git a/app/code/Magento/Indexer/Console/Command/AbstractIndexerCommand.php b/app/code/Magento/Indexer/Console/Command/AbstractIndexerCommand.php index 799cbde5e83f07aae668d5c91c3904e39dcecd05..cdd3ee2541d8bff38f52da9201677ec8c56187e4 100644 --- a/app/code/Magento/Indexer/Console/Command/AbstractIndexerCommand.php +++ b/app/code/Magento/Indexer/Console/Command/AbstractIndexerCommand.php @@ -62,7 +62,7 @@ abstract class AbstractIndexerCommand extends Command /** @var \Magento\Framework\App\State $appState */ $appState = $this->objectManager->get('Magento\Framework\App\State'); $appState->setAreaCode($area); - $configLoader = $this->objectManager->get('Magento\Framework\App\ObjectManager\ConfigLoader'); + $configLoader = $this->objectManager->get('Magento\Framework\ObjectManager\ConfigLoaderInterface'); $this->objectManager->configure($configLoader->load($area)); } return $this->objectManager; diff --git a/app/code/Magento/Indexer/Test/Unit/Console/Command/AbstractIndexerCommandCommonSetup.php b/app/code/Magento/Indexer/Test/Unit/Console/Command/AbstractIndexerCommandCommonSetup.php index a6bca473428ff733f525ceb5c83de531157b6fb3..0179895599cd579c574806a4eb319c222b27c0bf 100644 --- a/app/code/Magento/Indexer/Test/Unit/Console/Command/AbstractIndexerCommandCommonSetup.php +++ b/app/code/Magento/Indexer/Test/Unit/Console/Command/AbstractIndexerCommandCommonSetup.php @@ -53,7 +53,7 @@ class AbstractIndexerCommandCommonSetup extends \PHPUnit_Framework_TestCase ->method('get') ->will($this->returnValueMap([ ['Magento\Framework\App\State', $this->stateMock], - ['Magento\Framework\App\ObjectManager\ConfigLoader', $this->configLoaderMock] + ['Magento\Framework\ObjectManager\ConfigLoaderInterface', $this->configLoaderMock] ])); $this->collectionFactory = $this->getMockBuilder('Magento\Indexer\Model\Indexer\CollectionFactory') diff --git a/app/code/Magento/Paypal/Setup/InstallData.php b/app/code/Magento/Paypal/Setup/InstallData.php index 50272f5adaae73b6570d31eab63aa94815974773..c839b862fdab6fc47465ee9978cf76af5827e2b5 100644 --- a/app/code/Magento/Paypal/Setup/InstallData.php +++ b/app/code/Magento/Paypal/Setup/InstallData.php @@ -48,8 +48,8 @@ class InstallData implements InstallDataInterface */ $setup->startSetup(); - $quoteInstaller = $this->quoteSetupFactory->create(); - $salesInstaller = $this->salesSetupFactory->create(); + $quoteInstaller = $this->quoteSetupFactory->create(['resourceName' => 'quote_setup', 'setup' => $setup]); + $salesInstaller = $this->salesSetupFactory->create(['resourceName' => 'sales_setup', 'setup' => $setup]); /** * Add paypal attributes to the: * - sales/flat_quote_payment_item table diff --git a/app/code/Magento/Quote/Setup/InstallData.php b/app/code/Magento/Quote/Setup/InstallData.php index 8a6d0f150198f2d59182bb4dbcaa7be82e244908..2d65d3ec2f7461c7874f89ff3a25bdd2f705d4fd 100644 --- a/app/code/Magento/Quote/Setup/InstallData.php +++ b/app/code/Magento/Quote/Setup/InstallData.php @@ -39,7 +39,7 @@ class InstallData implements InstallDataInterface public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var QuoteSetup $quoteSetup */ - $quoteSetup = $this->quoteSetupFactory->create(); + $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]); /** * Install eav entity types to the eav/entity_type table diff --git a/app/code/Magento/Sales/Setup/InstallData.php b/app/code/Magento/Sales/Setup/InstallData.php index 2dac7727cef40f91779350184308b1bbf82379ac..44d0766318ccc192c14647173bf785d5fbdf75b5 100644 --- a/app/code/Magento/Sales/Setup/InstallData.php +++ b/app/code/Magento/Sales/Setup/InstallData.php @@ -58,7 +58,7 @@ class InstallData implements InstallDataInterface public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var \Magento\Sales\Setup\SalesSetup $salesSetup */ - $salesSetup = $this->salesSetupFactory->create(); + $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]); /** * Install eav entity types to the eav/entity_type table diff --git a/app/code/Magento/Tax/Setup/InstallData.php b/app/code/Magento/Tax/Setup/InstallData.php index a8edea0a7907174a258a2ed1ee62080c145f3e11..d62ae4e22dc7a51a0c7f0ef1543ddefb52ddc8d3 100644 --- a/app/code/Magento/Tax/Setup/InstallData.php +++ b/app/code/Magento/Tax/Setup/InstallData.php @@ -43,7 +43,7 @@ class InstallData implements InstallDataInterface /** * Add tax_class_id attribute to the 'eav_attribute' table */ - $catalogInstaller = $taxSetup->getCatalogSetup(); + $catalogInstaller = $taxSetup->getCatalogSetup(['resourceName' => 'catalog_setup', 'setup' => $setup]); $catalogInstaller->addAttribute( \Magento\Catalog\Model\Product::ENTITY, 'tax_class_id', diff --git a/app/code/Magento/Theme/Model/Theme/ThemeDependencyChecker.php b/app/code/Magento/Theme/Model/Theme/ThemeDependencyChecker.php index 81164a9e21fbfd3c0ae00c040354234c6e9a6097..05209e7fd84dc7359697f1e478d08083cb14044e 100644 --- a/app/code/Magento/Theme/Model/Theme/ThemeDependencyChecker.php +++ b/app/code/Magento/Theme/Model/Theme/ThemeDependencyChecker.php @@ -70,7 +70,7 @@ class ThemeDependencyChecker return $this->checkChildTheme($themePaths); } - return false; + return []; } /** diff --git a/composer.json b/composer.json index a8a75f38b5e306b3f6371991abfc81fe55c98bff..0889646cdd9c7635d753b3f62a77a6ca8c75f96a 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "magento/magento-composer-installer": "*", "braintree/braintree_php": "2.39.0", "symfony/console": "~2.3 <2.7", + "symfony/event-dispatcher": "~2.1", "phpseclib/phpseclib": "~0.3", "tedivm/jshrink": "~1.0.1", "magento/composer": "~1.0.0" diff --git a/composer.lock b/composer.lock index 628b9af4df68ef7bae1c6a0d374a231937382a71..5f638af51713461dbdf2da2e6ad428b7b827ab1b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "de0d450a2c86bda5a2101109be73daff", + "hash": "ba8186cbc63f5db144177d64249726e6", "packages": [ { "name": "braintree/braintree_php", @@ -335,7 +335,7 @@ "ZF1", "framework" ], - "time": "2015-02-06 17:25:45" + "time": "2015-06-02 08:04:41" }, { "name": "monolog/monolog", @@ -764,6 +764,64 @@ "homepage": "https://symfony.com", "time": "2015-07-26 09:08:40" }, + { + "name": "symfony/event-dispatcher", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/b58c916f1db03a611b72dd702564f30ad8fe83fa", + "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", + "symfony/stopwatch": "~2.3" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2015-08-24 07:13:45" + }, { "name": "symfony/finder", "version": "v2.7.4", @@ -958,12 +1016,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-code.git", - "reference": "cfd5951ff4348e4430850560416c7ddb755f95d3" + "reference": "0ed94f842ba60cdc900c46a61bdbd7ac95a3e140" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-code/zipball/0ed94f842ba60cdc900c46a61bdbd7ac95a3e140", - "reference": "cfd5951ff4348e4430850560416c7ddb755f95d3", + "reference": "0ed94f842ba60cdc900c46a61bdbd7ac95a3e140", "shasum": "" }, "require": { @@ -972,6 +1030,9 @@ }, "require-dev": { "doctrine/common": ">=2.1", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-stdlib": "self.version" }, "suggest": { @@ -987,7 +1048,7 @@ }, "autoload": { "psr-4": { - "Zend\\Code\\": "" + "Zend\\Code\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -995,12 +1056,12 @@ "BSD-3-Clause" ], "description": "provides facilities to generate arbitrary code using an object oriented interface", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-code", "keywords": [ "code", "zf2" ], - "time": "2015-04-01 17:59:08" + "time": "2015-03-31 15:39:14" }, { "name": "zendframework/zend-config", @@ -1008,12 +1069,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-config.git", - "reference": "8682fe4e2923b383bb6472fc84b5796a07589163" + "reference": "95f3a4b3fa85d49e6f060183122de4596fa6d29d" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-config/zipball/95f3a4b3fa85d49e6f060183122de4596fa6d29d", - "reference": "8682fe4e2923b383bb6472fc84b5796a07589163", + "reference": "95f3a4b3fa85d49e6f060183122de4596fa6d29d", "shasum": "" }, "require": { @@ -1021,6 +1082,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-filter": "self.version", "zendframework/zend-i18n": "self.version", "zendframework/zend-json": "self.version", @@ -1041,7 +1105,7 @@ }, "autoload": { "psr-4": { - "Zend\\Config\\": "" + "Zend\\Config\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1049,12 +1113,12 @@ "BSD-3-Clause" ], "description": "provides a nested object property based user interface for accessing this configuration data within application code", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-config", "keywords": [ "config", "zf2" ], - "time": "2015-04-01 17:59:31" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-console", @@ -1062,18 +1126,23 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-console.git", - "reference": "94ab6663b07e19f20b3319ecf317bd72b6a72dca" + "reference": "54823d9ba6f8ce39046384ee5a043b5b3d5f56d7" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-console/zipball/54823d9ba6f8ce39046384ee5a043b5b3d5f56d7", - "reference": "94ab6663b07e19f20b3319ecf317bd72b6a72dca", + "reference": "54823d9ba6f8ce39046384ee5a043b5b3d5f56d7", "shasum": "" }, "require": { "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "suggest": { "zendframework/zend-filter": "To support DefaultRouteMatcher usage", "zendframework/zend-validator": "To support DefaultRouteMatcher usage" @@ -1087,19 +1156,19 @@ }, "autoload": { "psr-4": { - "Zend\\Console\\": "" + "Zend\\Console\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-console", "keywords": [ "console", "zf2" ], - "time": "2015-04-01 17:59:48" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-crypt", @@ -1158,12 +1227,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-di.git", - "reference": "0811f2a67ad0b50dfb8d602ed67cde0b82249190" + "reference": "b9f8de081adecf71a003a569e9ba76c0a4c00bf2" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-di/zipball/b9f8de081adecf71a003a569e9ba76c0a4c00bf2", - "reference": "0811f2a67ad0b50dfb8d602ed67cde0b82249190", + "reference": "b9f8de081adecf71a003a569e9ba76c0a4c00bf2", "shasum": "" }, "require": { @@ -1172,6 +1241,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-servicemanager": "self.version" }, "suggest": { @@ -1186,19 +1258,19 @@ }, "autoload": { "psr-4": { - "Zend\\Di\\": "" + "Zend\\Di\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-di", "keywords": [ "di", "zf2" ], - "time": "2015-04-01 18:01:30" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-escaper", @@ -1206,17 +1278,22 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-escaper.git", - "reference": "65b3328627362b0be1d5e9067bc846511d1fbc96" + "reference": "15e5769e4fcdb4bf07ebd76500810e7070e23a97" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/15e5769e4fcdb4bf07ebd76500810e7070e23a97", - "reference": "65b3328627362b0be1d5e9067bc846511d1fbc96", + "reference": "15e5769e4fcdb4bf07ebd76500810e7070e23a97", "shasum": "" }, "require": { "php": ">=5.3.23" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1226,19 +1303,19 @@ }, "autoload": { "psr-4": { - "Zend\\Escaper\\": "" + "Zend\\Escaper\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-escaper", "keywords": [ "escaper", "zf2" ], - "time": "2015-04-01 18:02:07" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-eventmanager", @@ -1246,18 +1323,23 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "38df5b567d4ff4d22144745c503ba0502d0d5695" + "reference": "58d21c95c7005a527262fd536499195f104e83f9" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/58d21c95c7005a527262fd536499195f104e83f9", - "reference": "38df5b567d4ff4d22144745c503ba0502d0d5695", + "reference": "58d21c95c7005a527262fd536499195f104e83f9", "shasum": "" }, "require": { "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1267,19 +1349,19 @@ }, "autoload": { "psr-4": { - "Zend\\EventManager\\": "" + "Zend\\EventManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-event-manager", "keywords": [ "eventmanager", "zf2" ], - "time": "2015-04-01 18:05:26" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-filter", @@ -1287,12 +1369,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-filter.git", - "reference": "b13741a88553351fc52472de529b57b580b8f6f1" + "reference": "6d8aed2da81b62a04747346c4370562cdbe34595" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/6d8aed2da81b62a04747346c4370562cdbe34595", - "reference": "b13741a88553351fc52472de529b57b580b8f6f1", + "reference": "6d8aed2da81b62a04747346c4370562cdbe34595", "shasum": "" }, "require": { @@ -1300,6 +1382,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-crypt": "self.version", "zendframework/zend-servicemanager": "self.version", "zendframework/zend-uri": "self.version" @@ -1319,7 +1404,7 @@ }, "autoload": { "psr-4": { - "Zend\\Filter\\": "" + "Zend\\Filter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1327,12 +1412,12 @@ "BSD-3-Clause" ], "description": "provides a set of commonly needed data filters", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-filter", "keywords": [ "filter", "zf2" ], - "time": "2015-04-01 18:09:25" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-form", @@ -1340,12 +1425,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-form.git", - "reference": "09f5bd46ffbf783df22281898e2175b291bd43a3" + "reference": "bca0db55718355d25c2c10fdd41a83561f1c94b3" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-form/zipball/bca0db55718355d25c2c10fdd41a83561f1c94b3", - "reference": "09f5bd46ffbf783df22281898e2175b291bd43a3", + "reference": "bca0db55718355d25c2c10fdd41a83561f1c94b3", "shasum": "" }, "require": { @@ -1354,6 +1439,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-captcha": "self.version", "zendframework/zend-code": "self.version", "zendframework/zend-eventmanager": "self.version", @@ -1384,19 +1472,19 @@ }, "autoload": { "psr-4": { - "Zend\\Form\\": "" + "Zend\\Form\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-form", "keywords": [ "form", "zf2" ], - "time": "2015-04-01 18:09:25" + "time": "2015-03-28 20:29:18" }, { "name": "zendframework/zend-http", @@ -1404,12 +1492,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-http.git", - "reference": "ee6220609845b32d1b2873c9ac694aef56d508f5" + "reference": "9c6047a0bdb3094d3ea07a215ff929cc47de4deb" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-http/zipball/9c6047a0bdb3094d3ea07a215ff929cc47de4deb", - "reference": "ee6220609845b32d1b2873c9ac694aef56d508f5", + "reference": "9c6047a0bdb3094d3ea07a215ff929cc47de4deb", "shasum": "" }, "require": { @@ -1419,6 +1507,11 @@ "zendframework/zend-uri": "self.version", "zendframework/zend-validator": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1428,7 +1521,7 @@ }, "autoload": { "psr-4": { - "Zend\\Http\\": "" + "Zend\\Http\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1436,12 +1529,12 @@ "BSD-3-Clause" ], "description": "provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-http", "keywords": [ "http", "zf2" ], - "time": "2015-04-01 18:09:25" + "time": "2015-03-27 15:46:30" }, { "name": "zendframework/zend-i18n", @@ -1449,12 +1542,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "33051775d9a8c341fe3b77d1f3daa0e921e2f4bd" + "reference": "9aebc5287373a802540d75fe5508417f866c2e52" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/9aebc5287373a802540d75fe5508417f866c2e52", - "reference": "33051775d9a8c341fe3b77d1f3daa0e921e2f4bd", + "reference": "9aebc5287373a802540d75fe5508417f866c2e52", "shasum": "" }, "require": { @@ -1462,6 +1555,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-cache": "self.version", "zendframework/zend-config": "self.version", "zendframework/zend-eventmanager": "self.version", @@ -1490,19 +1586,19 @@ }, "autoload": { "psr-4": { - "Zend\\I18n\\": "" + "Zend\\I18n\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-i18n", "keywords": [ "i18n", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-inputfilter", @@ -1510,12 +1606,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-inputfilter.git", - "reference": "16856fec61f285e41e5492235220a4dec06ab90f" + "reference": "4b1398f3635fae3cc5e873c5bb067274f3d10a93" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/4b1398f3635fae3cc5e873c5bb067274f3d10a93", - "reference": "16856fec61f285e41e5492235220a4dec06ab90f", + "reference": "4b1398f3635fae3cc5e873c5bb067274f3d10a93", "shasum": "" }, "require": { @@ -1525,6 +1621,9 @@ "zendframework/zend-validator": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-servicemanager": "self.version" }, "suggest": { @@ -1539,19 +1638,19 @@ }, "autoload": { "psr-4": { - "Zend\\InputFilter\\": "" + "Zend\\InputFilter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-input-filter", "keywords": [ "inputfilter", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-json", @@ -1559,12 +1658,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-json.git", - "reference": "76aeb27e4baf39799e5ca3cf6f2fdd6748ee930c" + "reference": "2d845e151c1b9a237cf1899ac31e17fb10bd1e3f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-json/zipball/2d845e151c1b9a237cf1899ac31e17fb10bd1e3f", - "reference": "76aeb27e4baf39799e5ca3cf6f2fdd6748ee930c", + "reference": "2d845e151c1b9a237cf1899ac31e17fb10bd1e3f", "shasum": "" }, "require": { @@ -1572,6 +1671,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-http": "self.version", "zendframework/zend-server": "self.version" }, @@ -1589,7 +1691,7 @@ }, "autoload": { "psr-4": { - "Zend\\Json\\": "" + "Zend\\Json\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1597,12 +1699,12 @@ "BSD-3-Clause" ], "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-json", "keywords": [ "json", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-loader", @@ -1610,17 +1712,22 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-loader.git", - "reference": "6868b8a0c346f17fb97724c3a63aa2cbf6b94865" + "reference": "65de2c7a56f8eee633c6bf1cfab73e45648880d4" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-loader/zipball/65de2c7a56f8eee633c6bf1cfab73e45648880d4", - "reference": "6868b8a0c346f17fb97724c3a63aa2cbf6b94865", + "reference": "65de2c7a56f8eee633c6bf1cfab73e45648880d4", "shasum": "" }, "require": { "php": ">=5.3.23" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1630,19 +1737,19 @@ }, "autoload": { "psr-4": { - "Zend\\Loader\\": "" + "Zend\\Loader\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-loader", "keywords": [ "loader", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-log", @@ -1650,12 +1757,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-log.git", - "reference": "2d5d20fd45470506bdaff727c46dc25fe953146e" + "reference": "002e3c810cad7e31e51c9895e9e3cb6fbd312cdd" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-log/zipball/002e3c810cad7e31e51c9895e9e3cb6fbd312cdd", - "reference": "2d5d20fd45470506bdaff727c46dc25fe953146e", + "reference": "002e3c810cad7e31e51c9895e9e3cb6fbd312cdd", "shasum": "" }, "require": { @@ -1664,6 +1771,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-console": "self.version", "zendframework/zend-db": "self.version", "zendframework/zend-escaper": "self.version", @@ -1687,7 +1797,7 @@ }, "autoload": { "psr-4": { - "Zend\\Log\\": "" + "Zend\\Log\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1695,13 +1805,13 @@ "BSD-3-Clause" ], "description": "component for general purpose logging", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-log", "keywords": [ "log", "logging", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-math", @@ -1709,17 +1819,22 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-math.git", - "reference": "634123f83ca90b6613f132d0d100e6b5e9890a29" + "reference": "f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-math/zipball/f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73", - "reference": "634123f83ca90b6613f132d0d100e6b5e9890a29", + "reference": "f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73", "shasum": "" }, "require": { "php": ">=5.3.23" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "suggest": { "ext-bcmath": "If using the bcmath functionality", "ext-gmp": "If using the gmp functionality", @@ -1735,19 +1850,19 @@ }, "autoload": { "psr-4": { - "Zend\\Math\\": "" + "Zend\\Math\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-math", "keywords": [ "math", "zf2" ], - "time": "2015-04-01 18:09:27" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-modulemanager", @@ -1755,12 +1870,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-modulemanager.git", - "reference": "cbe16b0eafe734a062ed0182381e64b9c953dccf" + "reference": "af7ae3cd29a1efb73cc66ae1081e606039d5c20f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-modulemanager/zipball/af7ae3cd29a1efb73cc66ae1081e606039d5c20f", - "reference": "cbe16b0eafe734a062ed0182381e64b9c953dccf", + "reference": "af7ae3cd29a1efb73cc66ae1081e606039d5c20f", "shasum": "" }, "require": { @@ -1769,6 +1884,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-config": "self.version", "zendframework/zend-console": "self.version", "zendframework/zend-loader": "self.version", @@ -1790,19 +1908,19 @@ }, "autoload": { "psr-4": { - "Zend\\ModuleManager\\": "" + "Zend\\ModuleManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-module-manager", "keywords": [ "modulemanager", "zf2" ], - "time": "2015-04-01 18:09:27" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-mvc", @@ -1810,12 +1928,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-mvc.git", - "reference": "bfff0f5f9e4d925ee13b8c159c9d6ae7e0db5412" + "reference": "0b4a4a829b30be510a3f215c4ff00c703ee8b431" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-mvc/zipball/0b4a4a829b30be510a3f215c4ff00c703ee8b431", - "reference": "bfff0f5f9e4d925ee13b8c159c9d6ae7e0db5412", + "reference": "0b4a4a829b30be510a3f215c4ff00c703ee8b431", "shasum": "" }, "require": { @@ -1826,6 +1944,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-authentication": "self.version", "zendframework/zend-console": "self.version", "zendframework/zend-di": "self.version", @@ -1874,19 +1995,19 @@ }, "autoload": { "psr-4": { - "Zend\\Mvc\\": "" + "Zend\\Mvc\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-mvc", "keywords": [ "mvc", "zf2" ], - "time": "2015-04-01 18:09:27" + "time": "2015-03-26 18:55:14" }, { "name": "zendframework/zend-serializer", @@ -1894,12 +2015,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-serializer.git", - "reference": "a46960854d6326f0036d98c9abc7a79e36e25928" + "reference": "3c531789a9882a5deb721356a7bd2642b65d4b09" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/3c531789a9882a5deb721356a7bd2642b65d4b09", - "reference": "a46960854d6326f0036d98c9abc7a79e36e25928", + "reference": "3c531789a9882a5deb721356a7bd2642b65d4b09", "shasum": "" }, "require": { @@ -1909,6 +2030,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-servicemanager": "self.version" }, "suggest": { @@ -1923,7 +2047,7 @@ }, "autoload": { "psr-4": { - "Zend\\Serializer\\": "" + "Zend\\Serializer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1931,12 +2055,12 @@ "BSD-3-Clause" ], "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-serializer", "keywords": [ "serializer", "zf2" ], - "time": "2015-04-01 18:09:28" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-server", @@ -1944,12 +2068,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-server.git", - "reference": "fc73c34490908ba143af3c57c7e166b40c4b9f8e" + "reference": "d11ff0bd529d202022823d4accf5983cbd50fc49" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-server/zipball/d11ff0bd529d202022823d4accf5983cbd50fc49", - "reference": "fc73c34490908ba143af3c57c7e166b40c4b9f8e", + "reference": "d11ff0bd529d202022823d4accf5983cbd50fc49", "shasum": "" }, "require": { @@ -1957,6 +2081,11 @@ "zendframework/zend-code": "self.version", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1966,19 +2095,19 @@ }, "autoload": { "psr-4": { - "Zend\\Server\\": "" + "Zend\\Server\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-server", "keywords": [ "server", "zf2" ], - "time": "2015-04-01 18:09:28" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-servicemanager", @@ -1986,18 +2115,21 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-servicemanager.git", - "reference": "d3c27c708a148a30608f313a5b7a61a531bd9cb9" + "reference": "57cf99fa5ac08c05a135a8d0d676c52a5e450083" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/57cf99fa5ac08c05a135a8d0d676c52a5e450083", - "reference": "d3c27c708a148a30608f313a5b7a61a531bd9cb9", + "reference": "57cf99fa5ac08c05a135a8d0d676c52a5e450083", "shasum": "" }, "require": { "php": ">=5.3.23" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-di": "self.version" }, "suggest": { @@ -2013,19 +2145,19 @@ }, "autoload": { "psr-4": { - "Zend\\ServiceManager\\": "" + "Zend\\ServiceManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-service-manager", "keywords": [ "servicemanager", "zf2" ], - "time": "2015-04-01 18:09:28" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-soap", @@ -2033,12 +2165,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-soap.git", - "reference": "e42b900798ea95a9063fa4922da976d8b3a8ab6f" + "reference": "a599463aba97ce247faf3fb443e3c7858b46449b" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-soap/zipball/a599463aba97ce247faf3fb443e3c7858b46449b", - "reference": "e42b900798ea95a9063fa4922da976d8b3a8ab6f", + "reference": "a599463aba97ce247faf3fb443e3c7858b46449b", "shasum": "" }, "require": { @@ -2048,6 +2180,9 @@ "zendframework/zend-uri": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-http": "self.version" }, "suggest": { @@ -2062,19 +2197,19 @@ }, "autoload": { "psr-4": { - "Zend\\Soap\\": "" + "Zend\\Soap\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-soap", "keywords": [ "soap", "zf2" ], - "time": "2015-04-01 18:09:29" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-stdlib", @@ -2082,18 +2217,21 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030" + "reference": "cf05c5ba75606e47ffee91cedc72778da46f74c3" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cf05c5ba75606e47ffee91cedc72778da46f74c3", - "reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030", + "reference": "cf05c5ba75606e47ffee91cedc72778da46f74c3", "shasum": "" }, "require": { "php": ">=5.3.23" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-eventmanager": "self.version", "zendframework/zend-filter": "self.version", "zendframework/zend-serializer": "self.version", @@ -2114,19 +2252,19 @@ }, "autoload": { "psr-4": { - "Zend\\Stdlib\\": "" + "Zend\\Stdlib\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-stdlib", "keywords": [ "stdlib", "zf2" ], - "time": "2015-04-01 18:09:29" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-text", @@ -2134,12 +2272,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-text.git", - "reference": "35f519e20e575a331c2ee554e5a555a59ce4b9e2" + "reference": "d962ea25647b20527f3ca34ae225bbc885dabfc7" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-text/zipball/d962ea25647b20527f3ca34ae225bbc885dabfc7", - "reference": "35f519e20e575a331c2ee554e5a555a59ce4b9e2", + "reference": "d962ea25647b20527f3ca34ae225bbc885dabfc7", "shasum": "" }, "require": { @@ -2147,6 +2285,11 @@ "zendframework/zend-servicemanager": "self.version", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -2156,19 +2299,19 @@ }, "autoload": { "psr-4": { - "Zend\\Text\\": "" + "Zend\\Text\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-text", "keywords": [ "text", "zf2" ], - "time": "2015-04-01 18:09:29" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-uri", @@ -2176,12 +2319,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-uri.git", - "reference": "53f5b162b293f80de8b951eece8e08be83c4fe16" + "reference": "bd9e625639415376f6a82551c73328448d7bc7d1" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-uri/zipball/bd9e625639415376f6a82551c73328448d7bc7d1", - "reference": "53f5b162b293f80de8b951eece8e08be83c4fe16", + "reference": "bd9e625639415376f6a82551c73328448d7bc7d1", "shasum": "" }, "require": { @@ -2189,6 +2332,11 @@ "zendframework/zend-escaper": "self.version", "zendframework/zend-validator": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -2198,7 +2346,7 @@ }, "autoload": { "psr-4": { - "Zend\\Uri\\": "" + "Zend\\Uri\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2206,12 +2354,12 @@ "BSD-3-Clause" ], "description": "a component that aids in manipulating and validating » Uniform Resource Identifiers (URIs)", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-uri", "keywords": [ "uri", "zf2" ], - "time": "2015-04-01 18:09:29" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-validator", @@ -2219,12 +2367,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-validator.git", - "reference": "eb678d20256f120a72ca27276bbb2875841701ab" + "reference": "45fac2545a0f2eb66d71cb7966feee481e7c475f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/45fac2545a0f2eb66d71cb7966feee481e7c475f", - "reference": "eb678d20256f120a72ca27276bbb2875841701ab", + "reference": "45fac2545a0f2eb66d71cb7966feee481e7c475f", "shasum": "" }, "require": { @@ -2232,6 +2380,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-db": "self.version", "zendframework/zend-filter": "self.version", "zendframework/zend-i18n": "self.version", @@ -2259,7 +2410,7 @@ }, "autoload": { "psr-4": { - "Zend\\Validator\\": "" + "Zend\\Validator\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2267,12 +2418,12 @@ "BSD-3-Clause" ], "description": "provides a set of commonly needed validators", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-validator", "keywords": [ "validator", "zf2" ], - "time": "2015-04-01 18:09:30" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-view", @@ -2280,12 +2431,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-view.git", - "reference": "e119b4b5f082af58a96eb206e782b62c193227bf" + "reference": "37beb1ad46e530f627b4b6c3716efd728e976ba9" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-view/zipball/37beb1ad46e530f627b4b6c3716efd728e976ba9", - "reference": "e119b4b5f082af58a96eb206e782b62c193227bf", + "reference": "37beb1ad46e530f627b4b6c3716efd728e976ba9", "shasum": "" }, "require": { @@ -2295,6 +2446,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-authentication": "self.version", "zendframework/zend-escaper": "self.version", "zendframework/zend-feed": "self.version", @@ -2333,7 +2487,7 @@ }, "autoload": { "psr-4": { - "Zend\\View\\": "" + "Zend\\View\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2341,12 +2495,12 @@ "BSD-3-Clause" ], "description": "provides a system of helpers, output filters, and variable escaping", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-view", "keywords": [ "view", "zf2" ], - "time": "2015-04-01 18:09:30" + "time": "2015-03-25 20:55:48" } ], "packages-dev": [ @@ -2509,16 +2663,16 @@ }, { "name": "lusitanian/oauth", - "version": "v0.3.5", + "version": "v0.4.1", "source": { "type": "git", "url": "https://github.com/Lusitanian/PHPoAuthLib.git", - "reference": "ac5a1cd5a4519143728dce2213936eea302edf8a" + "reference": "b617831ffe58564c3ae06772a8b20310929af2ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/ac5a1cd5a4519143728dce2213936eea302edf8a", - "reference": "ac5a1cd5a4519143728dce2213936eea302edf8a", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/b617831ffe58564c3ae06772a8b20310929af2ea", + "reference": "b617831ffe58564c3ae06772a8b20310929af2ea", "shasum": "" }, "require": { @@ -2527,6 +2681,7 @@ "require-dev": { "phpunit/phpunit": "3.7.*", "predis/predis": "0.8.*@dev", + "squizlabs/php_codesniffer": "2.*", "symfony/http-foundation": "~2.1" }, "suggest": { @@ -2555,6 +2710,10 @@ "name": "David Desberg", "email": "david@daviddesberg.com" }, + { + "name": "Elliot Chance", + "email": "elliotchance@gmail.com" + }, { "name": "Pieter Hordijk", "email": "info@pieterhordijk.com" @@ -2567,7 +2726,7 @@ "oauth", "security" ], - "time": "2014-09-05 15:19:58" + "time": "2015-09-09 23:42:55" }, { "name": "pdepend/pdepend", @@ -3596,64 +3755,6 @@ "homepage": "https://symfony.com", "time": "2015-08-24 07:16:32" }, - { - "name": "symfony/event-dispatcher", - "version": "v2.7.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/b58c916f1db03a611b72dd702564f30ad8fe83fa", - "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/stopwatch": "~2.3" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2015-08-24 07:13:45" - }, { "name": "symfony/filesystem", "version": "v2.7.4", diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index cc7f031ee15afb838341a92a95efdefac7d1805a..f87f99bb42376c0541cc06bd8b05282019d3c2d9 100755 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -3844,4 +3844,5 @@ return [ 'Magento\Checkout\Model\Agreements\AgreementsProviderInterface', 'Magento\CheckoutAgreements\Model\AgreementsProviderInterface' ], + ['Magento\Setup\Model\SampleData', 'Magento\SampleData\Model\SampleData'], ]; diff --git a/lib/internal/Magento/Framework/App/State/CleanupFiles.php b/lib/internal/Magento/Framework/App/State/CleanupFiles.php index 5509d78d60dc0dc0c7832db3da324afdd31ea501..a03093721c36cc664f9f2273c68b8888b4c13f77 100644 --- a/lib/internal/Magento/Framework/App/State/CleanupFiles.php +++ b/lib/internal/Magento/Framework/App/State/CleanupFiles.php @@ -52,7 +52,7 @@ class CleanupFiles */ public function clearCodeGeneratedClasses() { - return $this->emptyDir(DirectoryList::GENERATION); + return array_merge($this->emptyDir(DirectoryList::GENERATION), $this->emptyDir(DirectoryList::DI)); } /** @@ -99,7 +99,7 @@ class CleanupFiles return $messages; } foreach ($dir->search('*', $subPath) as $path) { - if (false === strpos($path, '.')) { + if ($path !== '.' && $path !== '..') { $messages[] = $dirPath . $path; try { $dir->delete($path); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php b/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php index f1290dcc139bc8bef9d1efff92947d1e2f5d6a11..b9187b39772e1f7a7d850cea03026db8ce983459 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php @@ -31,11 +31,18 @@ class CleanupFilesTest extends \PHPUnit_Framework_TestCase public function testClearCodeGeneratedClasses() { - $dir = $this->getDirectoryCleanMock(); - $this->filesystem->expects($this->once()) + $dir1 = $this->getDirectoryCleanMock(); + $dir2 = $this->getDirectoryCleanMock(); + $this->filesystem->expects($this->exactly(2)) ->method('getDirectoryWrite') - ->with(DirectoryList::GENERATION) - ->willReturn($dir); + ->will( + $this->returnValueMap( + [ + [DirectoryList::GENERATION, DriverPool::FILE, $dir1], + [DirectoryList::DI, DriverPool::FILE, $dir2], + ] + ) + ); $this->object->clearCodeGeneratedClasses(); } diff --git a/lib/internal/Magento/Framework/Setup/BackupRollback.php b/lib/internal/Magento/Framework/Setup/BackupRollback.php index e8b4df2c95b36226b477fe8deb895c7916d77252..ae3464ae3ca9ff6b41be9746a3f89f26d5baf8e3 100644 --- a/lib/internal/Magento/Framework/Setup/BackupRollback.php +++ b/lib/internal/Magento/Framework/Setup/BackupRollback.php @@ -263,8 +263,8 @@ class BackupRollback /** @var \Magento\Framework\App\State $appState */ $appState = $this->objectManager->get('Magento\Framework\App\State'); $appState->setAreaCode($areaCode); - /** @var \Magento\Framework\App\ObjectManager\ConfigLoader $configLoader */ - $configLoader = $this->objectManager->get('Magento\Framework\App\ObjectManager\ConfigLoader'); + /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */ + $configLoader = $this->objectManager->get('Magento\Framework\ObjectManager\ConfigLoaderInterface'); $this->objectManager->configure($configLoader->load($areaCode)); } diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php index 23be7d192109993a2da1c32d6173884e97e8a1d4..dbcd9a28a90b712a158a877c21d12eec3c7a21d3 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php @@ -83,7 +83,7 @@ class BackupRollbackTest extends \PHPUnit_Framework_TestCase ->method('get') ->will($this->returnValueMap([ ['Magento\Framework\App\State', $this->getMock('Magento\Framework\App\State', [], [], '', false)], - ['Magento\Framework\App\ObjectManager\ConfigLoader', $configLoader], + ['Magento\Framework\ObjectManager\ConfigLoaderInterface', $configLoader], ])); $this->objectManager->expects($this->any()) ->method('create') diff --git a/setup/config/states.disable.config.php b/setup/config/states.disable.config.php new file mode 100644 index 0000000000000000000000000000000000000000..68be2c6193ad29ce080768dc042027835d865467 --- /dev/null +++ b/setup/config/states.disable.config.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +$base = basename($_SERVER['SCRIPT_FILENAME']); + +return [ + 'navUpdaterTitles' => [ + 'disable' => 'Disable ', + ], + 'navUpdater' => [ + [ + 'id' => 'root.readiness-check-disable', + 'url' => 'readiness-check-disable', + 'templateUrl' => "{$base}/readiness-check-updater", + 'title' => "Readiness \n Check", + 'header' => 'Step 1: Readiness Check', + 'nav' => true, + 'order' => 2, + 'type' => 'disable' + ], + [ + 'id' => 'root.readiness-check-disable.progress', + 'url' => 'readiness-check-disable/progress', + 'templateUrl' => "$base/readiness-check-updater/progress", + 'title' => 'Readiness Check', + 'header' => 'Step 1: Readiness Check', + 'controller' => 'readinessCheckController', + 'nav' => false, + 'order' => 3, + 'type' => 'disable' + ], + [ + 'id' => 'root.create-backup-disable', + 'url' => 'create-backup', + 'templateUrl' => "$base/create-backup", + 'title' => "Create \n Backup", + 'header' => 'Step 2: Create Backup', + 'controller' => 'createBackupController', + 'nav' => true, + 'validate' => true, + 'order' => 4, + 'type' => 'disable' + ], + [ + 'id' => 'root.create-backup-disable.progress', + 'url' => 'create-backup/progress', + 'templateUrl' => "$base/complete-backup/progress", + 'title' => "Create \n Backup", + 'header' => 'Step 2: Create Backup', + 'controller' => 'completeBackupController', + 'nav' => false, + 'order' => 5, + 'type' => 'disable' + ], + [ + 'id' => 'root.start-updater-disable', + 'url' => 'disable', + 'templateUrl' => "$base/start-updater", + 'title' => "Disable", + 'controller' => 'startUpdaterController', + 'header' => 'Step 3: Disable', + 'nav' => true, + 'order' => 6, + 'type' => 'disable' + ], + [ + 'id' => 'root.disable-success', + 'url' => 'disable-success', + 'templateUrl' => "$base/updater-success", + 'controller' => 'updaterSuccessController', + 'order' => 7, + 'main' => true, + 'noMenu' => true + ], + ], +]; diff --git a/setup/config/states.enable.config.php b/setup/config/states.enable.config.php new file mode 100644 index 0000000000000000000000000000000000000000..b019ea139440f506b52ec8033d9657f85231c1b4 --- /dev/null +++ b/setup/config/states.enable.config.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +$base = basename($_SERVER['SCRIPT_FILENAME']); + +return [ + 'navUpdaterTitles' => [ + 'enable' => 'Enable ', + ], + 'navUpdater' => [ + [ + 'id' => 'root.readiness-check-enable', + 'url' => 'readiness-check-enable', + 'templateUrl' => "{$base}/readiness-check-updater", + 'title' => "Readiness \n Check", + 'header' => 'Step 1: Readiness Check', + 'nav' => true, + 'order' => 2, + 'type' => 'enable' + ], + [ + 'id' => 'root.readiness-check-enable.progress', + 'url' => 'readiness-check-enable/progress', + 'templateUrl' => "$base/readiness-check-updater/progress", + 'title' => 'Readiness Check', + 'header' => 'Step 1: Readiness Check', + 'controller' => 'readinessCheckController', + 'nav' => false, + 'order' => 3, + 'type' => 'enable' + ], + [ + 'id' => 'root.create-backup-enable', + 'url' => 'create-backup', + 'templateUrl' => "$base/create-backup", + 'title' => "Create \n Backup", + 'header' => 'Step 2: Create Backup', + 'controller' => 'createBackupController', + 'nav' => true, + 'validate' => true, + 'order' => 4, + 'type' => 'enable' + ], + [ + 'id' => 'root.create-backup-enable.progress', + 'url' => 'create-backup/progress', + 'templateUrl' => "$base/complete-backup/progress", + 'title' => "Create \n Backup", + 'header' => 'Step 2: Create Backup', + 'controller' => 'completeBackupController', + 'nav' => false, + 'order' => 5, + 'type' => 'enable' + ], + [ + 'id' => 'root.start-updater-enable', + 'url' => 'enable', + 'templateUrl' => "$base/start-updater", + 'title' => "Enable Module", + 'controller' => 'startUpdaterController', + 'header' => 'Step 3: Enable Module', + 'nav' => true, + 'order' => 6, + 'type' => 'enable' + ], + [ + 'id' => 'root.enable-success', + 'url' => 'enable-success', + 'templateUrl' => "$base/updater-success", + 'controller' => 'updaterSuccessController', + 'order' => 7, + 'main' => true, + 'noMenu' => true + ], + ], +]; diff --git a/setup/config/states.uninstall.config.php b/setup/config/states.uninstall.config.php index 726ecce7ca1475807d2a0f053373a1071addfb56..fa9bfcf9d6d6e5d35b3d84c19ae3da30e40d35d9 100644 --- a/setup/config/states.uninstall.config.php +++ b/setup/config/states.uninstall.config.php @@ -59,15 +59,15 @@ return [ 'id' => 'root.data-option', 'url' => 'data-option', 'templateUrl' => "$base/data-option", - 'title' => "Data \n Option", + 'title' => "Remove or \n Keep Data", 'controller' => 'dataOptionController', - 'header' => 'Step 3: Data Option', + 'header' => 'Step 3: Remove or Keep Data', 'nav' => true, 'order' => 6, 'type' => 'uninstall' ], [ - 'id' => 'root.uninstall', + 'id' => 'root.start-updater-uninstall', 'url' => 'uninstall', 'templateUrl' => "$base/start-updater", 'title' => "Uninstall", diff --git a/setup/pub/magento/setup/component-grid.js b/setup/pub/magento/setup/component-grid.js index 7ab76cf0592e2fe2dacbbef28d33b56cb29a9f67..33f1055f9733b230123245ae3cf431bdfe079b13 100644 --- a/setup/pub/magento/setup/component-grid.js +++ b/setup/pub/magento/setup/component-grid.js @@ -83,6 +83,8 @@ angular.module('component-grid', ['ngStorage']) if ($scope.isAvailableUpdatePackage(component.name)) { return indicators.info[type]; + } else if(component.disable === true) { + return indicators.off[type]; } return indicators.on[type]; }; @@ -115,6 +117,23 @@ angular.module('component-grid', ['ngStorage']) $state.go('root.readiness-check-uninstall'); }; + $scope.enableDisable = function(type, component) { + if (component.type.indexOf('module') >= 0 ) { + $localStorage.packages = [ + { + name: component.moduleName + } + ]; + if ($localStorage.titles[type].indexOf(component.moduleName) < 0 ) { + $localStorage.titles[type] = type.charAt(0).toUpperCase() + type.slice(1) + ' ' + + component.moduleName; + } + $localStorage.componentType = component.type; + $localStorage.moduleName = component.moduleName; + $state.go('root.readiness-check-'+type); + } + }; + $scope.convertDate = function(date) { return new Date(date); } diff --git a/setup/pub/magento/setup/create-backup.js b/setup/pub/magento/setup/create-backup.js index 66547e1c31bd546978e94cb2706e7c536f4108db..31a08c930ddfb5d12396b81dc092e38bf4b79d65 100644 --- a/setup/pub/magento/setup/create-backup.js +++ b/setup/pub/magento/setup/create-backup.js @@ -33,12 +33,10 @@ angular.module('create-backup', ['ngStorage']) }; $scope.goToStartUpdater = function () { - if ($state.current.type === 'update') { - $state.go('root.start-updater-update'); - } else if ($state.current.type === 'upgrade') { - $state.go('root.start-updater-upgrade'); - } else if ($state.current.type === 'uninstall') { + if ($state.current.type === 'uninstall') { $state.go('root.data-option'); + } else { + $state.go('root.start-updater-' + $state.current.type); } } diff --git a/setup/pub/magento/setup/readiness-check.js b/setup/pub/magento/setup/readiness-check.js index 451c380b18688d9fd295def285f52b57afe45c6d..fbbbdf1540e6d6d93fb2c58bad9c4e10c342422e 100644 --- a/setup/pub/magento/setup/readiness-check.js +++ b/setup/pub/magento/setup/readiness-check.js @@ -13,11 +13,37 @@ angular.module('readiness-check', []) $scope.startProgress = function() { ++$scope.progressCounter; }; - if ($state.current.type !== 'uninstall') { - $scope.dependencyUrl = 'index.php/environment/component-dependency'; - } else { - $scope.dependencyUrl = 'index.php/environment/uninstall-dependency-check'; + $scope.componentDependency = { + visible: false, + processed: false, + expanded: false, + isRequestError: false, + errorMessage: '', + packages: null }; + switch ($state.current.type) { + case 'uninstall': + $scope.dependencyUrl = 'index.php/environment/uninstall-dependency-check'; + if ($localStorage.packages) { + $scope.componentDependency.packages = $localStorage.packages; + } + break; + case 'enable': + case 'disable': + $scope.dependencyUrl = 'index.php/environment/enable-disable-dependency-check'; + if ($localStorage.packages) { + $scope.componentDependency.packages = { + type: $state.current.type, + packages: $localStorage.packages + }; + } + break; + default: + $scope.dependencyUrl = 'index.php/environment/component-dependency'; + if ($localStorage.packages) { + $scope.componentDependency.packages = $localStorage.packages; + } + } $scope.stopProgress = function() { --$scope.progressCounter; if ($scope.progressCounter == COUNTER) { @@ -37,7 +63,6 @@ angular.module('readiness-check', []) $rootScope.hasErrors = true; $scope.stopProgress(); }; - $scope.completed = false; $scope.hasErrors = false; @@ -82,17 +107,6 @@ angular.module('readiness-check', []) setupNoticeMessage: '', updaterNoticeMessage: '' }; - $scope.componentDependency = { - visible: false, - processed: false, - expanded: false, - isRequestError: false, - errorMessage: '', - packages: null - }; - if ($localStorage.packages) { - $scope.componentDependency.packages = $localStorage.packages; - } $scope.items = { 'php-version': { url:'index.php/environment/php-version', diff --git a/setup/pub/magento/setup/start-updater.js b/setup/pub/magento/setup/start-updater.js index 57cab0fe5a4c8ce401481bb31f658da562021c34..f67b2c414c8a901c1f5bef16ea245f24bd60cfbf 100644 --- a/setup/pub/magento/setup/start-updater.js +++ b/setup/pub/magento/setup/start-updater.js @@ -64,12 +64,10 @@ angular.module('start-updater', ['ngStorage']) }); } $scope.goToPreviousState = function() { - if ($state.current.type === 'update') { - $state.go('root.create-backup-update'); - } else if ($state.current.type === 'upgrade') { - $state.go('root.create-backup-upgrade'); - } else if ($state.current.type === 'uninstall') { + if ($state.current.type === 'uninstall') { $state.go('root.data-option'); + } else { + $state.go('root.create-backup-' + $state.current.type); } } }]); diff --git a/setup/pub/magento/setup/success.js b/setup/pub/magento/setup/success.js index a7581e40de2429fd9a96c7f526c273ac4d0492b8..b5996ef3242cbd1ed67e16f25c2b8c15f8920e1c 100644 --- a/setup/pub/magento/setup/success.js +++ b/setup/pub/magento/setup/success.js @@ -25,4 +25,6 @@ angular.module('success', ['ngStorage']) } $scope.messages = $localStorage.messages; $localStorage.$reset(); + $scope.admin.password = ''; + $scope.db.password = ''; }]); diff --git a/setup/src/Magento/Setup/Console/Command/AbstractModuleCommand.php b/setup/src/Magento/Setup/Console/Command/AbstractModuleCommand.php index dd75e0392ebaafa4f6e17966895cc7b7e85fc56c..4dacaa2e3a7688f260e9a7b21e120334d52e9fbd 100644 --- a/setup/src/Magento/Setup/Console/Command/AbstractModuleCommand.php +++ b/setup/src/Magento/Setup/Console/Command/AbstractModuleCommand.php @@ -84,15 +84,14 @@ abstract class AbstractModuleCommand extends AbstractSetupCommand /** @var \Magento\Framework\App\State\CleanupFiles $cleanupFiles */ $cleanupFiles = $this->objectManager->get('Magento\Framework\App\State\CleanupFiles'); $cleanupFiles->clearCodeGeneratedClasses(); - $output->writeln('<info>Generated classes cleared successfully.</info>'); + $output->writeln('<info>Generated classes cleared successfully. Please re-run Magento compile command</info>'); if ($input->getOption(self::INPUT_KEY_CLEAR_STATIC_CONTENT)) { $cleanupFiles->clearMaterializedViewFiles(); $output->writeln('<info>Generated static view files cleared successfully.</info>'); } else { $output->writeln( - '<error>Alert: Generated static view files were not cleared.' - . ' You can clear them using the --' . self::INPUT_KEY_CLEAR_STATIC_CONTENT . ' option.' - . ' Failure to clear static view files might cause display issues in the Admin and storefront.</error>' + '<info>Info: Some modules might require static view files to be cleared. Use the optional --' . + self::INPUT_KEY_CLEAR_STATIC_CONTENT . ' option to clear them.</info>' ); } } diff --git a/setup/src/Magento/Setup/Console/Command/AbstractModuleManageCommand.php b/setup/src/Magento/Setup/Console/Command/AbstractModuleManageCommand.php index 644ee7dbcfa7b8d2bc0b1a420bd0fa5683d994d3..9264ae87da061abe9cbbbd442cf02627fac6ea9d 100644 --- a/setup/src/Magento/Setup/Console/Command/AbstractModuleManageCommand.php +++ b/setup/src/Magento/Setup/Console/Command/AbstractModuleManageCommand.php @@ -82,7 +82,7 @@ abstract class AbstractModuleManageCommand extends AbstractModuleCommand $output->writeln( "<error>Unable to change status of modules because of the following constraints:</error>" ); - $output->writeln('<error>' . implode("\n", $constraints) . '</error>'); + $output->writeln('<error>' . implode("</error>\n<error>", $constraints) . '</error>'); return; } } diff --git a/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php index 7197865542cd53c7d110166fceb0d815b55cfc9c..e5605051d48d7c0f01b14ea9bf60b9869bc0d812 100644 --- a/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php +++ b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php @@ -54,5 +54,6 @@ class UpgradeCommand extends AbstractSetupCommand $installer->updateModulesSequence(); $installer->installSchema(); $installer->installDataFixtures(); + $output->writeln('<info>Please re-run Magento compile command</info>'); } } diff --git a/setup/src/Magento/Setup/Controller/ComponentGrid.php b/setup/src/Magento/Setup/Controller/ComponentGrid.php index e94f06c94183383da408ca1641ba97b45f775193..cb68dc558aaa114ce9059b112229fea55a0e07d1 100644 --- a/setup/src/Magento/Setup/Controller/ComponentGrid.php +++ b/setup/src/Magento/Setup/Controller/ComponentGrid.php @@ -7,6 +7,8 @@ namespace Magento\Setup\Controller; use Magento\Framework\Composer\ComposerInformation; +use Magento\Framework\Module\FullModuleList; +use Magento\Framework\Module\ModuleList; use Magento\Framework\Module\PackageInfo; use Magento\Setup\Model\ObjectManagerProvider; use Zend\Mvc\Controller\AbstractActionController; @@ -20,33 +22,50 @@ use Magento\Setup\Model\UpdatePackagesCache; class ComponentGrid extends AbstractActionController { /** - * @var ComposerInformation + * @var \Magento\Framework\Composer\ComposerInformation */ private $composerInformation; /** * Module package info * - * @var PackageInfo + * @var \Magento\Framework\Module\PackageInfo */ private $packageInfo; /** - * @var UpdatePackagesCache + * Enabled Module info + * + * @var \Magento\Framework\Module\ModuleList + */ + private $enabledModuleList; + + /** + * Full Module info + * + * @var \Magento\Framework\Module\FullModuleList + */ + private $fullModuleList; + + /** + * @var \Magento\Setup\Model\UpdatePackagesCache */ private $updatePackagesCache; /** - * @param ComposerInformation $composerInformation - * @param ObjectManagerProvider $objectManagerProvider - * @param UpdatePackagesCache $updatePackagesCache + * @param \Magento\Framework\Composer\ComposerInformation $composerInformation + * @param \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider + * @param \Magento\Setup\Model\UpdatePackagesCache $updatePackagesCache */ public function __construct( - ComposerInformation $composerInformation, - ObjectManagerProvider $objectManagerProvider, - UpdatePackagesCache $updatePackagesCache + \Magento\Framework\Composer\ComposerInformation $composerInformation, + \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider, + \Magento\Setup\Model\UpdatePackagesCache $updatePackagesCache ) { $this->composerInformation = $composerInformation; + $objectManager = $objectManagerProvider->get(); + $this->enabledModuleList = $objectManager->get('Magento\Framework\Module\ModuleList'); + $this->fullModuleList = $objectManager->get('Magento\Framework\Module\FullModuleList'); $this->packageInfo = $objectManagerProvider->get() ->get('Magento\Framework\Module\PackageInfoFactory')->create(); $this->updatePackagesCache = $updatePackagesCache; @@ -74,11 +93,15 @@ class ComponentGrid extends AbstractActionController { $lastSyncData = $this->updatePackagesCache->getPackagesForUpdate(); $components = $this->composerInformation->getInstalledMagentoPackages(); + $allModules = $this->getAllModules(); + $components = array_replace_recursive($components, $allModules); foreach ($components as $component) { $components[$component['name']]['update'] = false; $components[$component['name']]['uninstall'] = false; + $components[$component['name']]['moduleName'] = $this->packageInfo->getModuleName($component['name']); if ($this->composerInformation->isPackageInComposerJson($component['name']) && ($component['type'] !== ComposerInformation::METAPACKAGE_PACKAGE_TYPE)) { + $components[$component['name']]['uninstall'] = true; if (isset($lastSyncData['packages'][$component['name']]['latestVersion']) && version_compare( $lastSyncData['packages'][$component['name']]['latestVersion'], @@ -86,14 +109,18 @@ class ComponentGrid extends AbstractActionController '>' )) { $components[$component['name']]['update'] = true; - $components[$component['name']]['uninstall'] = true; - } else { - $components[$component['name']]['uninstall'] = true; } } + if ($component['type'] === ComposerInformation::MODULE_PACKAGE_TYPE) { + $components[$component['name']]['enable'] = + $this->enabledModuleList->has($components[$component['name']]['moduleName']); + $components[$component['name']]['disable'] = !$components[$component['name']]['enable']; + } else { + $components[$component['name']]['enable'] = false; + $components[$component['name']]['disable'] = false; + } $componentNameParts = explode('/', $component['name']); $components[$component['name']]['vendor'] = $componentNameParts[0]; - $components[$component['name']]['moduleName'] = $this->packageInfo->getModuleName($component['name']); } return new JsonModel( [ @@ -121,4 +148,22 @@ class ComponentGrid extends AbstractActionController ] ); } + + /** + * Get full list of modules as an associative array + * + * @return array + */ + private function getAllModules() + { + $modules = []; + $allModules = $this->fullModuleList->getNames(); + foreach ($allModules as $module) { + $moduleName = $this->packageInfo->getPackageName($module); + $modules[$moduleName]['name'] = $moduleName; + $modules[$moduleName]['type'] = ComposerInformation::MODULE_PACKAGE_TYPE; + $modules[$moduleName]['version'] = $this->packageInfo->getVersion($module); + } + return $modules; + } } diff --git a/setup/src/Magento/Setup/Controller/CustomizeYourStore.php b/setup/src/Magento/Setup/Controller/CustomizeYourStore.php index 34d8ca58eb95b48050980066f5d89bf57447ea3a..fe24ddcd5e586cf03eeb205348fb1963e370f410 100644 --- a/setup/src/Magento/Setup/Controller/CustomizeYourStore.php +++ b/setup/src/Magento/Setup/Controller/CustomizeYourStore.php @@ -5,32 +5,42 @@ */ namespace Magento\Setup\Controller; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Filesystem; +use Magento\Framework\Module\ModuleList; use Magento\Framework\Setup\Lists; -use Magento\Setup\Model\SampleData; +use Magento\Setup\Model\ObjectManagerProvider; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; use Zend\View\Model\JsonModel; class CustomizeYourStore extends AbstractActionController { + /** + * @var ModuleList + */ + protected $moduleList; + /** * @var Lists */ protected $list; /** - * @var SampleData + * @var ObjectManagerProvider */ - protected $sampleData; + protected $objectManagerProvider; /** + * @param ModuleList $moduleList * @param Lists $list - * @param SampleData $sampleData + * @param ObjectManagerProvider $objectManagerProvider */ - public function __construct(Lists $list, SampleData $sampleData) + public function __construct(ModuleList $moduleList, Lists $list, ObjectManagerProvider $objectManagerProvider) { + $this->moduleList = $moduleList; $this->list = $list; - $this->sampleData = $sampleData; + $this->objectManagerProvider = $objectManagerProvider; } /** @@ -38,13 +48,24 @@ class CustomizeYourStore extends AbstractActionController */ public function indexAction() { + $sampleDataDeployed = $this->moduleList->has('Magento_SampleData'); + if ($sampleDataDeployed) { + /** @var \Magento\SampleData\Model\SampleData $sampleData */ + $sampleData = $this->objectManagerProvider->get()->get('Magento\SampleData\Model\SampleData'); + $isSampleDataInstalled = $sampleData->isInstalledSuccessfully(); + $isSampleDataErrorInstallation = $sampleData->isInstallationError(); + } else { + $isSampleDataInstalled = false; + $isSampleDataErrorInstallation = false; + } + $view = new ViewModel([ 'timezone' => $this->list->getTimezoneList(), 'currency' => $this->list->getCurrencyList(), 'language' => $this->list->getLocaleList(), - 'isSampledataEnabled' => $this->sampleData->isDeployed(), - 'isSampleDataInstalled' => $this->sampleData->isInstalledSuccessfully(), - 'isSampleDataErrorInstallation' => $this->sampleData->isInstallationError() + 'isSampledataEnabled' => $sampleDataDeployed, + 'isSampleDataInstalled' => $isSampleDataInstalled, + 'isSampleDataErrorInstallation' => $isSampleDataErrorInstallation ]); $view->setTerminal(true); return $view; diff --git a/setup/src/Magento/Setup/Controller/Environment.php b/setup/src/Magento/Setup/Controller/Environment.php index 44f26361c7ae2c5753b0c14e00fea3d6c6ed3cd1..57c8a509abadf2ca6ce2d64f69ebf397d56959b9 100644 --- a/setup/src/Magento/Setup/Controller/Environment.php +++ b/setup/src/Magento/Setup/Controller/Environment.php @@ -16,6 +16,8 @@ use Zend\View\Model\JsonModel; use Magento\Setup\Model\FilePermissions; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem; +use Magento\Setup\Model\ModuleStatusFactory; +use Magento\Framework\Module\Status; /** * Class Environment @@ -66,6 +68,13 @@ class Environment extends AbstractActionController */ protected $phpReadinessCheck; + /** + * Module/Status Object + * + * @var Status + */ + protected $moduleStatus; + /** * Constructor * @@ -75,6 +84,7 @@ class Environment extends AbstractActionController * @param DependencyReadinessCheck $dependencyReadinessCheck * @param UninstallDependencyCheck $uninstallDependencyCheck * @param PhpReadinessCheck $phpReadinessCheck + * @param ModuleStatusFactory $moduleStatusFactory */ public function __construct( FilePermissions $permissions, @@ -82,7 +92,8 @@ class Environment extends AbstractActionController CronScriptReadinessCheck $cronScriptReadinessCheck, DependencyReadinessCheck $dependencyReadinessCheck, UninstallDependencyCheck $uninstallDependencyCheck, - PhpReadinessCheck $phpReadinessCheck + PhpReadinessCheck $phpReadinessCheck, + ModuleStatusFactory $moduleStatusFactory ) { $this->permissions = $permissions; $this->filesystem = $filesystem; @@ -90,6 +101,7 @@ class Environment extends AbstractActionController $this->dependencyReadinessCheck = $dependencyReadinessCheck; $this->uninstallDependencyCheck = $uninstallDependencyCheck; $this->phpReadinessCheck = $phpReadinessCheck; + $this->moduleStatus = $moduleStatusFactory->create(); } /** @@ -285,4 +297,53 @@ class Environment extends AbstractActionController $data['responseType'] = $responseType; return new JsonModel($data); } + + /** + * Verifies component dependency for enable/disable actions + * + * @return JsonModel + */ + public function enableDisableDependencyCheckAction() + { + $responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS; + $data = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); + + try { + if (empty($data['packages'])) { + throw new \Exception('No packages have been found.'); + } + + if (empty($data['type'])) { + throw new \Exception('Can not determine the flow.'); + } + + $modules = $data['packages']; + + $isEnable = ($data['type'] !== 'disable'); + + $modulesToChange = []; + foreach ($modules as $module) { + if (!isset($module['name'])) { + throw new \Exception('Can not find module name.'); + } + $modulesToChange[] = $module['name']; + } + + $constraints = $this->moduleStatus->checkConstraints($isEnable, $modulesToChange); + $data = []; + + if ($constraints) { + $data['errorMessage'] = "Unable to change status of modules because of the following constraints: " + . implode("<br>", $constraints); + $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR; + } + + } catch (\Exception $e) { + $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR; + $data['errorMessage'] = $e->getMessage(); + } + + $data['responseType'] = $responseType; + return new JsonModel($data); + } } diff --git a/setup/src/Magento/Setup/Controller/StartUpdater.php b/setup/src/Magento/Setup/Controller/StartUpdater.php index da4f1c351780330b762a8fa085ab3e2286e9d852..b55e16a738b09d7f7f203de0e0137674b394fe9d 100644 --- a/setup/src/Magento/Setup/Controller/StartUpdater.php +++ b/setup/src/Magento/Setup/Controller/StartUpdater.php @@ -7,10 +7,11 @@ namespace Magento\Setup\Controller; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Module\FullModuleList; use Magento\Setup\Model\Cron\JobComponentUninstall; use Zend\Json\Json; use Zend\Mvc\Controller\AbstractActionController; -use Magento\Setup\Model\Updater as ModelUpdater; +use Magento\Setup\Model\Updater; use Zend\View\Model\JsonModel; use Zend\View\Model\ViewModel; @@ -41,23 +42,31 @@ class StartUpdater extends AbstractActionController private $navigation; /** - * @var ModelUpdater + * @var \Magento\Setup\Model\Updater */ private $updater; + /** + * @var \Magento\Framework\Module\FullModuleList + */ + private $moduleList; + /** * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Setup\Model\Navigation $navigation - * @param ModelUpdater $updater + * @param \Magento\Setup\Model\Updater $updater + * @param \Magento\Framework\Module\FullModuleList $moduleList */ public function __construct( \Magento\Framework\Filesystem $filesystem, \Magento\Setup\Model\Navigation $navigation, - ModelUpdater $updater + \Magento\Setup\Model\Updater $updater, + \Magento\Framework\Module\FullModuleList $moduleList ) { $this->filesystem = $filesystem; $this->navigation = $navigation; $this->updater = $updater; + $this->moduleList = $moduleList; } /** @@ -90,20 +99,26 @@ class StartUpdater extends AbstractActionController $packages = $postPayload[self::KEY_POST_PACKAGES]; $jobType = $postPayload[self::KEY_POST_JOB_TYPE]; $this->createTypeFlag($jobType, $postPayload[self::KEY_POST_HEADER_TITLE]); + $additionalOptions = []; - if ($jobType == 'uninstall') { - $additionalOptions = [ - JobComponentUninstall::DATA_OPTION => $postPayload[self::KEY_POST_DATA_OPTION] - ]; - $cronTaskType = \Magento\Setup\Model\Cron\JobFactory::COMPONENT_UNINSTALL; - } else { - $cronTaskType = ModelUpdater::TASK_TYPE_UPDATE; - } + $cronTaskType = ''; + $this->getCronTaskConfigInfo($jobType, $postPayload, $additionalOptions, $cronTaskType); + $errorMessage .= $this->updater->createUpdaterTask( $packages, $cronTaskType, $additionalOptions ); + + // for module enable job types, we need to follow up with 'setup:upgrade' task to + // make sure enabled modules are properly registered + if ($jobType == 'enable') { + $errorMessage .= $this->updater->createUpdaterTask( + [], + \Magento\Setup\Model\Cron\JobFactory::JOB_UPGRADE, + [] + ); + } } } else { $errorMessage .= 'Invalid request'; @@ -120,16 +135,52 @@ class StartUpdater extends AbstractActionController */ private function validatePayload(array $postPayload) { - $errorMessage = ''; - $packages = $postPayload[self::KEY_POST_PACKAGES]; $jobType = $postPayload[self::KEY_POST_JOB_TYPE]; - if ($jobType == 'uninstall' && !isset($postPayload[self::KEY_POST_DATA_OPTION])) { - $errorMessage .= 'Missing dataOption' . PHP_EOL; + $errorMessage = ''; + switch($jobType) { + case 'uninstall': + $errorMessage = $this->validateUninstallPayload($postPayload); + break; + + case 'update': + $errorMessage = $this->validateUpdatePayload($postPayload); + break; + + case 'enable': + case 'disable': + $errorMessage = $this->validateEnableDisablePayload($postPayload); + break; } + return $errorMessage; + } + + /** + * Validate 'uninstall' job type payload + * + * @param array $postPayload + * @return string + */ + private function validateUninstallPayload(array $postPayload) + { + $errorMessage = ''; + if (!isset($postPayload[self::KEY_POST_DATA_OPTION])) { + $errorMessage = 'Missing dataOption' . PHP_EOL; + } + return $errorMessage; + } + + /** + * Validate 'update' job type payload + * + * @param array $postPayload + * @return string + */ + private function validateUpdatePayload(array $postPayload) + { + $errorMessage = ''; + $packages = $postPayload[self::KEY_POST_PACKAGES]; foreach ($packages as $package) { - if (!isset($package[self::KEY_POST_PACKAGE_NAME]) - || ($jobType != 'uninstall' && !isset($package[self::KEY_POST_PACKAGE_VERSION])) - ) { + if ((!isset($package[self::KEY_POST_PACKAGE_NAME])) || (!isset($package[self::KEY_POST_PACKAGE_VERSION]))) { $errorMessage .= 'Missing package information' . PHP_EOL; break; } @@ -137,6 +188,25 @@ class StartUpdater extends AbstractActionController return $errorMessage; } + /** + * Validate 'enable/disable' job type payload + * + * @param array $postPayload + * @return string + */ + private function validateEnableDisablePayload(array $postPayload) + { + $errorMessage = ''; + $packages = $postPayload[self::KEY_POST_PACKAGES]; + foreach ($packages as $package) { + if (!$this->moduleList->has($package[self::KEY_POST_PACKAGE_NAME])) { + $errorMessage .= 'Invalid Magento module name: ' . $package[self::KEY_POST_PACKAGE_NAME] . PHP_EOL; + break; + } + } + return $errorMessage; + } + /** * Create flag to be used in Updater * @@ -161,4 +231,39 @@ class StartUpdater extends AbstractActionController $directoryWrite = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR); $directoryWrite->writeFile('.type.json', Json::encode($data)); } + + /** + * Returns cron config info based on passed in job type + * + * @param string $jobType + * @param array $postPayload + * @param array $addtionalOptions + * @param string $cronTaskType + * @return void + */ + private function getCronTaskConfigInfo($jobType, $postPayload, &$additionalOptions, &$cronTaskType) + { + $additionalOptions = []; + switch($jobType) { + case 'uninstall': + $additionalOptions = [ + JobComponentUninstall::DATA_OPTION => $postPayload[self::KEY_POST_DATA_OPTION] + ]; + $cronTaskType = \Magento\Setup\Model\Cron\JobFactory::JOB_COMPONENT_UNINSTALL; + break; + + case 'upgrade': + case 'update': + $cronTaskType = \Magento\Setup\Model\Updater::TASK_TYPE_UPDATE; + break; + + case 'enable': + $cronTaskType = \Magento\Setup\Model\Cron\JobFactory::JOB_MODULE_ENABLE; + break; + + case 'disable': + $cronTaskType = \Magento\Setup\Model\Cron\JobFactory::JOB_MODULE_DISABLE; + break; + } + } } diff --git a/setup/src/Magento/Setup/Controller/Success.php b/setup/src/Magento/Setup/Controller/Success.php index 02c7b4750982d58c5bb6c5ac7cfaf50a59e977ef..5bb2dd9f6e056e5ba9640a64fe868a11ff0ddaf2 100644 --- a/setup/src/Magento/Setup/Controller/Success.php +++ b/setup/src/Magento/Setup/Controller/Success.php @@ -5,23 +5,31 @@ */ namespace Magento\Setup\Controller; +use Magento\Framework\Module\ModuleList; +use Magento\Setup\Model\ObjectManagerProvider; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; -use Magento\Setup\Model\SampleData; class Success extends AbstractActionController { /** - * @var SampleData + * @var ModuleList */ - protected $sampleData; + protected $moduleList; /** - * @param SampleData $sampleData + * @var ObjectManagerProvider */ - public function __construct(SampleData $sampleData) + protected $objectManagerProvider; + + /** + * @param ModuleList $moduleList + * @param ObjectManagerProvider $objectManagerProvider + */ + public function __construct(ModuleList $moduleList, ObjectManagerProvider $objectManagerProvider) { - $this->sampleData = $sampleData; + $this->moduleList = $moduleList; + $this->objectManagerProvider = $objectManagerProvider; } /** @@ -29,8 +37,15 @@ class Success extends AbstractActionController */ public function indexAction() { + if ($this->moduleList->has('Magento_SampleData')) { + /** @var \Magento\SampleData\Model\SampleData $sampleData */ + $sampleData = $this->objectManagerProvider->get()->get('Magento\SampleData\Model\SampleData'); + $isSampleDataErrorInstallation = $sampleData->isInstallationError(); + } else { + $isSampleDataErrorInstallation = false; + } $view = new ViewModel([ - 'isSampleDataErrorInstallation' => $this->sampleData->isInstallationError() + 'isSampleDataErrorInstallation' => $isSampleDataErrorInstallation ]); $view->setTerminal(true); return $view; diff --git a/setup/src/Magento/Setup/Fixtures/FixtureModel.php b/setup/src/Magento/Setup/Fixtures/FixtureModel.php index a51eb57d44e42b5107cee8a0b776f6b071441170..9c3c3f424d2d9d1f96f443eaf4e8f436be444a61 100644 --- a/setup/src/Magento/Setup/Fixtures/FixtureModel.php +++ b/setup/src/Magento/Setup/Fixtures/FixtureModel.php @@ -171,9 +171,12 @@ class FixtureModel */ public function initObjectManager() { - $this->getObjectManager()->configure( - $this->getObjectManager()->get('Magento\Framework\App\ObjectManager\ConfigLoader')->load(self::AREA_CODE) - ); + $this->getObjectManager() + ->configure( + $this->getObjectManager() + ->get('Magento\Framework\ObjectManager\ConfigLoaderInterface') + ->load(self::AREA_CODE) + ); $this->getObjectManager()->get('Magento\Framework\Config\ScopeInterface')->setCurrentScope(self::AREA_CODE); return $this; } diff --git a/setup/src/Magento/Setup/Model/Cron/AbstractJob.php b/setup/src/Magento/Setup/Model/Cron/AbstractJob.php index 55945296a048f8b0086bbaf5cd0e52e3360fde2b..a1f356cb3c7ed037b91cbfe4d2e4b0b8e862f202 100644 --- a/setup/src/Magento/Setup/Model/Cron/AbstractJob.php +++ b/setup/src/Magento/Setup/Model/Cron/AbstractJob.php @@ -7,6 +7,8 @@ namespace Magento\Setup\Model\Cron; use Magento\Setup\Console\Command\AbstractSetupCommand; use Symfony\Component\Console\Output\OutputInterface; +use Magento\Framework\App\Cache; +use Magento\Setup\Model\ObjectManagerProvider; /** * Abstract class for jobs run by setup:cron:run command @@ -33,21 +35,46 @@ abstract class AbstractJob */ protected $params; + /** + * @var \Magento\Framework\App\Cache + */ + protected $cache; + + /** + * @var \Magento\Framework\App\State\CleanupFiles + */ + protected $cleanupFiles; + + /** + * @var Status + */ + protected $status; + /** * Constructor * * @param OutputInterface $output * @param Status $status + * @param ObjectManagerProvider $objectManagerProvider * @param string $name * @param array $params */ - public function __construct(OutputInterface $output, Status $status, $name, array $params = []) - { + public function __construct( + OutputInterface $output, + Status $status, + ObjectManagerProvider $objectManagerProvider, + $name, + array $params = [] + ) { $this->output = $output; $this->status = $status; $this->name = $name; $this->params = $params; + + $objectManager = $objectManagerProvider->get(); + $this->cleanupFiles = $objectManager->get('Magento\Framework\App\State\CleanupFiles'); + $this->cache = $objectManager->get('Magento\Framework\App\Cache'); } /** @@ -70,6 +97,21 @@ abstract class AbstractJob return $this->name . ' ' . json_encode($this->params, JSON_UNESCAPED_SLASHES); } + /** + * Do the cleanup + * + * @return void + */ + protected function performCleanup() + { + $this->status->add('Cleaning generated files...'); + $this->cleanupFiles->clearCodeGeneratedFiles(); + $this->status->add('Complete!'); + $this->status->add('Clearing cache...'); + $this->cache->clean(); + $this->status->add('Complete!'); + } + /** * Execute job * diff --git a/setup/src/Magento/Setup/Model/Cron/JobComponentUninstall.php b/setup/src/Magento/Setup/Model/Cron/JobComponentUninstall.php index ce8e60c5b91241550c009f317de27c437d9e6ded..c73e1b6785b39dea3a4c623ea1d5794fb2b023e9 100644 --- a/setup/src/Magento/Setup/Model/Cron/JobComponentUninstall.php +++ b/setup/src/Magento/Setup/Model/Cron/JobComponentUninstall.php @@ -89,7 +89,7 @@ class JobComponentUninstall extends AbstractJob $this->themeUninstall = $themeUninstall; $this->objectManager = $objectManagerProvider->get(); $this->updater = $updater; - parent::__construct($output, $status, $name, $params); + parent::__construct($output, $status, $objectManagerProvider, $name, $params); } /** @@ -101,6 +101,7 @@ class JobComponentUninstall extends AbstractJob public function execute() { if (!isset($this->params['components']) || !is_array($this->params['components'])) { + $this->status->toggleUpdateError(true); throw new \RunTimeException('Job parameter format is incorrect'); } $components = $this->params['components']; @@ -110,6 +111,7 @@ class JobComponentUninstall extends AbstractJob $this->cleanUp(); $errorMessage = $this->updater->createUpdaterTask($components, Updater::TASK_TYPE_UNINSTALL); if ($errorMessage) { + $this->status->toggleUpdateError(true); throw new \RuntimeException($errorMessage); } } @@ -124,6 +126,7 @@ class JobComponentUninstall extends AbstractJob private function executeComponent(array $component) { if (!isset($component[self::COMPONENT_NAME])) { + $this->status->toggleUpdateError(true); throw new \RuntimeException('Job parameter format is incorrect'); } @@ -132,6 +135,7 @@ class JobComponentUninstall extends AbstractJob if (isset($installedPackages[$componentName]['type'])) { $type = $installedPackages[$componentName]['type']; } else { + $this->status->toggleUpdateError(true); throw new \RuntimeException('Component type not set'); } @@ -141,6 +145,7 @@ class JobComponentUninstall extends AbstractJob self::COMPONENT_LANGUAGE, self::COMPONENT ])) { + $this->status->toggleUpdateError(true); throw new \RuntimeException('Unknown component type'); } diff --git a/setup/src/Magento/Setup/Model/Cron/JobDbRollback.php b/setup/src/Magento/Setup/Model/Cron/JobDbRollback.php index 8b67ac629b9bc1a49adce629dc592c0ad1431e18..ffb48a2085d9045d4adddfc64ae678dd8858cbec 100644 --- a/setup/src/Magento/Setup/Model/Cron/JobDbRollback.php +++ b/setup/src/Magento/Setup/Model/Cron/JobDbRollback.php @@ -23,22 +23,23 @@ class JobDbRollback extends AbstractJob /** * Constructor - * * @param BackupRollbackFactory $backupRollbackFactory * @param OutputInterface $output * @param Status $status - * @param string $name + * @param ObjectManagerProvider $objectManagerProvider + * @param array $name * @param array $params */ public function __construct( BackupRollbackFactory $backupRollbackFactory, OutputInterface $output, Status $status, + ObjectManagerProvider $objectManagerProvider, $name, $params = [] ) { $this->backupRollbackFactory = $backupRollbackFactory; - parent::__construct($output, $status, $name, $params); + parent::__construct($output, $status, $objectManagerProvider, $name, $params); } /** diff --git a/setup/src/Magento/Setup/Model/Cron/JobFactory.php b/setup/src/Magento/Setup/Model/Cron/JobFactory.php index 0128083f70fbecd77258ea2b1f0bd19e5f3791a3..5e8bb0d2101e5e4346140f96b3ad4800df06dce1 100644 --- a/setup/src/Magento/Setup/Model/Cron/JobFactory.php +++ b/setup/src/Magento/Setup/Model/Cron/JobFactory.php @@ -15,9 +15,11 @@ class JobFactory /** * Name of jobs */ - const NAME_UPGRADE = 'setup:upgrade'; - const DB_ROLLBACK = 'setup:rollback'; - const COMPONENT_UNINSTALL = 'setup:component:uninstall'; + const JOB_UPGRADE = 'setup:upgrade'; + const JOB_DB_ROLLBACK = 'setup:rollback'; + const JOB_COMPONENT_UNINSTALL = 'setup:component:uninstall'; + const JOB_MODULE_ENABLE = 'setup:module:enable'; + const JOB_MODULE_DISABLE = 'setup:module:disable'; /** * @var ServiceLocatorInterface @@ -52,7 +54,7 @@ class JobFactory /** @var \Magento\Framework\ObjectManagerInterface $objectManager */ $objectManager = $objectManagerProvider->get(); switch ($name) { - case self::NAME_UPGRADE: + case self::JOB_UPGRADE: return new JobUpgrade( $this->serviceLocator->get('Magento\Setup\Console\Command\UpgradeCommand'), $objectManagerProvider, @@ -62,16 +64,17 @@ class JobFactory $params ); break; - case self::DB_ROLLBACK: + case self::JOB_DB_ROLLBACK: return new JobDbRollback( $objectManager->get('Magento\Framework\Setup\BackupRollbackFactory'), $multipleStreamOutput, $cronStatus, + $objectManagerProvider, $name, $params ); break; - case self::COMPONENT_UNINSTALL: + case self::JOB_COMPONENT_UNINSTALL: $moduleUninstall = new Helper\ModuleUninstall( $this->serviceLocator->get('Magento\Setup\Model\ModuleUninstaller'), $this->serviceLocator->get('Magento\Setup\Model\ModuleRegistryUninstaller'), @@ -92,8 +95,30 @@ class JobFactory $name, $params ); + break; + case self::JOB_MODULE_ENABLE: + return new JobModule( + $this->serviceLocator->get('Magento\Setup\Console\Command\ModuleEnableCommand'), + $objectManagerProvider, + $multipleStreamOutput, + $cronStatus, + $name, + $params + ); + break; + case self::JOB_MODULE_DISABLE: + return new JobModule( + $this->serviceLocator->get('Magento\Setup\Console\Command\ModuleDisableCommand'), + $objectManagerProvider, + $multipleStreamOutput, + $cronStatus, + $name, + $params + ); + break; default: throw new \RuntimeException(sprintf('"%s" job is not supported.', $name)); + break; } } } diff --git a/setup/src/Magento/Setup/Model/Cron/JobModule.php b/setup/src/Magento/Setup/Model/Cron/JobModule.php new file mode 100644 index 0000000000000000000000000000000000000000..f4c3988d7327ee88f907feb9c165abff4ee3b2ff --- /dev/null +++ b/setup/src/Magento/Setup/Model/Cron/JobModule.php @@ -0,0 +1,103 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Model\Cron; + +use Magento\Setup\Console\Command\AbstractSetupCommand; +use Magento\Setup\Model\ObjectManagerProvider; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Job that handles module commands. E.g. "module:enable", "module:disable" + */ +class JobModule extends AbstractJob +{ + /** + * @var string $cmdString + */ + protected $cmdString; + + /** + * Constructor + * + * @param AbstractSetupCommand $command + * @param ObjectManagerProvider $objectManagerProvider + * @param OutputInterface $output + * @param Status $status + * @param string $name + * @param array $params + */ + public function __construct( + AbstractSetupCommand $command, + ObjectManagerProvider $objectManagerProvider, + OutputInterface $output, + Status $status, + $name, + $params = [] + ) { + $this->command = $command; + $this->output = $output; + $this->status = $status; + parent::__construct($output, $status, $objectManagerProvider, $name, $params); + + // map name to command string + $this->setCommandString($name); + } + + /** + * Sets up the command to be run through bin/magento + * + * @param string $name + * @return void + */ + private function setCommandString($name) + { + if ($name == 'setup:module:enable') { + $this->cmdString = 'module:enable'; + } else { + $this->cmdString = 'module:disable'; + } + } + + /** + * Execute job + * + * @throws \RuntimeException + * @return void + */ + public function execute() + { + try { + foreach ($this->params['components'] as $compObj) { + if (isset($compObj['name']) && (!empty($compObj['name']))) { + $moduleNames[] = $compObj['name']; + } else { + throw new \RuntimeException('component name is not set.'); + } + } + + // prepare the arguments to invoke Symfony run() + $arguments['command'] = $this->cmdString; + $arguments['module'] = $moduleNames; + + $statusCode = $this->command->run(new ArrayInput($arguments), $this->output); + + // check for return statusCode to catch any Symfony errors + if ($statusCode != 0) { + throw new \RuntimeException('Symfony run() returned StatusCode: ' . $statusCode); + } + + //perform the generated file cleanup + $this->performCleanup(); + + } catch (\Exception $e) { + $this->status->toggleUpdateError(true); + throw new \RuntimeException( + sprintf('Could not complete %s successfully: %s', $this->cmdString, $e->getMessage()) + ); + } + } +} diff --git a/setup/src/Magento/Setup/Model/Cron/JobUpgrade.php b/setup/src/Magento/Setup/Model/Cron/JobUpgrade.php index f297dc1aa59fc268cc8299294e4cefa811bf1f4b..e4b8b9bda907ae06a1dbbbc9958af1a8791fed20 100644 --- a/setup/src/Magento/Setup/Model/Cron/JobUpgrade.php +++ b/setup/src/Magento/Setup/Model/Cron/JobUpgrade.php @@ -16,20 +16,6 @@ use Symfony\Component\Console\Output\OutputInterface; */ class JobUpgrade extends AbstractJob { - /** - * @var \Magento\Framework\App\Cache - */ - private $cache; - - /** - * @var \Magento\Framework\App\State\CleanupFiles - */ - private $cleanupFiles; - - /** - * @var Status - */ - protected $status; /** * Constructor @@ -49,13 +35,10 @@ class JobUpgrade extends AbstractJob $name, $params = [] ) { - $objectManager = $objectManagerProvider->get(); - $this->cleanupFiles = $objectManager->get('Magento\Framework\App\State\CleanupFiles'); - $this->cache = $objectManager->get('Magento\Framework\App\Cache'); $this->command = $command; $this->output = $output; $this->status = $status; - parent::__construct($output, $status, $name, $params); + parent::__construct($output, $status, $objectManagerProvider, $name, $params); } /** @@ -69,10 +52,7 @@ class JobUpgrade extends AbstractJob try { $this->params['command'] = 'setup:upgrade'; $this->command->run(new ArrayInput($this->params), $this->output); - $this->status->add('Cleaning generated files...'); - $this->cleanupFiles->clearCodeGeneratedFiles(); - $this->status->add('Clearing cache...'); - $this->cache->clean(); + $this->performCleanup(); } catch (\Exception $e) { $this->status->toggleUpdateError(true); throw new \RuntimeException(sprintf('Could not complete %s successfully: %s', $this, $e->getMessage())); diff --git a/setup/src/Magento/Setup/Model/CronScriptReadinessCheck.php b/setup/src/Magento/Setup/Model/CronScriptReadinessCheck.php index 8277cc79ea7ace98dc72dc1650fe18167d9da4c5..ef427c3e4148b055a512381306386f935e0f2637 100644 --- a/setup/src/Magento/Setup/Model/CronScriptReadinessCheck.php +++ b/setup/src/Magento/Setup/Model/CronScriptReadinessCheck.php @@ -38,6 +38,12 @@ class CronScriptReadinessCheck */ const UPDATER_KEY_FILE_PERMISSIONS_VERIFIED = 'file_permissions_verified'; + /** + * Error message for dependant checks + */ + const OTHER_CHECKS_WILL_FAIL_MSG = + '<br/>Other checks will fail as a result (PHP version, PHP settings, and PHP extensions)'; + /** * @var Filesystem */ @@ -96,10 +102,9 @@ class CronScriptReadinessCheck return ['success' => false, 'error' => 'Internal Error']; } } catch (\Magento\Framework\Exception\FileSystemException $e) { - $error = 'Cron Job has not been configured yet'; + $error = 'Cron job has not been configured yet'; if ($type == self::SETUP) { - $error .= '<br/>PHP Version, PHP Settings and PHP Extensions Check' . - ' will fail because they depend on this check'; + $error .= self::OTHER_CHECKS_WILL_FAIL_MSG; } return [ 'success' => false, @@ -115,10 +120,9 @@ class CronScriptReadinessCheck } return ['success' => false, 'error' => $jsonData[ReadinessCheck::KEY_READINESS_CHECKS]['error']]; } - $error = 'Cron Job has not been configured yet'; + $error = 'Cron job has not been configured yet'; if ($type == self::SETUP) { - $error .= '<br/>PHP Version, PHP Settings and PHP Extensions Check' . - ' will fail because they depend on this check'; + $error .= self::OTHER_CHECKS_WILL_FAIL_MSG; } return [ 'success' => false, @@ -144,13 +148,13 @@ class CronScriptReadinessCheck } return [ 'success' => true, - 'notice' => 'It is recommended to schedule Cron to run every 1 minute' + 'notice' => 'We recommend you schedule cron to run every 1 minute' ]; } return [ 'success' => true, - 'notice' => 'Unable to determine Cron time interval. ' . - 'It is recommended to schedule Cron to run every 1 minute' + 'notice' => 'Unable to determine cron time interval. ' . + 'We recommend you schedule cron to run every 1 minute' ]; } } diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 0e822e56f2dd5c84e307a63ff9baf474b65b6780..51692aebce7520d6c389ff2d55b518296c1d8439 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -26,6 +26,8 @@ use Magento\Framework\Setup\UpgradeDataInterface; use Magento\Framework\Setup\SchemaSetupInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Setup\Model\ConfigModel as SetupConfigModel; +use Magento\Setup\Module\DataSetupFactory; +use Magento\Setup\Module\SetupFactory; use Magento\Store\Model\Store; use Magento\Setup\Module\ConnectionFactory; use Magento\Setup\Module\Setup; @@ -163,11 +165,6 @@ class Installer */ private $deploymentConfig; - /** - * @var SampleData - */ - private $sampleData; - /** * @var ObjectManagerProvider */ @@ -193,6 +190,20 @@ class Installer */ private $dbValidator; + /** + * Factory to create \Magento\Setup\Module\Setup + * + * @var SetupFactory + */ + private $setupFactory; + + /** + * Factory to create \Magento\Setup\Module\DataSetup + * + * @var DataSetupFactory + */ + private $dataSetupFactory; + /** * Constructor * @@ -207,12 +218,13 @@ class Installer * @param ConnectionFactory $connectionFactory * @param MaintenanceMode $maintenanceMode * @param Filesystem $filesystem - * @param SampleData $sampleData * @param ObjectManagerProvider $objectManagerProvider * @param Context $context * @param SetupConfigModel $setupConfigModel * @param CleanupFiles $cleanupFiles * @param DbValidator $dbValidator + * @param SetupFactory $setupFactory + * @param DataSetupFactory $dataSetupFactory * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -228,12 +240,13 @@ class Installer ConnectionFactory $connectionFactory, MaintenanceMode $maintenanceMode, Filesystem $filesystem, - SampleData $sampleData, ObjectManagerProvider $objectManagerProvider, Context $context, SetupConfigModel $setupConfigModel, CleanupFiles $cleanupFiles, - DbValidator $dbValidator + DbValidator $dbValidator, + SetupFactory $setupFactory, + DataSetupFactory $dataSetupFactory ) { $this->filePermissions = $filePermissions; $this->deploymentConfigWriter = $deploymentConfigWriter; @@ -245,7 +258,6 @@ class Installer $this->connectionFactory = $connectionFactory; $this->maintenanceMode = $maintenanceMode; $this->filesystem = $filesystem; - $this->sampleData = $sampleData; $this->installInfo[self::INFO_MESSAGE] = []; $this->deploymentConfig = $deploymentConfig; $this->objectManagerProvider = $objectManagerProvider; @@ -253,6 +265,8 @@ class Installer $this->setupConfigModel = $setupConfigModel; $this->cleanupFiles = $cleanupFiles; $this->dbValidator = $dbValidator; + $this->setupFactory = $setupFactory; + $this->dataSetupFactory = $dataSetupFactory; } /** @@ -282,7 +296,9 @@ class Installer } $script[] = ['Installing admin user...', 'installAdminUser', [$request]]; $script[] = ['Enabling caches:', 'enableCaches', []]; - if (!empty($request[InstallCommand::INPUT_KEY_USE_SAMPLE_DATA]) && $this->sampleData->isDeployed()) { + if (!empty($request[InstallCommand::INPUT_KEY_USE_SAMPLE_DATA]) + && $this->filesystem->getDirectoryRead(DirectoryList::MODULES)->isExist('Magento/SampleData') + ) { $script[] = ['Installing sample data:', 'installSampleData', [$request]]; } $script[] = ['Disabling Maintenance Mode:', 'setMaintenanceMode', [0]]; @@ -690,10 +706,7 @@ class Installer */ public function installSchema() { - $setup = $this->objectManagerProvider->get()->create( - 'Magento\Setup\Module\Setup', - ['resource' => $this->context->getResources()] - ); + $setup = $this->setupFactory->create($this->context->getResources()); $this->setupModuleRegistry($setup); $this->setupCoreTables($setup); $this->log->log('Schema creation/updates:'); @@ -708,7 +721,7 @@ class Installer */ public function installDataFixtures() { - $setup = $this->objectManagerProvider->get()->create('Magento\Setup\Module\DataSetup'); + $setup = $this->dataSetupFactory->create(); $this->checkInstallationFilePermissions(); $this->log->log('Data install/update:'); $this->handleDBSchemaData($setup, 'data'); @@ -848,10 +861,7 @@ class Installer */ private function installOrderIncrementPrefix($orderIncrementPrefix) { - $setup = $this->objectManagerProvider->get()->create( - 'Magento\Setup\Module\Setup', - ['resource' => $this->context->getResources()] - ); + $setup = $this->setupFactory->create($this->context->getResources()); $dbConnection = $setup->getConnection(); // get entity_type_id for order @@ -894,10 +904,7 @@ class Installer public function installAdminUser($data) { $this->assertDeploymentConfigExists(); - $setup = $this->objectManagerProvider->get()->create( - 'Magento\Setup\Module\Setup', - ['resource' => $this->context->getResources()] - ); + $setup = $this->setupFactory->create($this->context->getResources()); $adminAccount = $this->adminAccountFactory->create($setup, (array)$data); $adminAccount->save(); } @@ -915,6 +922,15 @@ class Installer $this->log->log('File system cleanup:'); $messages = $this->cleanupFiles->clearCodeGeneratedClasses(); + // unload Magento autoloader because it may be using compiled definition + foreach (spl_autoload_functions() as $autoloader) { + if ($autoloader[0] instanceof \Magento\Framework\Code\Generator\Autoloader) { + spl_autoload_unregister([$autoloader[0], $autoloader[1]]); + break; + } + } + // Corrected Magento autoloader will be loaded upon next get() call on $this->objectManagerProvider + $this->objectManagerProvider->reset(); foreach ($messages as $message) { $this->log->log($message); } @@ -1117,7 +1133,8 @@ class Installer try { $userName = isset($request[AdminAccount::KEY_USER]) ? $request[AdminAccount::KEY_USER] : ''; $this->objectManagerProvider->reset(); - $this->sampleData->install($this->objectManagerProvider->get(), $this->log, $userName); + $sampleData = $this->objectManagerProvider->get()->get('Magento\SampleData\Model\SampleData'); + $sampleData->install($this->objectManagerProvider->get(), $this->log, $userName); } catch (\Exception $e) { throw new \Magento\Setup\SampleDataException( "Error during sample data installation: {$e->getMessage()}", diff --git a/setup/src/Magento/Setup/Model/InstallerFactory.php b/setup/src/Magento/Setup/Model/InstallerFactory.php index 9af552e32d1fcc0354816196bf6b036c37e7fe94..9d99342d21a193dbaf83636c436df9e5a4a22b37 100644 --- a/setup/src/Magento/Setup/Model/InstallerFactory.php +++ b/setup/src/Magento/Setup/Model/InstallerFactory.php @@ -61,7 +61,6 @@ class InstallerFactory $this->serviceLocator->get('Magento\Setup\Module\ConnectionFactory'), $this->serviceLocator->get('Magento\Framework\App\MaintenanceMode'), $this->serviceLocator->get('Magento\Framework\Filesystem'), - $this->serviceLocator->get('Magento\Setup\Model\SampleData'), $this->serviceLocator->get('Magento\Setup\Model\ObjectManagerProvider'), new \Magento\Framework\Model\Resource\Db\Context( $this->getResource(), @@ -70,7 +69,9 @@ class InstallerFactory ), $this->serviceLocator->get('Magento\Setup\Model\ConfigModel'), $this->serviceLocator->get('Magento\Framework\App\State\CleanupFiles'), - $this->serviceLocator->get('Magento\Setup\Validator\DbValidator') + $this->serviceLocator->get('Magento\Setup\Validator\DbValidator'), + $this->serviceLocator->get('Magento\Setup\Module\SetupFactory'), + $this->serviceLocator->get('Magento\Setup\Module\DataSetupFactory') ); } diff --git a/setup/src/Magento/Setup/Model/ModuleStatusFactory.php b/setup/src/Magento/Setup/Model/ModuleStatusFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..8982b65dba276f9a6bd4da9a435d499a2bdc3d24 --- /dev/null +++ b/setup/src/Magento/Setup/Model/ModuleStatusFactory.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Model; + +use Magento\Framework\Module\Status; + +/** + * Class ModuleStatusFactory creates instance of Status + */ +class ModuleStatusFactory +{ + /** + * @var ObjectManagerProvider + */ + private $objectManagerProvider; + + /** + * Constructor + * + * @param ObjectManagerProvider $objectManagerProvider + */ + public function __construct(ObjectManagerProvider $objectManagerProvider) + { + $this->objectManagerProvider = $objectManagerProvider; + } + + /** + * Creates Status object + * + * @return Status + */ + public function create() + { + return $this->objectManagerProvider->get()->get('Magento\Framework\Module\Status'); + } +} diff --git a/setup/src/Magento/Setup/Model/SampleData.php b/setup/src/Magento/Setup/Model/SampleData.php deleted file mode 100644 index c3e79ba7133b4ab99ea2aa17b658df37ed13da31..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Model/SampleData.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Model; - -use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Filesystem; -use Magento\Framework\ObjectManagerInterface; -use Magento\Framework\Setup\LoggerInterface; - -/** - * Sample data installer - * - * Serves as an integration point between Magento Setup application and Luma sample data component - */ -class SampleData -{ - /** - * Path to the sample data application - */ - const PATH = '/Magento/SampleData'; - - /** - * Filesystem Directory List - * - * @var DirectoryList - */ - private $directoryList; - - /** - * @param DirectoryList $directoryList - */ - public function __construct(DirectoryList $directoryList) - { - $this->directoryList = $directoryList; - } - - /** - * Check if Sample Data was deployed - * - * @return bool - */ - public function isDeployed() - { - return file_exists($this->directoryList->getPath(DirectoryList::MODULES) . self::PATH); - } - - /** - * Get state object or null if state object cannot be initialized - * - * @return null|\Magento\SampleData\Helper\State - */ - protected function getState() - { - if ($this->isDeployed() && class_exists('Magento\SampleData\Helper\State')) { - return new \Magento\SampleData\Helper\State(); - } - return null; - } - - /** - * Check whether installation of sample data was successful - * - * @return bool - */ - public function isInstalledSuccessfully() - { - $state = $this->getState(); - if (!$state) { - return false; - } - return \Magento\SampleData\Helper\State::STATE_FINISHED == $state->getState(); - } - - /** - * Check whether there was unsuccessful attempt to install Sample data - * - * @return bool - */ - public function isInstallationError() - { - $state = $this->getState(); - if (!$state) { - return false; - } - return $state->isError(); - } - - /** - * Installation routine for creating sample data - * - * @param ObjectManagerInterface $objectManager - * @param LoggerInterface $logger - * @param string $userName - * @param array $modules - * @throws \Exception - * @return void - */ - public function install( - ObjectManagerInterface $objectManager, - LoggerInterface $logger, - $userName, - array $modules = [] - ) { - /** @var \Magento\SampleData\Model\Logger $sampleDataLogger */ - $sampleDataLogger = $objectManager->get('Magento\SampleData\Model\Logger'); - $sampleDataLogger->setSubject($logger); - - $areaCode = 'adminhtml'; - /** @var \Magento\Framework\App\State $appState */ - $appState = $objectManager->get('Magento\Framework\App\State'); - $appState->setAreaCode($areaCode); - /** @var \Magento\Framework\App\ObjectManager\ConfigLoader $configLoader */ - $configLoader = $objectManager->get('Magento\Framework\App\ObjectManager\ConfigLoader'); - $objectManager->configure($configLoader->load($areaCode)); - - /** @var \Magento\SampleData\Model\Installer $installer */ - $installer = $objectManager->get('Magento\SampleData\Model\Installer'); - $installer->run($userName, $modules); - } -} diff --git a/setup/src/Magento/Setup/Model/Updater.php b/setup/src/Magento/Setup/Model/Updater.php index cdf395321e73fc43cc872ee3a456c30652ac3471..d7ccfcf9a88d1bcc5deea965c5312fd795feb716 100644 --- a/setup/src/Magento/Setup/Model/Updater.php +++ b/setup/src/Magento/Setup/Model/Updater.php @@ -48,9 +48,15 @@ class Updater { try { // write to .update_queue.json file - $this->queue->addJobs( - [['name' => $type, 'params' => array_merge(['components' => $packages], $additionalOptions)]] - ); + $params = []; + if (!empty($packages)) { + $params['components'] = $packages; + } + foreach ($additionalOptions as $key => $value) { + $params[$key] = $value; + } + + $this->queue->addJobs([['name' => $type, 'params' => $params]]); return ''; } catch (\Exception $e) { return $e->getMessage(); diff --git a/setup/src/Magento/Setup/Module.php b/setup/src/Magento/Setup/Module.php index b36805e5af2f2e294390af5a5994e3d4380c50f1..8ad2589b9963f292a69896970fc13018e790ce7a 100644 --- a/setup/src/Magento/Setup/Module.php +++ b/setup/src/Magento/Setup/Module.php @@ -67,6 +67,8 @@ class Module implements include __DIR__ . '/../../../config/states.home.config.php', include __DIR__ . '/../../../config/states.upgrade.config.php', include __DIR__ . '/../../../config/states.uninstall.config.php', + include __DIR__ . '/../../../config/states.enable.config.php', + include __DIR__ . '/../../../config/states.disable.config.php', include __DIR__ . '/../../../config/languages.config.php' ); return $result; diff --git a/setup/src/Magento/Setup/Module/SetupFactory.php b/setup/src/Magento/Setup/Module/SetupFactory.php index 532d4bbcc7b1a4c9155221dde44c4d4e593e0df4..386fedd04a9f529053943a7f5b8c3bb992e607df 100644 --- a/setup/src/Magento/Setup/Module/SetupFactory.php +++ b/setup/src/Magento/Setup/Module/SetupFactory.php @@ -5,6 +5,7 @@ */ namespace Magento\Setup\Module; +use Magento\Framework\App\Resource; use Magento\Setup\Model\ObjectManagerProvider; /** @@ -28,13 +29,17 @@ class SetupFactory } /** - * Creates Setup + * Creates setup * + * @param Resource $appResource * @return Setup */ - public function create() + public function create(Resource $appResource = null) { $objectManager = $this->objectManagerProvider->get(); - return new Setup($objectManager->get('Magento\Framework\App\Resource')); + if ($appResource === null) { + $appResource = $objectManager->get('Magento\Framework\App\Resource'); + } + return new Setup($appResource); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/BackupCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/BackupCommandTest.php index e676d1a0144ab5c565fd60cf9fc93c586cde57a4..78b4bf38511ab88e856f2cb6b1e9d0db1d7c98bb 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/BackupCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/BackupCommandTest.php @@ -121,8 +121,8 @@ class BackupCommandTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(false)); $this->tester->execute([]); $expected = 'Enabling maintenance mode' . PHP_EOL - . 'Not enough information provided to take backup.' . PHP_EOL - . 'Disabling maintenance mode'; - $this->assertStringMatchesFormat($expected, $this->tester->getDisplay()); + . 'Not enough information provided to take backup.' . PHP_EOL + . 'Disabling maintenance mode' . PHP_EOL; + $this->assertSame($expected, $this->tester->getDisplay()); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php index a72e47b4111c82bbc1cb4559af062fb373932530..d903716d85dc35578339b7d7e837d0b4096f856c 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php @@ -106,12 +106,14 @@ class ModuleEnableDisableCommandTest extends \PHPUnit_Framework_TestCase 'enable, do not clear static content' => [ true, false, - '%amodules have been enabled%aMagento_Module1%aGenerated static view files were not cleared%a' + '%amodules have been enabled%aMagento_Module1%a' . + 'Info: Some modules might require static view files to be cleared.%a' ], 'disable, do not clear static content' => [ false, false, - '%amodules have been disabled%aMagento_Module1%aGenerated static view files were not cleared%a' + '%amodules have been disabled%aMagento_Module1%a' . + 'Info: Some modules might require static view files to be cleared.%a' ], 'enable, clear static content' => [ true, diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/RollbackCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/RollbackCommandTest.php index dafa2e6e5e2ded5b2ac36de638af359bafc86f3f..02f9e9956bb576369ed884fbd48160a2dc6fe0d2 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/RollbackCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/RollbackCommandTest.php @@ -150,9 +150,9 @@ class RollbackCommandTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(true)); $this->tester->execute([]); $expected = 'Enabling maintenance mode' . PHP_EOL - . 'Not enough information provided to roll back.' . PHP_EOL - . 'Disabling maintenance mode'; - $this->assertStringMatchesFormat($expected, $this->tester->getDisplay()); + . 'Not enough information provided to roll back.' . PHP_EOL + . 'Disabling maintenance mode' . PHP_EOL; + $this->assertSame($expected, $this->tester->getDisplay()); } public function testInteraction() diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/CustomizeYourStoreTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/CustomizeYourStoreTest.php index f029c6ac15234f5cb8257c0ad71a3289c2c145a9..84a69a4f67a3ee7f246ce8d664035ac295680736 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/CustomizeYourStoreTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/CustomizeYourStoreTest.php @@ -16,7 +16,7 @@ class CustomizeYourStoreTest extends \PHPUnit_Framework_TestCase private $controller; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\SampleData + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\SampleData\Model\SampleData */ private $sampleData; @@ -25,11 +25,31 @@ class CustomizeYourStoreTest extends \PHPUnit_Framework_TestCase */ private $lists; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ObjectManager + */ + private $objectManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Module\ModuleList + */ + private $moduleList; + public function setup() { - $this->sampleData = $this->getMock('\Magento\Setup\Model\SampleData', [], [], '', false); + $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $this->objectManager = $this->getMock('Magento\Framework\App\ObjectManager', [], [], '', false); + $objectManagerProvider->expects($this->any())->method('get')->willReturn($this->objectManager); + $this->sampleData = $this->getMock( + 'Magento\SampleData\Model\SampleData', + ['isInstalledSuccessfully', 'isInstallationError'], + [], + '', + false + ); $this->lists = $this->getMock('\Magento\Framework\Setup\Lists', [], [], '', false); - $this->controller = new CustomizeYourStore($this->lists, $this->sampleData); + $this->moduleList = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false); + $this->controller = new CustomizeYourStore($this->moduleList, $this->lists, $objectManagerProvider); } /** @@ -39,11 +59,17 @@ class CustomizeYourStoreTest extends \PHPUnit_Framework_TestCase */ public function testIndexAction($expected) { - $this->sampleData->expects($this->once())->method('isDeployed')->willReturn($expected['isSampledataEnabled']); - $this->sampleData->expects($this->once())->method('isInstalledSuccessfully') - ->willReturn($expected['isSampleDataInstalled']); - $this->sampleData->expects($this->once())->method('isInstallationError') - ->willReturn($expected['isSampleDataErrorInstallation']); + if ($expected['isSampledataEnabled']) { + $this->moduleList->expects($this->once())->method('has')->willReturn(true); + $this->objectManager->expects($this->once())->method('get')->willReturn($this->sampleData); + $this->sampleData->expects($this->once())->method('isInstalledSuccessfully') + ->willReturn($expected['isSampleDataInstalled']); + $this->sampleData->expects($this->once())->method('isInstallationError') + ->willReturn($expected['isSampleDataErrorInstallation']); + } else { + $this->moduleList->expects($this->once())->method('has')->willReturn(false); + $this->objectManager->expects($this->never())->method('get'); + } $this->lists->expects($this->once())->method('getTimezoneList')->willReturn($expected['timezone']); $this->lists->expects($this->once())->method('getCurrencyList')->willReturn($expected['currency']); $this->lists->expects($this->once())->method('getLocaleList')->willReturn($expected['language']); @@ -69,9 +95,9 @@ class CustomizeYourStoreTest extends \PHPUnit_Framework_TestCase $currency = ['currency' => ['USD'=>'US Dollar', 'EUR' => 'Euro']]; $language = ['language' => ['en_US'=>'English (USA)', 'en_UK' => 'English (UK)']]; $sampleData = [ - 'isSampledataEnabled' => null, - 'isSampleDataInstalled' => null, - 'isSampleDataErrorInstallation' => null + 'isSampledataEnabled' => false, + 'isSampleDataInstalled' => false, + 'isSampleDataErrorInstallation' => false ]; $sampleDataTrue = array_merge($sampleData, ['isSampledataEnabled' => true]); $sampleDataFalse = array_merge($sampleData, ['isSampledataEnabled' => false]); diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php index 8c4f5cf33adf3d13d2ddf8f83ce43af6445a713a..fc3fee7684e9ea15f76998244ed84678e72ff947 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php @@ -43,6 +43,11 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase */ protected $uninstallDependencyCheck; + /** + * @var \Magento\Setup\Model\ModuleStatusFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $moduleStatusFactory; + /** * @var Environment */ @@ -75,13 +80,21 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase '', false ); + $this->moduleStatusFactory = $this->getMock( + 'Magento\Setup\Model\ModuleStatusFactory', + [], + [], + '', + false + ); $this->environment = new Environment( $this->permissions, $this->filesystem, $this->cronScriptReadinessCheck, $this->dependencyReadinessCheck, $this->uninstallDependencyCheck, - $this->phpReadinessCheck + $this->phpReadinessCheck, + $this->moduleStatusFactory ); } diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/StartUpdaterTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/StartUpdaterTest.php index f0a9d835070a06b28dc2ba04e0778fa7f04a56bc..c4a6040f065c8c67a33c8c1514c7f803fd44f3fe 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/StartUpdaterTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/StartUpdaterTest.php @@ -16,6 +16,11 @@ class StartUpdaterTest extends \PHPUnit_Framework_TestCase */ private $updater; + /** + * @var \Magento\Framework\Module\FullModuleList|\PHPUnit_Framework_MockObject_MockObject + */ + private $fullModuleList; + /** * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ @@ -49,12 +54,23 @@ class StartUpdaterTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->updater = $this->getMock('Magento\Setup\Model\Updater', [], [], '', false); + $this->fullModuleList = $this->getMock('Magento\Framework\Module\FullModuleList', [], [], '', false); $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); $this->navigation = $this->getMock('Magento\Setup\Model\Navigation', [], [], '', false); - $this->controller = new StartUpdater($this->filesystem, $this->navigation, $this->updater); + $this->controller = new StartUpdater( + $this->filesystem, + $this->navigation, + $this->updater, + $this->fullModuleList + ); $this->navigation->expects($this->any()) ->method('getMenuItems') - ->willReturn([['title' => 'A', 'type' => 'update'], ['title' => 'B', 'type' => 'upgrade']]); + ->willReturn([ + ['title' => 'A', 'type' => 'update'], + ['title' => 'B', 'type' => 'upgrade'], + ['title' => 'C', 'type' => 'enable'], + ['title' => 'D', 'type' => 'disable'], + ]); $this->request = $this->getMock('\Zend\Http\PhpEnvironment\Request', [], [], '', false); $this->response = $this->getMock('\Zend\Http\PhpEnvironment\Response', [], [], '', false); $routeMatch = $this->getMock('\Zend\Mvc\Router\RouteMatch', [], [], '', false); @@ -160,4 +176,36 @@ class StartUpdaterTest extends \PHPUnit_Framework_TestCase $this->controller->dispatch($this->request, $this->response); $this->controller->updateAction(); } + + public function testUpdateActionSuccessEnable() + { + $content = '{"packages":[{"name":"vendor\/package"}],"type":"enable",' + . '"headerTitle": "Enable Package 1" }'; + $this->request->expects($this->any())->method('getContent')->willReturn($content); + $this->fullModuleList->expects($this->once())->method('has')->willReturn(true); + $write = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface', [], '', false); + $this->filesystem->expects($this->once())->method('getDirectoryWrite')->willReturn($write); + $write->expects($this->once()) + ->method('writeFile') + ->with('.type.json', '{"type":"enable","headerTitle":"Enable Package 1","titles":["C"]}'); + $this->controller->setEvent($this->mvcEvent); + $this->controller->dispatch($this->request, $this->response); + $this->controller->updateAction(); + } + + public function testUpdateActionSuccessDisable() + { + $content = '{"packages":[{"name":"vendor\/package"}],"type":"disable",' + . '"headerTitle": "Disable Package 1" }'; + $this->request->expects($this->any())->method('getContent')->willReturn($content); + $this->fullModuleList->expects($this->once())->method('has')->willReturn(true); + $write = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface', [], '', false); + $this->filesystem->expects($this->once())->method('getDirectoryWrite')->willReturn($write); + $write->expects($this->once()) + ->method('writeFile') + ->with('.type.json', '{"type":"disable","headerTitle":"Disable Package 1","titles":["D"]}'); + $this->controller->setEvent($this->mvcEvent); + $this->controller->dispatch($this->request, $this->response); + $this->controller->updateAction(); + } } diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/SuccessTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/SuccessTest.php index b9bccbc55b16d0164ba11a076ab66ec52f0222fc..e55d4430ee7cf8301307dfb88cfa52107c6e7634 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/SuccessTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/SuccessTest.php @@ -12,10 +12,16 @@ class SuccessTest extends \PHPUnit_Framework_TestCase { public function testIndexAction() { - $sampleData = $this->getMock('Magento\Setup\Model\SampleData', ['isDeployed'], [], '', false); + $moduleList = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false); + $moduleList->expects($this->once())->method('has')->willReturn(true); + $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $objectManager = $this->getMock('Magento\Framework\App\ObjectManager', [], [], '', false); + $objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager); + $sampleData = $this->getMock('Magento\Setup\Model\SampleData', ['isInstallationError'], [], '', false); + $objectManager->expects($this->once())->method('get')->willReturn($sampleData); /** @var $controller Success */ - $controller = new Success($sampleData); - $sampleData->expects($this->once())->method('isDeployed'); + $controller = new Success($moduleList, $objectManagerProvider); + $sampleData->expects($this->once())->method('isInstallationError'); $viewModel = $controller->indexAction(); $this->assertInstanceOf('Zend\View\Model\ViewModel', $viewModel); $this->assertTrue($viewModel->terminate()); diff --git a/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobDbRollbackTest.php b/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobDbRollbackTest.php index cf51bb8696ef0c7714c1102b106ddb9898bc7489..0f18eccd1ef827c5fdb028de9b3457f0d5161351 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobDbRollbackTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobDbRollbackTest.php @@ -29,6 +29,11 @@ class JobDbRollbackTest extends \PHPUnit_Framework_TestCase */ private $status; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\ObjectManagerProvider + */ + private $objectManagerProvider; + public function setup() { $this->backupRollbackFactory = $this->getMock( @@ -41,11 +46,16 @@ class JobDbRollbackTest extends \PHPUnit_Framework_TestCase $this->backupRollback = $this->getMock('\Magento\Framework\Setup\BackupRollback', [], [], '', false); $this->status = $this->getMock('Magento\Setup\Model\Cron\Status', [], [], '', false); $output = $this->getMockForAbstractClass('Symfony\Component\Console\Output\OutputInterface', [], '', false); + $this->objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + + $objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface', [], '', false); + $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager); $this->jobDbRollback = new JobDbRollback( $this->backupRollbackFactory, $output, $this->status, + $this->objectManagerProvider, 'setup:rollback', ['backup_file_name' => 'someFileName'] ); diff --git a/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobFactoryTest.php b/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobFactoryTest.php index 01ff7898b44c72eba8f39bb03a2dcf2e1da2b6e0..30ba2d9fdb76e8ee7943e625499b3ff3a2503899 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobFactoryTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobFactoryTest.php @@ -37,6 +37,8 @@ class JobFactoryTest extends \PHPUnit_Framework_TestCase $upgradeCommand = $this->getMock('Magento\Setup\Console\Command\UpgradeCommand', [], [], '', false); $moduleUninstaller = $this->getMock('Magento\Setup\Model\ModuleUninstaller', [], [], '', false); $moduleRegistryUninstaller = $this->getMock('Magento\Setup\Model\ModuleRegistryUninstaller', [], [], '', false); + $moduleEnabler = $this->getMock('Magento\Setup\Console\Command\ModuleEnableCommand', [], [], '', false); + $moduleDisabler = $this->getMock('Magento\Setup\Console\Command\ModuleDisableCommand', [], [], '', false); $updater = $this->getMock('Magento\Setup\Model\Updater', [], [], '', false); @@ -47,6 +49,8 @@ class JobFactoryTest extends \PHPUnit_Framework_TestCase ['Magento\Setup\Model\ObjectManagerProvider', $objectManagerProvider], ['Magento\Setup\Model\ModuleUninstaller', $moduleUninstaller], ['Magento\Setup\Model\ModuleRegistryUninstaller', $moduleRegistryUninstaller], + ['Magento\Setup\Console\Command\ModuleDisableCommand', $moduleDisabler], + ['Magento\Setup\Console\Command\ModuleEnableCommand', $moduleEnabler] ]; $serviceManager->expects($this->atLeastOnce()) @@ -63,10 +67,24 @@ class JobFactoryTest extends \PHPUnit_Framework_TestCase public function testRollback() { - $this->objectManager->expects($this->once()) + $valueMap = [ + [ + 'Magento\Framework\App\State\CleanupFiles', + $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false) + ], + [ + 'Magento\Framework\App\Cache', + $this->getMock('Magento\Framework\App\Cache', [], [], '', false) + ], + [ + 'Magento\Framework\Setup\BackupRollbackFactory', + $this->getMock('Magento\Framework\Setup\BackupRollbackFactory', [], [], '', false) + ], + ]; + $this->objectManager->expects($this->any()) ->method('get') - ->with('Magento\Framework\Setup\BackupRollbackFactory') - ->willReturn($this->getMock('Magento\Framework\Setup\BackupRollbackFactory', [], [], '', false)); + ->will($this->returnValueMap($valueMap)); + $this->assertInstanceOf( 'Magento\Setup\Model\Cron\AbstractJob', $this->jobFactory->create('setup:rollback', []) @@ -110,8 +128,45 @@ class JobFactoryTest extends \PHPUnit_Framework_TestCase { $this->jobFactory->create('unknown', []); } + + public function testModuleDisable() + { + $valueMap = [ + [ + 'Magento\Framework\Module\PackageInfoFactory', + $this->getMock('Magento\Framework\Module\PackageInfoFactory', [], [], '', false) + ], + ]; + $this->objectManager->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($valueMap)); + + $this->assertInstanceOf( + 'Magento\Setup\Model\Cron\AbstractJob', + $this->jobFactory->create('setup:module:disable', []) + ); + } + + public function testModuleEnable() + { + $valueMap = [ + [ + 'Magento\Framework\Module\PackageInfoFactory', + $this->getMock('Magento\Framework\Module\PackageInfoFactory', [], [], '', false) + ], + ]; + $this->objectManager->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($valueMap)); + + $this->assertInstanceOf( + 'Magento\Setup\Model\Cron\AbstractJob', + $this->jobFactory->create('setup:module:enable', []) + ); + } } + // functions to override native php functions namespace Magento\Setup\Model\Cron; diff --git a/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobModuleTest.php b/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobModuleTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2c028f72d61d8b1d4d911b3eb8d95022c602494f --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobModuleTest.php @@ -0,0 +1,75 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Test\Unit\Model\Cron; + +use Magento\Setup\Model\Cron\JobModule; + +class JobModuleTest extends \PHPUnit_Framework_TestCase +{ + public function testExecuteModuleDisable() + { + $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface', [], '', false); + $cleanupFiles = $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false); + $cleanupFiles->expects($this->once())->method('clearCodeGeneratedFiles'); + $cache = $this->getMock('Magento\Framework\App\Cache', [], [], '', false); + $cache->expects($this->once())->method('clean'); + $valueMap = [ + ['Magento\Framework\Module\PackageInfoFactory'], + ['Magento\Framework\App\State\CleanupFiles', $cleanupFiles], + ['Magento\Framework\App\Cache', $cache], + ]; + $objectManager->expects($this->atLeastOnce())->method('get')->will($this->returnValueMap($valueMap)); + $objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager); + $command = $this->getMock('Magento\Setup\Console\Command\ModuleDisableCommand', [], [], '', false); + $command->expects($this->once())->method('run'); + $status = $this->getMock('Magento\Setup\Model\Cron\Status', [], [], '', false); + $status->expects($this->atLeastOnce())->method('add'); + $output = $this->getMockForAbstractClass('Symfony\Component\Console\Output\OutputInterface', [], '', false); + $params['components'][] = ['name' => 'vendor/module']; + $jobModuleDisable = new JobModule( + $command, + $objectManagerProvider, + $output, + $status, + 'setup:module:disable', + $params + ); + $jobModuleDisable->execute(); + } + + public function testExecuteModuleEnable() + { + $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface', [], '', false); + $cleanupFiles = $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false); + $cleanupFiles->expects($this->once())->method('clearCodeGeneratedFiles'); + $cache = $this->getMock('Magento\Framework\App\Cache', [], [], '', false); + $cache->expects($this->once())->method('clean'); + $valueMap = [ + ['Magento\Framework\Module\PackageInfoFactory'], + ['Magento\Framework\App\State\CleanupFiles', $cleanupFiles], + ['Magento\Framework\App\Cache', $cache], + ]; + $objectManager->expects($this->atLeastOnce())->method('get')->will($this->returnValueMap($valueMap)); + $objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager); + $command = $this->getMock('Magento\Setup\Console\Command\ModuleEnableCommand', [], [], '', false); + $command->expects($this->once())->method('run'); + $status = $this->getMock('Magento\Setup\Model\Cron\Status', [], [], '', false); + $status->expects($this->atLeastOnce())->method('add'); + $output = $this->getMockForAbstractClass('Symfony\Component\Console\Output\OutputInterface', [], '', false); + $params['components'][] = ['name' => 'vendor/module']; + $jobModuleEnable = new JobModule( + $command, + $objectManagerProvider, + $output, + $status, + 'setup:module:enable', + $params + ); + $jobModuleEnable->execute(); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Model/CronScriptReadinessCheckTest.php b/setup/src/Magento/Setup/Test/Unit/Model/CronScriptReadinessCheckTest.php index e36fe98d1c39e0d8c30d5f5dd052fd77632ef900..de55f60784569a655e89cb5d21b2c2d901068ee2 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/CronScriptReadinessCheckTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/CronScriptReadinessCheckTest.php @@ -37,9 +37,7 @@ class CronScriptReadinessCheckTest extends \PHPUnit_Framework_TestCase ->willThrowException(new FileSystemException(new Phrase(''))); $expected = [ 'success' => false, - 'error' => 'Cron Job has not been configured yet' . - '<br/>PHP Version, PHP Settings and PHP Extensions Check' . - ' will fail because they depend on this check' + 'error' => 'Cron job has not been configured yet' . CronScriptReadinessCheck::OTHER_CHECKS_WILL_FAIL_MSG ]; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkSetup()); } @@ -49,9 +47,7 @@ class CronScriptReadinessCheckTest extends \PHPUnit_Framework_TestCase $this->read->expects($this->once())->method('readFile')->willReturn(''); $expected = [ 'success' => false, - 'error' => 'Cron Job has not been configured yet' . - '<br/>PHP Version, PHP Settings and PHP Extensions Check' . - ' will fail because they depend on this check' + 'error' => 'Cron job has not been configured yet' . CronScriptReadinessCheck::OTHER_CHECKS_WILL_FAIL_MSG ]; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkSetup()); } @@ -79,7 +75,7 @@ class CronScriptReadinessCheckTest extends \PHPUnit_Framework_TestCase $this->read->expects($this->once())->method('readFile')->willReturn(json_encode($json)); $expected = [ 'success' => true, - 'notice' => 'It is recommended to schedule Cron to run every 1 minute' + 'notice' => 'We recommend you schedule cron to run every 1 minute' ]; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkSetup()); } @@ -93,8 +89,8 @@ class CronScriptReadinessCheckTest extends \PHPUnit_Framework_TestCase $this->read->expects($this->once())->method('readFile')->willReturn(json_encode($json)); $expected = [ 'success' => true, - 'notice' => 'Unable to determine Cron time interval. ' . - 'It is recommended to schedule Cron to run every 1 minute' + 'notice' => 'Unable to determine cron time interval. ' . + 'We recommend you schedule cron to run every 1 minute' ]; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkSetup()); } @@ -116,14 +112,14 @@ class CronScriptReadinessCheckTest extends \PHPUnit_Framework_TestCase $this->read->expects($this->once()) ->method('readFile') ->willThrowException(new FileSystemException(new Phrase(''))); - $expected = ['success' => false, 'error' => 'Cron Job has not been configured yet']; + $expected = ['success' => false, 'error' => 'Cron job has not been configured yet']; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkUpdater()); } public function testCheckUpdaterNoCronConfigured() { $this->read->expects($this->once())->method('readFile')->willReturn(''); - $expected = ['success' => false, 'error' => 'Cron Job has not been configured yet']; + $expected = ['success' => false, 'error' => 'Cron job has not been configured yet']; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkUpdater()); } @@ -152,7 +148,7 @@ class CronScriptReadinessCheckTest extends \PHPUnit_Framework_TestCase $this->read->expects($this->once())->method('readFile')->willReturn(json_encode($json)); $expected = [ 'success' => true, - 'notice' => 'It is recommended to schedule Cron to run every 1 minute' + 'notice' => 'We recommend you schedule cron to run every 1 minute' ]; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkUpdater()); } @@ -168,8 +164,8 @@ class CronScriptReadinessCheckTest extends \PHPUnit_Framework_TestCase $this->read->expects($this->once())->method('readFile')->willReturn(json_encode($json)); $expected = [ 'success' => true, - 'notice' => 'Unable to determine Cron time interval. ' . - 'It is recommended to schedule Cron to run every 1 minute' + 'notice' => 'Unable to determine cron time interval. ' . + 'We recommend you schedule cron to run every 1 minute' ]; $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkUpdater()); } diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php index 28f5eea3921cc39fc00f315a8ef694380f017f3e..30d4ba681439f2a60eadcd44f3e6fa1f5872c32b 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php @@ -53,10 +53,6 @@ class InstallerFactoryTest extends \PHPUnit_Framework_TestCase 'Magento\Framework\Filesystem', $this->getMock('Magento\Framework\Filesystem', [], [], '', false), ], - [ - 'Magento\Setup\Model\SampleData', - $this->getMock('Magento\Setup\Model\SampleData', [], [], '', false), - ], [ 'Magento\Setup\Model\ObjectManagerProvider', $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false), @@ -81,6 +77,14 @@ class InstallerFactoryTest extends \PHPUnit_Framework_TestCase 'Magento\Setup\Validator\DbValidator', $this->getMock('Magento\Setup\Validator\DbValidator', [], [], '', false), ], + [ + 'Magento\Setup\Module\SetupFactory', + $this->getMock('Magento\Setup\Module\SetupFactory', [], [], '', false), + ], + [ + 'Magento\Setup\Module\DataSetupFactory', + $this->getMock('Magento\Setup\Module\DataSetupFactory', [], [], '', false), + ], ]; $serviceLocatorMock = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface', ['get']); $serviceLocatorMock diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php index 295c572b9b55021b4b138333916afce2049abbcf..ac7907be62fbf0dc23001f951de9bc9141e563c4 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php @@ -91,11 +91,6 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ private $filesystem; - /** - * @var \Magento\Setup\Model\SampleData|\PHPUnit_Framework_MockObject_MockObject - */ - private $sampleData; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -116,6 +111,16 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ private $dbValidator; + /** + * @var \Magento\Setup\Module\SetupFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $setupFactory; + + /** + * @var \Magento\Setup\Module\DataSetupFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $dataSetupFactory; + /** * Sample DB configuration segment * @@ -155,12 +160,13 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $this->connection = $this->getMockForAbstractClass('Magento\Framework\DB\Adapter\AdapterInterface'); $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false); $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); - $this->sampleData = $this->getMock('Magento\Setup\Model\SampleData', [], [], '', false); $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); $this->contextMock = $this->getMock('Magento\Framework\Model\Resource\Db\Context', [], [], '', false); $this->configModel = $this->getMock('Magento\Setup\Model\ConfigModel', [], [], '', false); $this->cleanupFiles = $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false); $this->dbValidator = $this->getMock('Magento\Setup\Validator\DbValidator', [], [], '', false); + $this->setupFactory = $this->getMock('Magento\Setup\Module\SetupFactory', [], [], '', false); + $this->dataSetupFactory = $this->getMock('Magento\Setup\Module\DataSetupFactory', [], [], '', false); $this->object = $this->createObject(); } @@ -194,12 +200,13 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $connectionFactory, $this->maintenanceMode, $this->filesystem, - $this->sampleData, $objectManagerProvider, $this->contextMock, $this->configModel, $this->cleanupFiles, - $this->dbValidator + $this->dbValidator, + $this->setupFactory, + $this->dataSetupFactory ); } @@ -233,11 +240,11 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $appState = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( 'Magento\Framework\App\State' ); + $this->setupFactory->expects($this->atLeastOnce())->method('create')->with($resource)->willReturn($setup); + $this->dataSetupFactory->expects($this->atLeastOnce())->method('create')->willReturn($dataSetup); $this->objectManager->expects($this->any()) ->method('create') ->will($this->returnValueMap([ - ['Magento\Setup\Module\Setup', ['resource' => $resource], $setup], - ['Magento\Setup\Module\DataSetup', [], $dataSetup], ['Magento\Framework\App\Cache\Manager', [], $cacheManager], ['Magento\Framework\App\State', [], $appState], ])); diff --git a/setup/src/Magento/Setup/Test/Unit/Model/ModuleStatusFactoryTest.php b/setup/src/Magento/Setup/Test/Unit/Model/ModuleStatusFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..546734478d9f6876548883ca6d95672a6795cad5 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Model/ModuleStatusFactoryTest.php @@ -0,0 +1,48 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Model; + +use Magento\Setup\Model\ModuleStatusFactory; + +class ModuleStatusFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ModuleStatusFactory + */ + private $moduleStatusFactory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\ObjectManagerProvider + */ + private $objectManagerProvider; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\ObjectManagerInterface + */ + private $objectManager; + + public function setUp() + { + $this->objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $this->objectManager = $this->getMockForAbstractClass( + 'Magento\Framework\ObjectManagerInterface', + [], + '', + false + ); + } + + public function testCreate() + { + $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager); + $this->objectManager->expects($this->once()) + ->method('get') + ->with('Magento\Framework\Module\Status'); + $this->moduleStatusFactory = new ModuleStatusFactory($this->objectManagerProvider); + $this->moduleStatusFactory->create(); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Model/SampleDataTest.php b/setup/src/Magento/Setup/Test/Unit/Model/SampleDataTest.php deleted file mode 100644 index 711fa29d624655647c7461f4ecb6c43b9a09b51d..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Test/Unit/Model/SampleDataTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Test\Unit\Model; - -use Magento\Setup\Model\SampleData; - -/** - * Test Magento\Setup\Model\SampleData - */ -class SampleDataTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Setup\Model\SampleData - */ - protected $sampleDataInstall; - - /** - * @var \Magento\Framework\Setup\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $loggerInterface; - - /** - * @var \Magento\Framework\App\Filesystem\DirectoryList|\PHPUnit_Framework_MockObject_MockObject - */ - protected $directoryList; - - protected function setUp() - { - $this->loggerInterface = $this->getMock('Magento\Framework\Setup\LoggerInterface'); - $this->directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false); - $this->sampleDataInstall = new SampleData($this->directoryList); - } - - public function testIsDeployed() - { - $this->directoryList->expects($this->once())->method('getPath')->with('code'); - $this->sampleDataInstall->isDeployed(); - } - - /** - * Test SampleData installation check method. - * Can be tested only negative case because file_exists method used in the tested class - */ - public function testIsInstalledSuccessfully() - { - $this->assertFalse($this->sampleDataInstall->isInstalledSuccessfully()); - } - - public function testIsInstallationError() - { - $this->directoryList->expects($this->once())->method('getPath')->with('code')->willReturn(null); - $this->assertFalse($this->sampleDataInstall->isInstalledSuccessfully()); - } -} diff --git a/setup/src/Magento/Setup/Test/Unit/Module/SetupFactoryTest.php b/setup/src/Magento/Setup/Test/Unit/Module/SetupFactoryTest.php index 750f40555eefa801cc2b8f35b7835be791765535..84223f475c199570e29e09290241be23205d59a9 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/SetupFactoryTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/SetupFactoryTest.php @@ -21,4 +21,15 @@ class SetupFactoryTest extends \PHPUnit_Framework_TestCase $factory = new SetupFactory($objectManagerProvider); $this->assertInstanceOf('Magento\Setup\Module\Setup', $factory->create()); } + + public function testCreateWithParam() + { + $objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface', [], '', false); + $objectManager->expects($this->never())->method('get'); + $resource = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); + $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager); + $factory = new SetupFactory($objectManagerProvider); + $this->assertInstanceOf('Magento\Setup\Module\Setup', $factory->create($resource)); + } } diff --git a/setup/view/magento/setup/complete-backup/progress.phtml b/setup/view/magento/setup/complete-backup/progress.phtml index 7879d75fd4dad495ebbc760a7fd686a4c8b1c2e8..030290da9cf4db51f3fa2343932c9149b3690d35 100644 --- a/setup/view/magento/setup/complete-backup/progress.phtml +++ b/setup/view/magento/setup/complete-backup/progress.phtml @@ -42,7 +42,7 @@ <span></span><span></span><span></span><span></span> <span></span><span></span><span></span><span></span> </span> - <h3 class="readiness-check-title">Checking available space in disk for taking backups...</h3> + <h3 class="readiness-check-title">Checking available disk space for backups</h3> </div> <div ng-show="check.processed" ng-switch="check.responseType"> @@ -66,7 +66,7 @@ <div class="readiness-check-content"> <h3 class="readiness-check-title">Check disk space availability</h3> <p> - Check available disk space for backup and try again. + Insufficient disk space available. Free up some space and try the backup again. </p> <p> Error received from server: @@ -97,8 +97,8 @@ <div class="readiness-check-content"> <h3 class="readiness-check-title">Store in maintenance mode</h3> <p> - Your store will be in maintenance mode until you complete the {{type}} - and maintenance mode is automatically lifted. + Your store is in maintenance mode and will automatically + return online after the {{type}}. </p> </div> diff --git a/setup/view/magento/setup/component-grid.phtml b/setup/view/magento/setup/component-grid.phtml index 8472d5e72af629a425c3a6cb21d21ab5bfec53c0..4b8e5a6ce13855e0b521656b42681c5097fa2f18 100644 --- a/setup/view/magento/setup/component-grid.phtml +++ b/setup/view/magento/setup/component-grid.phtml @@ -147,12 +147,20 @@ <!-- wrapper and .action-menu to show actions --> <div class="action-select-wrap" ng-class="{'_active' : isActiveActionsCell(component)}"> <button class="action-select" - ng-show="component.update || component.uninstall" + ng-show="component.update || component.uninstall || !component.disable || !component.update" ng-click="toggleActiveActionsCell(component)" ng-blur="closeActiveActionsCell(component)"> <span>Select</span> </button> <ul class="action-menu" ng-class="{'_active' : isActiveActionsCell(component)}"> + <li ng-class="{'hide': !component.disable}" + ng-mousedown="enableDisable('enable', component)"> + <a class="action-menu-item">Enable</a> + </li> + <li ng-class="{'hide': !component.enable}" + ng-mousedown="enableDisable('disable', component)"> + <a class="action-menu-item">Disable</a> + </li> <li ng-class="{'hide': !component.update}" ng-mousedown="update(component)"> <a class="action-menu-item">Update</a> diff --git a/setup/view/magento/setup/create-backup.phtml b/setup/view/magento/setup/create-backup.phtml index 08b51c261a4e06eba9ff48a70ed5f6435fd07185..b4f12e3516bae957911064c4c9957a5c28f51b65 100644 --- a/setup/view/magento/setup/create-backup.phtml +++ b/setup/view/magento/setup/create-backup.phtml @@ -49,7 +49,7 @@ <div class="message message-warning"> <span class="message-text"> <strong>We’ll put your store in maintenance mode to protect your shoppers during the {{type}}. - You cannot cancel this {{type}} process.</strong> + After this point, you cannot cancel the {{type}}.</strong> </span> </div> <div class="row form-row"> diff --git a/setup/view/magento/setup/home.phtml b/setup/view/magento/setup/home.phtml index 6bc75f3aaaf9b5eed0250accb76bf829593be5c5..4c0a1dc6b0ca8a86126f390625495bf14022695b 100644 --- a/setup/view/magento/setup/home.phtml +++ b/setup/view/magento/setup/home.phtml @@ -20,7 +20,7 @@ <div class="col-m-5"> <a class="setup-home-item setup-home-item-upgrader" ui-sref="root.upgrade"> <span class="setup-home-item-title">System Upgrade</span> - <span class="setup-home-item-description">I want to upgrade my Magento Admin version.</span> + <span class="setup-home-item-description">I want to upgrade my Magento core version.</span> </a> </div> </div> diff --git a/setup/view/magento/setup/navigation/menu.phtml b/setup/view/magento/setup/navigation/menu.phtml index b99caa38ad849d3b83009970bf1071ab85ff37fe..e9e352e3f6fff62f21a0d0a2fe3cbdec688c398d 100644 --- a/setup/view/magento/setup/navigation/menu.phtml +++ b/setup/view/magento/setup/navigation/menu.phtml @@ -19,7 +19,7 @@ <div> <nav ng-controller="navigationController" id="menu" class="nav ng-scope show" - ng-hide="$state.current.noMenu || $state.current.main"> + ng-hide="$state.current.noMenu || $state.current.main || $state.current.default"> <ul class="nav-bar"> <li ng-repeat="menuState in menu | filter: {type: $state.current.type}" ng-class="{active: $state.includes(menuState.id), disabled: itemStatus(menuState.order)}"> diff --git a/setup/view/magento/setup/readiness-check/progress.phtml b/setup/view/magento/setup/readiness-check/progress.phtml index 072f88f80045f3d089645367c927052696ed1714..a7498e98ac636b7d762f5b67d8c594925b280cf5 100755 --- a/setup/view/magento/setup/readiness-check/progress.phtml +++ b/setup/view/magento/setup/readiness-check/progress.phtml @@ -75,9 +75,12 @@ </a> </p> <p ng-show="updater.expanded"> - Please, download and install Updater application. + Download and install the updater. + </p> + <p ng-show="updater.expanded">For additional assistance, see + <a href="http://devdocs.magento.com/guides/v2.0/comp-mgr/trouble/cman/updater.html" + target="_blank">updater application help</a>. </p> - <p ng-show="updater.expanded">For additional assistance, see</p> </div> </div> @@ -125,7 +128,10 @@ </p> <p ng-show="cronScript.expanded" ng-bind-html="cronScript.updaterErrorMessage"> </p> - <p ng-show="cronScript.expanded">For additional assistance, see</p> + <p ng-show="cronScript.expanded">For additional assistance, see + <a href="http://devdocs.magento.com/guides/v2.0/comp-mgr/trouble/cman/cron.html" + target="_blank">cron scripts help</a>. + </p> </div> </div> </div> @@ -164,7 +170,11 @@ </p> <p ng-show="componentDependency.expanded" ng-bind-html="componentDependency.errorMessage"> </p> - <p ng-show="componentDependency.expanded">For additional assistance, see</p> + <p ng-show="componentDependency.expanded">For additional assistance, see + <a href="http://devdocs.magento.com/guides/v2.0/comp-mgr/trouble/cman/component-depend.html" + target="_blank">component dependency help + </a>. + </p> </div> </div> </div> @@ -217,9 +227,9 @@ </a> </p> <p ng-show="version.expanded"> - Download and install PHP version {{version.data.required}} from <a href="http://www.php.net" target="_blank">www.php.net</a> using this <a href="http://www.php.net/docs.php" target="_blank">PHP Documentation</a>. + Download and install PHP from <a href="http://www.php.net" target="_blank">www.php.net</a> using this <a href="http://www.php.net/docs.php" target="_blank">PHP Documentation</a>. </p> - <p ng-show="version.expanded">If you need more help please call your hosting provider.</p> + <p ng-show="version.expanded">For additional assistance, contact your hosting provider.</p> </div> </div> @@ -273,6 +283,13 @@ </p> </div> </div> + + <p ng-show="componentDependency.expanded">For additional assistance, see + <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/trouble/php/tshoot_php-set.html" + target="_blank">PHP settings check help + </a>. + </p> + </div> </div> @@ -345,10 +362,10 @@ <p> The best way to resolve this is to install the correct missing extensions. The exact fix depends on our server, your host, and other system variables. <br> - Our <a href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html" target="_blank">PHP Extension Help</a> can get you started. + Our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html" target="_blank">PHP extension help</a> can get you started. </p> <p> - If you need more help, please call your hosting provider. + For additional assistance, contact your hosting provider. </p> <ul class="list" ng-show="extensions.expanded"> <li @@ -431,7 +448,7 @@ <p> The best way to resolve this is to allow write permissions for the following Magento directories. The exact fix depends on your server, your host, and other system variables. <br> - Our <a href="http://devdocs.magento.com/guides/v1.0/install-gde/install/composer-clone.html#instgde-prereq-compose-access" target="_blank">File Permission Help</a> can get you started. + Our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/cman/tshoot_install_perms.html" target="_blank">File Permission Help</a> can get you started. </p> <p> If you need more help, please call your hosting provider. diff --git a/setup/view/magento/setup/select-version.phtml b/setup/view/magento/setup/select-version.phtml index 28bbdce6e3e0cd961925ffff4562760714c0234e..7a2f7db61910a64ff7fed4217645d252d97e38bc 100644 --- a/setup/view/magento/setup/select-version.phtml +++ b/setup/view/magento/setup/select-version.phtml @@ -114,8 +114,8 @@ <div class="admin__data-grid-outer-wrap" ng-show="componentsProcessed && total > 0"> <div class="row" ng-show="!upgradeProcessError"> <label class="form-label"> - The other components below will be upgraded. <br/> - If you don't want some components updated, please de-select them. + We'll update the following components for you at the same time. <br/> + If you don't want some components updated, change the slider to No. </label> <br/> <br/> diff --git a/setup/view/magento/setup/start-updater.phtml b/setup/view/magento/setup/start-updater.phtml index 7cf049af600fea74dd2dea6c28fa4483238f5f1e..0459ff9d45ee6955cf34dfab940f1b5c989e5d20 100644 --- a/setup/view/magento/setup/start-updater.phtml +++ b/setup/view/magento/setup/start-updater.phtml @@ -24,8 +24,8 @@ <div class="readiness-check-content"> <h3 class="readiness-check-title">Store in maintenance mode</h3> <p> - Your store will be in maintenance mode until you complete the {{type}} - and maintenance mode is automatically lifted. + Your store is in maintenance mode and will automatically + return online after the {{type}}. </p> </div> </div> @@ -50,8 +50,7 @@ ng-show="maintenanceCalled == maintenanceStatus" > <div ng-repeat="package in packages"> - <div>{{package.name}} is ready to be - {{successPageAction}}{{package.version ? ' to ' + package.version : ''}}. </div> + <div>We're ready to {{type}} {{package.name}}{{package.version ? ' to ' + package.version : ''}}. </div> </div> <br/> <button