From 907e166931735f3768bfc1dd855f8d9bb49a52d6 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Wed, 27 Jul 2016 19:05:52 +0300 Subject: [PATCH 01/17] MAGETWO-55854: [FF, IE10] Switching between tabs doesn't work --- app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js b/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js index ad4d680771c07..e598b5f567a84 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js @@ -213,7 +213,7 @@ define([ modal.closeModal(); } }, - showSpecificStep: function () { + showSpecificStep: function (data, event) { var index = _.indexOf(this.stepsNames, event.target.hash.substr(1)), stepName = this.wizard.move(index); From 9cb1818f9ad7a7ce7c596be8849a391c486e5a65 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Thu, 28 Jul 2016 11:04:07 +0300 Subject: [PATCH 02/17] MAGETWO-55896: Storefront: My Orders: Missing an Action column header --- .../Magento/Sales/view/frontend/templates/order/history.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml index a57c68d17258f..47ea803530f14 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml @@ -21,7 +21,7 @@ -   + From f054b5c3a8566ada0ad35a74ff2fa6ddce2f393e Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Thu, 28 Jul 2016 16:02:17 +0300 Subject: [PATCH 03/17] MAGETWO-54716: Unable to setup Magento via web installer --- .../Command/SampleDataDeployCommand.php | 21 +++ .../Command/SampleDataDeployCommandTest.php | 151 +++++++++++++++--- 2 files changed, 151 insertions(+), 21 deletions(-) diff --git a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php index 668c22073f00a..61ad377b841a6 100644 --- a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php +++ b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php @@ -17,6 +17,7 @@ use Magento\Framework\Filesystem; use Composer\Console\Application; use Composer\Console\ApplicationFactory; +use Magento\Setup\Model\PackagesAuth; /** * Command for deployment of Sample Data @@ -79,6 +80,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $this->updateMemoryLimit(); + $this->createAuthFile(); $sampleDataPackages = $this->sampleDataDependency->getSampleDataPackages(); if (!empty($sampleDataPackages)) { $baseDir = $this->filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath(); @@ -107,6 +109,25 @@ protected function execute(InputInterface $input, OutputInterface $output) } } + /** + * Create new auth.json file if it doesn't exist. + * + * @return void + * @throws \Exception + */ + private function createAuthFile() + { + $directory = $this->filesystem->getDirectoryWrite(DirectoryList::COMPOSER_HOME); + + if (!$directory->isExist(PackagesAuth::PATH_TO_AUTH_FILE)) { + try { + $directory->writeFile(PackagesAuth::PATH_TO_AUTH_FILE, '{}'); + } catch (\Exception $e) { + throw new \Exception('Error in writing Auth file. Please check permissions for writing.'); + } + } + } + /** * @return void */ diff --git a/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php b/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php index b3146087e8bd1..1294384d51afa 100644 --- a/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php +++ b/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php @@ -7,36 +7,103 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\SampleData\Console\Command\SampleDataDeployCommand; +use Magento\Setup\Model\PackagesAuth; use Symfony\Component\Console\Tester\CommandTester; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Filesystem\Directory\WriteInterface; +use Magento\SampleData\Model\Dependency; +use Symfony\Component\Console\Input\ArrayInputFactory; +use Composer\Console\ApplicationFactory; +use Composer\Console\Application; class SampleDataDeployCommandTest extends \PHPUnit_Framework_TestCase { + /** + * @var ReadInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $directoryReadMock; + + /** + * @var WriteInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $directoryWriteMock; + + /** + * @var Filesystem|\PHPUnit_Framework_MockObject_MockObject + */ + private $filesystemMock; + + /** + * @var Dependency|\PHPUnit_Framework_MockObject_MockObject + */ + private $sampleDataDependencyMock; + + /** + * @var ArrayInputFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $arrayInputFactoryMock; + + /** + * @var Application|\PHPUnit_Framework_MockObject_MockObject + */ + private $applicationMock; + + /** + * @var ApplicationFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $applicationFactoryMock; + + /** + * @return void + */ + protected function setUp() + { + $this->directoryReadMock = $this->getMock(ReadInterface::class, [], [], '', false); + $this->directoryWriteMock = $this->getMock(WriteInterface::class, [], [], '', false); + $this->filesystemMock = $this->getMock(Filesystem::class, [], [], '', false); + $this->sampleDataDependencyMock = $this->getMock(Dependency::class, [], [], '', false); + $this->arrayInputFactoryMock = $this->getMock(ArrayInputFactory::class, [], [], '', false); + $this->applicationMock = $this->getMock(Application::class, [], [], '', false); + $this->applicationFactoryMock = $this->getMock(ApplicationFactory::class, ['create'], [], '', false); + } + /** * @param array $sampleDataPackages * @param int $appRunResult - int 0 if everything went fine, or an error code * @param string $expectedMsg + * @param bool $authExist * @return void * * @dataProvider processDataProvider */ - public function testExecute(array $sampleDataPackages, $appRunResult, $expectedMsg) + public function testExecute(array $sampleDataPackages, $appRunResult, $expectedMsg, $authExist) { - $directoryRead = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface', [], [], '', false); - $directoryRead->expects($this->any())->method('getAbsolutePath')->willReturn('/path/to/composer.json'); - - $filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); - $filesystem->expects($this->any())->method('getDirectoryRead')->with(DirectoryList::ROOT) - ->willReturn($directoryRead); + $pathToComposerJson = '/path/to/composer.json'; - $sampleDataDependency = $this->getMock('Magento\SampleData\Model\Dependency', [], [], '', false); - $sampleDataDependency - ->expects($this->any()) + $this->directoryReadMock->expects($this->any()) + ->method('getAbsolutePath') + ->willReturn($pathToComposerJson); + $this->directoryWriteMock->expects($this->once()) + ->method('isExist') + ->with(PackagesAuth::PATH_TO_AUTH_FILE) + ->willReturn($authExist); + $this->directoryWriteMock->expects($authExist ? $this->never() : $this->once()) + ->method('writeFile') + ->with(PackagesAuth::PATH_TO_AUTH_FILE, '{}'); + $this->filesystemMock->expects($this->any()) + ->method('getDirectoryRead') + ->with(DirectoryList::ROOT) + ->willReturn($this->directoryReadMock); + $this->filesystemMock->expects($this->once()) + ->method('getDirectoryWrite') + ->with(DirectoryList::COMPOSER_HOME) + ->willReturn($this->directoryWriteMock); + $this->sampleDataDependencyMock->expects($this->any()) ->method('getSampleDataPackages') ->willReturn($sampleDataPackages); - - $arrayInputFactory = $this - ->getMock('Symfony\Component\Console\Input\ArrayInputFactory', ['create'], [], '', false); - $arrayInputFactory->expects($this->never())->method('create'); + $this->arrayInputFactoryMock->expects($this->never()) + ->method('create'); array_walk($sampleDataPackages, function (&$v, $k) { $v = "$k:$v"; @@ -46,24 +113,32 @@ public function testExecute(array $sampleDataPackages, $appRunResult, $expectedM $requireArgs = [ 'command' => 'require', - '--working-dir' => '/path/to/composer.json', + '--working-dir' => $pathToComposerJson, '--no-progress' => 1, 'packages' => $packages, ]; $commandInput = new \Symfony\Component\Console\Input\ArrayInput($requireArgs); - $application = $this->getMock('Composer\Console\Application', [], [], '', false); - $application->expects($this->any())->method('run') + $this->applicationMock->expects($this->any()) + ->method('run') ->with($commandInput, $this->anything()) ->willReturn($appRunResult); + if (($appRunResult !== 0) && !empty($sampleDataPackages)) { - $application->expects($this->once())->method('resetComposer')->willReturnSelf(); + $this->applicationMock->expects($this->once())->method('resetComposer')->willReturnSelf(); } - $applicationFactory = $this->getMock('Composer\Console\ApplicationFactory', ['create'], [], '', false); - $applicationFactory->expects($this->any())->method('create')->willReturn($application); + + $this->applicationFactoryMock->expects($this->any()) + ->method('create') + ->willReturn($this->applicationMock); $commandTester = new CommandTester( - new SampleDataDeployCommand($filesystem, $sampleDataDependency, $arrayInputFactory, $applicationFactory) + new SampleDataDeployCommand( + $this->filesystemMock, + $this->sampleDataDependencyMock, + $this->arrayInputFactoryMock, + $this->applicationFactoryMock + ) ); $commandTester->execute([]); @@ -80,6 +155,7 @@ public function processDataProvider() 'sampleDataPackages' => [], 'appRunResult' => 1, 'expectedMsg' => 'There is no sample data for current set of modules.' . PHP_EOL, + 'authExist' => true, ], [ 'sampleDataPackages' => [ @@ -88,6 +164,7 @@ public function processDataProvider() 'appRunResult' => 1, 'expectedMsg' => 'There is an error during sample data deployment. Composer file will be reverted.' . PHP_EOL, + 'authExist' => false, ], [ 'sampleDataPackages' => [ @@ -95,7 +172,39 @@ public function processDataProvider() ], 'appRunResult' => 0, 'expectedMsg' => '', + 'authExist' => true, ], ]; } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Error in writing Auth file. Please check permissions for writing. + * @return void + */ + public function testExecuteWithException() + { + $this->directoryWriteMock->expects($this->once()) + ->method('isExist') + ->with(PackagesAuth::PATH_TO_AUTH_FILE) + ->willReturn(false); + $this->directoryWriteMock->expects($this->once()) + ->method('writeFile') + ->with(PackagesAuth::PATH_TO_AUTH_FILE, '{}') + ->willThrowException(new \Exception('Something went wrong...')); + $this->filesystemMock->expects($this->once()) + ->method('getDirectoryWrite') + ->with(DirectoryList::COMPOSER_HOME) + ->willReturn($this->directoryWriteMock); + + $commandTester = new CommandTester( + new SampleDataDeployCommand( + $this->filesystemMock, + $this->sampleDataDependencyMock, + $this->arrayInputFactoryMock, + $this->applicationFactoryMock + ) + ); + $commandTester->execute([]); + } } From e59af3042eb96f7f9d1838d04492b40c988f1a70 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Thu, 28 Jul 2016 16:36:29 +0300 Subject: [PATCH 04/17] MAGETWO-54716: Unable to setup Magento via web installer --- .../SampleData/Console/Command/SampleDataDeployCommand.php | 1 + .../Test/Unit/Console/Command/SampleDataDeployCommandTest.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php index 61ad377b841a6..91f14860808c0 100644 --- a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php +++ b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php @@ -21,6 +21,7 @@ /** * Command for deployment of Sample Data + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SampleDataDeployCommand extends Command { diff --git a/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php b/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php index 1294384d51afa..50a098724463d 100644 --- a/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php +++ b/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php @@ -17,6 +17,9 @@ use Composer\Console\ApplicationFactory; use Composer\Console\Application; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class SampleDataDeployCommandTest extends \PHPUnit_Framework_TestCase { /** From 1a09ba255626043137351e94610cdba508a6058c Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Mon, 1 Aug 2016 12:00:51 +0300 Subject: [PATCH 05/17] MAGETWO-53428: Product catalog Import/export - Date & Timezone issue --- .../Model/Export/Product.php | 20 ++++++++++++++++++- .../Model/Import/Product.php | 17 +++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php index 441fb60f55ec4..db67793e4b40d 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php @@ -254,6 +254,16 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity 'tax_class_id' => 'tax_class_name', ]; + /** + * Attributes codes which shows as date + * + * @var array + */ + protected $dateAttrCodes = [ + 'special_from_date', + 'special_to_date' + ]; + /** * Attributes codes which are appropriate for export and not the part of additional_attributes. * @@ -897,7 +907,15 @@ protected function collectRawData() } $fieldName = isset($this->_fieldsMap[$code]) ? $this->_fieldsMap[$code] : $code; - if ($this->_attributeTypes[$code] === 'datetime') { + if (in_array($code, $this->dateAttrCodes)) { + $attrValue = $this->_localeDate->formatDateTime( + new \DateTime($attrValue), + \IntlDateFormatter::SHORT, + \IntlDateFormatter::NONE, + null, + date_default_timezone_get() + ); + } else if ($this->_attributeTypes[$code] === 'datetime') { $attrValue = $this->_localeDate->formatDateTime( new \DateTime($attrValue), \IntlDateFormatter::SHORT, diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 970b8a1aaea0f..06448c1360ddc 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -209,6 +209,16 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity '_upsell_' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, ]; + /** + * Attributes codes which shows as date + * + * @var array + */ + protected $dateAttrCodes = [ + 'special_from_date', + 'special_to_date' + ]; + /** * Need to log in import history * @@ -1642,7 +1652,12 @@ protected function _saveProducts() $attrTable = $attribute->getBackend()->getTable(); $storeIds = [0]; - if ('datetime' == $attribute->getBackendType() && strtotime($attrValue)) { + if ( + 'datetime' == $attribute->getBackendType() + && in_array($attribute->getAttributeCode(), $this->dateAttrCodes) + ) { + $attrValue = $this->dateTime->formatDate($attrValue, false); + } else if ('datetime' == $attribute->getBackendType() && strtotime($attrValue)) { $attrValue = $this->dateTime->gmDate( 'Y-m-d H:i:s', $this->_localeDate->date($attrValue)->getTimestamp() From 21b420943b95d3682cb7d893fcf341386be064f5 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Mon, 1 Aug 2016 14:13:38 +0300 Subject: [PATCH 06/17] MAGETWO-55856: Merchant can't see the whole name in Columns Dropdown on Data-Grid --- .../Ui/view/base/web/templates/grid/controls/columns.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html index c14044de44eb2..113806471bc9b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html @@ -16,7 +16,9 @@ disable="isDisabled($col())" ko-checked="$col().visible" attr="id: ++ko.uid"/> -