From 4cdc13319ae5dccef8973ee04ac4bf2c5fe9f0a9 Mon Sep 17 00:00:00 2001 From: Tim Bezhashvyly Date: Wed, 11 Oct 2017 08:06:16 +0200 Subject: [PATCH 1/9] Issue #6924: Unmask exception message during product import Probably a typo. Exception message was passed as a exception description argument instead of exception message. Artefact of optional parameters. --- app/code/Magento/ImportExport/Model/Import.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index 8da1bb1763ece..092b721b82435 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -567,7 +567,6 @@ public function validateSource(\Magento\ImportExport\Model\Import\AbstractSource ProcessingError::ERROR_LEVEL_CRITICAL, null, null, - null, $e->getMessage() ); } From 720496ccfa3baedb8e0435df442bc32de19b2bcc Mon Sep 17 00:00:00 2001 From: Denis Ristic Date: Fri, 13 Oct 2017 12:34:15 +0200 Subject: [PATCH 2/9] Magento setup:install interactive shell --- .../Setup/Console/Command/InstallCommand.php | 111 +++++++++++++++++- 1 file changed, 106 insertions(+), 5 deletions(-) diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php index b0ccbba8c296f..98423c26d39e2 100644 --- a/setup/src/Magento/Setup/Console/Command/InstallCommand.php +++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php @@ -13,6 +13,9 @@ use Magento\Framework\Setup\ConsoleLogger; use Symfony\Component\Console\Input\InputOption; use Magento\Setup\Model\ConfigModel; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Helper\QuestionHelper; /** * Command to install Magento application @@ -35,6 +38,16 @@ class InstallCommand extends AbstractSetupCommand */ const INPUT_KEY_USE_SAMPLE_DATA = 'use-sample-data'; + /** + * Parameter indicating command for interactive setup + */ + const INPUT_KEY_INTERACTIVE_SETUP = 'interactive'; + + /** + * Parameter indicating command shortcut for interactive setup + */ + const INPUT_KEY_INTERACTIVE_SETUP_SHORTCUT = 'i'; + /** * Regex for sales_order_increment_prefix validation. */ @@ -109,7 +122,13 @@ protected function configure() null, InputOption::VALUE_NONE, 'Use sample data' - ) + ), + new InputOption( + self::INPUT_KEY_INTERACTIVE_SETUP, + self::INPUT_KEY_INTERACTIVE_SETUP_SHORTCUT, + InputOption::VALUE_NONE, + 'Interactive Magento instalation' + ), ]); $this->setName('setup:install') ->setDescription('Installs the Magento application') @@ -139,12 +158,17 @@ protected function initialize(InputInterface $input, OutputInterface $output) { $inputOptions = $input->getOptions(); - $configOptionsToValidate = []; - foreach ($this->configModel->getAvailableOptions() as $option) { - if (array_key_exists($option->getName(), $inputOptions)) { - $configOptionsToValidate[$option->getName()] = $inputOptions[$option->getName()]; + if ($inputOptions['interactive']) { + $configOptionsToValidate = $this->interactiveQuestions($input, $output); + } else { + $configOptionsToValidate = []; + foreach ($this->configModel->getAvailableOptions() as $option) { + if (array_key_exists($option->getName(), $inputOptions)) { + $configOptionsToValidate[$option->getName()] = $inputOptions[$option->getName()]; + } } } + $errors = $this->configModel->validate($configOptionsToValidate); $errors = array_merge($errors, $this->adminUser->validate($input)); $errors = array_merge($errors, $this->validate($input)); @@ -177,4 +201,81 @@ public function validate(InputInterface $input) } return $errors; } + + /** + * Runs interactive questions + * + * It will ask users for interactive questionst regarding setup configuration. + * + * @param InputInterface $input + * @param OutputInterface $output + * @return string[] Array of inputs + */ + private function interactiveQuestions(InputInterface $input, OutputInterface $output) + { + $helper = $this->getHelper('question'); + $configOptionsToValidate = []; + foreach ($this->configModel->getAvailableOptions() as $option) { + + $configOptionsToValidate[$option->getName()] = $this->askQuestion($input, $output, $helper, $option); + + /*$question = new Question($option->getDescription() . '? ', $option->getDefault()); + $configOptionsToValidate[$option->getName()] = $helper->ask($input, $output, $question); + */ + } + return $configOptionsToValidate; + } + + /** + * Runs interactive questions + * + * It will ask users for interactive questionst regarding setup configuration. + * + * @param InputInterface $input + * @param OutputInterface $output + * @param QuestionHelper $helper + * @param Magento\Framework\Setup\Option\TextConfigOption|Magento\Framework\Setup\Option\FlagConfigOption\Magento\Framework\Setup\Option\SelectConfigOption $option + * @return string[] Array of inputs + */ + private function askQuestion(InputInterface $input, OutputInterface $output, QuestionHelper $helper, $option) + { + if (get_class($option) === 'Magento\Framework\Setup\Option\SelectConfigOption') { + if ($option->isValueRequired()) { + $question = new ChoiceQuestion( + $option->getDescription() . '? ', + $option->getSelectOptions(), + $option->getDefault() + ); + } else { + $question = new ChoiceQuestion( + $option->getDescription() . ' [optional]? ', + $option->getSelectOptions(), + $option->getDefault() + ); + } + $question->setValidator(function ($answer) use ($option) { + $option->validate($option->getSelectOptions()[$answer]); + return $answer; + }); + } else { + if ($option->isValueRequired()) { + $question = new Question( + $option->getDescription() . '? ', + $option->getDefault() + ); + } else { + $question = new Question( + $option->getDescription() . ' [optional]? ', + $option->getDefault() + ); + } + $question->setValidator(function ($answer) use ($option) { + $option->validate($answer); + return $answer; + }); + } + + $value = $helper->ask($input, $output, $question); + return $value; + } } From 0e4dd85af64b5d9ed035da373e80d6d3fb08e1f8 Mon Sep 17 00:00:00 2001 From: Denis Ristic Date: Fri, 13 Oct 2017 13:22:45 +0200 Subject: [PATCH 3/9] ADDED user and adminUser questions Code cleanup --- .../Setup/Console/Command/InstallCommand.php | 66 ++++++++++++++----- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php index 98423c26d39e2..467e94febef39 100644 --- a/setup/src/Magento/Setup/Console/Command/InstallCommand.php +++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php @@ -215,13 +215,33 @@ private function interactiveQuestions(InputInterface $input, OutputInterface $ou { $helper = $this->getHelper('question'); $configOptionsToValidate = []; + foreach ($this->configModel->getAvailableOptions() as $option) { + $configOptionsToValidate[$option->getName()] = $this->askQuestion( + $input, + $output, + $helper, + $option, + true + ); + } - $configOptionsToValidate[$option->getName()] = $this->askQuestion($input, $output, $helper, $option); + foreach ($this->userConfig->getOptionsList() as $option) { + $configOptionsToValidate[$option->getName()] = $this->askQuestion( + $input, + $output, + $helper, + $option + ); + } - /*$question = new Question($option->getDescription() . '? ', $option->getDefault()); - $configOptionsToValidate[$option->getName()] = $helper->ask($input, $output, $question); - */ + foreach ($this->adminUser->getOptionsList() as $option) { + $configOptionsToValidate[$option->getName()] = $this->askQuestion( + $input, + $output, + $helper, + $option + ); } return $configOptionsToValidate; } @@ -234,11 +254,17 @@ private function interactiveQuestions(InputInterface $input, OutputInterface $ou * @param InputInterface $input * @param OutputInterface $output * @param QuestionHelper $helper - * @param Magento\Framework\Setup\Option\TextConfigOption|Magento\Framework\Setup\Option\FlagConfigOption\Magento\Framework\Setup\Option\SelectConfigOption $option + * @param TextConfigOption|FlagConfigOption\SelectConfigOption $option + * @param Boolean $validateInline * @return string[] Array of inputs */ - private function askQuestion(InputInterface $input, OutputInterface $output, QuestionHelper $helper, $option) - { + private function askQuestion( + InputInterface $input, + OutputInterface $output, + QuestionHelper $helper, + $option, + $validateInline = false + ) { if (get_class($option) === 'Magento\Framework\Setup\Option\SelectConfigOption') { if ($option->isValueRequired()) { $question = new ChoiceQuestion( @@ -253,10 +279,6 @@ private function askQuestion(InputInterface $input, OutputInterface $output, Que $option->getDefault() ); } - $question->setValidator(function ($answer) use ($option) { - $option->validate($option->getSelectOptions()[$answer]); - return $answer; - }); } else { if ($option->isValueRequired()) { $question = new Question( @@ -269,13 +291,25 @@ private function askQuestion(InputInterface $input, OutputInterface $output, Que $option->getDefault() ); } - $question->setValidator(function ($answer) use ($option) { - $option->validate($answer); - return $answer; - }); + } + $question->setValidator(function ($answer) use ($option, $validateInline) { + $answer = trim($answer); + + if (get_class($option) === 'Magento\Framework\Setup\Option\SelectConfigOption') { + $answer = $option->getSelectOptions()[$answer]; + } + + if ($validateInline) { + $option->validate($answer); + } + + return $answer; + }); + $value = $helper->ask($input, $output, $question); + return $value; } -} +} \ No newline at end of file From ce12a7439fe03a690a5d5acb76dde333118c3d80 Mon Sep 17 00:00:00 2001 From: Denis Ristic Date: Fri, 13 Oct 2017 14:02:56 +0200 Subject: [PATCH 4/9] ADDED re-run command output FIXED phpcs validation --- .../Setup/Console/Command/InstallCommand.php | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php index 467e94febef39..a2e8715b02233 100644 --- a/setup/src/Magento/Setup/Console/Command/InstallCommand.php +++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php @@ -169,6 +169,14 @@ protected function initialize(InputInterface $input, OutputInterface $output) } } + if ($inputOptions['interactive']) { + $command = ''; + foreach ($configOptionsToValidate as $key => $value) { + $command .= " --{$key}={$value}"; + } + $output->writeln("Try re-running command: php bin/magento setup:install{$command}"); + } + $errors = $this->configModel->validate($configOptionsToValidate); $errors = array_merge($errors, $this->adminUser->validate($input)); $errors = array_merge($errors, $this->validate($input)); @@ -226,6 +234,8 @@ private function interactiveQuestions(InputInterface $input, OutputInterface $ou ); } + $output->writeln(""); + foreach ($this->userConfig->getOptionsList() as $option) { $configOptionsToValidate[$option->getName()] = $this->askQuestion( $input, @@ -235,6 +245,8 @@ private function interactiveQuestions(InputInterface $input, OutputInterface $ou ); } + $output->writeln(""); + foreach ($this->adminUser->getOptionsList() as $option) { $configOptionsToValidate[$option->getName()] = $this->askQuestion( $input, @@ -243,7 +255,17 @@ private function interactiveQuestions(InputInterface $input, OutputInterface $ou $option ); } - return $configOptionsToValidate; + + $output->writeln(""); + + $returnConfigOptionsToValidate = []; + foreach ($configOptionsToValidate as $key => $value) { + if ($value != '') { + $returnConfigOptionsToValidate[$key] = $value; + } + } + + return $returnConfigOptionsToValidate; } /** @@ -265,7 +287,7 @@ private function askQuestion( $option, $validateInline = false ) { - if (get_class($option) === 'Magento\Framework\Setup\Option\SelectConfigOption') { + if ($option instanceof \Magento\Framework\Setup\Option\SelectConfigOption) { if ($option->isValueRequired()) { $question = new ChoiceQuestion( $option->getDescription() . '? ', @@ -291,16 +313,20 @@ private function askQuestion( $option->getDefault() ); } - } $question->setValidator(function ($answer) use ($option, $validateInline) { - $answer = trim($answer); - if (get_class($option) === 'Magento\Framework\Setup\Option\SelectConfigOption') { + if ($option instanceof \Magento\Framework\Setup\Option\SelectConfigOption) { $answer = $option->getSelectOptions()[$answer]; } + if ($answer == null) { + $answer = ''; + } else { + $answer = trim($answer); + } + if ($validateInline) { $option->validate($answer); } @@ -312,4 +338,4 @@ private function askQuestion( return $value; } -} \ No newline at end of file +} From fb41335de5520b6669dde4091d63fb13d0890154 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 13 Oct 2017 16:26:23 +0300 Subject: [PATCH 5/9] magento/magento2#11363: Unmask exception message during product import - Test updated --- .../Magento/ImportExport/Model/ImportTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php index 5ba955430021f..332ca5fba75c7 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php @@ -135,6 +135,31 @@ public function testValidateSourceException() $this->_model->validateSource($source); } + public function testValidateSourceExceptionMessage() + { + $exceptionMessage = 'Test Exception Message.'; + + $validationStrategy = ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR; + $this->_model->setEntity('catalog_product'); + $this->_model->setData(\Magento\ImportExport\Model\Import::FIELD_NAME_VALIDATION_STRATEGY, $validationStrategy); + $this->_model->setData(\Magento\ImportExport\Model\Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 0); + + /** @var \Magento\ImportExport\Model\Import\AbstractSource|\PHPUnit_Framework_MockObject_MockObject $source */ + $source = $this->getMockForAbstractClass( + \Magento\ImportExport\Model\Import\AbstractSource::class, + [['sku', 'name']] + ); + $source->expects($this->any())->method('_getNextRow')->willThrowException( + new \Exception($exceptionMessage) + ); + + $this->assertFalse($this->_model->validateSource($source)); + $this->assertEquals( + $exceptionMessage, + $this->_model->getErrorAggregator()->getAllErrors()[0]->getErrorMessage() + ); + } + public function testGetEntity() { $entityName = 'entity_name'; From 026da5a013290db5ab003aea3009b56059fccbc3 Mon Sep 17 00:00:00 2001 From: magento-engcom-team Date: Thu, 26 Oct 2017 13:53:18 +0300 Subject: [PATCH 6/9] MAGEWTO-7640: X-Magento-Tags header containing whitespaces causes exception --- .../Framework/Config/Converter/Dom/Flat.php | 4 ++-- .../Unit/_files/converter/dom/flat/result.php | 7 +++++++ .../Unit/_files/converter/dom/flat/source.xml | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php b/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php index 67b8937442310..7f64705a6bde0 100644 --- a/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php +++ b/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php @@ -102,9 +102,9 @@ public function convert(\DOMNode $source, $basePath = '') } } else { if ($result) { - $result['value'] = $value; + $result['value'] = trim($value); } else { - $result = $value; + $result = trim($value); } } return $result; diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php index c724d6ef43b5b..c9894c96c20e4 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile return [ 'root' => [ 'node_one' => [ @@ -11,14 +12,20 @@ 'subnode' => [ ['attributeThree' => '30'], ['attributeThree' => '40', 'attributeFour' => '40', 'value' => 'Value1'], + ['attributeThree' => '50', 'value' => 'value_from_new_line'], + ['attributeThree' => '60', 'value' => 'auto_formatted_by_ide_value_due_to_line_size_restriction'] ], 'books' => ['attributeFive' => '50'], ], 'multipleNode' => [ 'one' => ['id' => 'one', 'name' => 'name1', 'value' => '1'], 'two' => ['id' => 'two', 'name' => 'name2', 'value' => '2'], + 'three' => ['id' => 'three', 'name' => 'name3', 'value' => 'value_from_new_line'], + 'four' => ['id' => 'four', 'name' => 'name4', 'value' => 'auto_formatted_by_ide_value_due_to_line_size_restriction'], ], 'someOtherVal' => '', 'someDataVal' => '', + 'valueFromNewLine' => 'value_from_new_line', + 'autoFormattedValue' => 'auto_formatted_by_ide_value_due_to_line_size_restriction' ] ]; diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml index e6b16b8552dd8..5071bdd286e64 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml @@ -9,6 +9,11 @@ Value1 + + value_from_new_line + + auto_formatted_by_ide_value_due_to_line_size_restriction + @@ -19,4 +24,18 @@ + + + value_from_new_line + + + + auto_formatted_by_ide_value_due_to_line_size_restriction + + + + value_from_new_line + + auto_formatted_by_ide_value_due_to_line_size_restriction + From 73272fe041c6fb4c0434ffed24cc995c3f01048b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Thu, 26 Oct 2017 18:01:50 +0300 Subject: [PATCH 7/9] MAGETWO-4711: Improve error reporting for products images import. --- .../Model/Import/Product.php | 1 + .../Test/Unit/Model/Import/ProductTest.php | 64 +++++++++++++++++++ .../Model/Import/ProductTest.php | 57 +++++++++++++++-- .../_files/magento_additional_image_error.jpg | 0 4 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/magento_additional_image_error.jpg diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index a0f1e25cf6512..84c3e7e7b5f5a 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -2042,6 +2042,7 @@ protected function uploadMediaFiles($fileName, $renameFileOff = false) $res = $this->_getUploader()->move($fileName, $renameFileOff); return $res['file']; } catch (\Exception $e) { + $this->_logger->critical($e); return ''; } } diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php index 862276d35bac5..8461e3830cbec 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php @@ -1194,6 +1194,70 @@ public function testParseAttributesWithWrappedValuesWillReturnsLowercasedAttribu $this->assertArrayNotHasKey('PARAM2', $attributes); } + /** + * Test that errors occurred during importing images are logged. + * + * @param string $fileName + * @param bool $throwException + * @dataProvider uploadMediaFilesDataProvider + */ + public function testUploadMediaFiles(string $fileName, bool $throwException) + { + $exception = new \Exception(); + $expectedFileName = $fileName; + if ($throwException) { + $expectedFileName = ''; + $this->_logger->expects($this->once())->method('critical')->with($exception); + } + + $fileUploaderMock = $this + ->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Uploader::class) + ->disableOriginalConstructor() + ->getMock(); + + $fileUploaderMock + ->expects($this->once()) + ->method('move') + ->willReturnCallback( + function ($name) use ($throwException, $exception) { + if ($throwException) { + throw $exception; + } + return ['file' => $name]; + } + ); + + $this->setPropertyValue( + $this->importProduct, + '_fileUploader', + $fileUploaderMock + ); + + $actualFileName = $this->invokeMethod( + $this->importProduct, + 'uploadMediaFiles', + [$fileName] + ); + + $this->assertEquals( + $expectedFileName, + $actualFileName + ); + } + + /** + * Data provider for testUploadMediaFiles. + * + * @return array + */ + public function uploadMediaFilesDataProvider() + { + return [ + ['test1.jpg', false], + ['test2.jpg', true], + ]; + } + public function getImagesFromRowDataProvider() { return [ diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 0f9cb373e59ed..5debe398f085c 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -26,7 +26,7 @@ use Magento\Framework\Filesystem; use Magento\ImportExport\Model\Import; use Magento\Store\Model\Store; -use Magento\UrlRewrite\Model\UrlRewrite; +use Psr\Log\LoggerInterface; /** * Class ProductTest @@ -62,11 +62,20 @@ class ProductTest extends \Magento\TestFramework\Indexer\TestCase */ protected $objectManager; + /** + * @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $logger; + protected function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->logger = $this->getMockBuilder(LoggerInterface::class) + ->disableOriginalConstructor() + ->getMock(); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\CatalogImportExport\Model\Import\Product::class + \Magento\CatalogImportExport\Model\Import\Product::class, + ['logger' => $this->logger] ); parent::setUp(); } @@ -659,6 +668,21 @@ public function testSaveMediaImage() $this->assertEquals('Additional Image Label Two', $additionalImageTwoItem->getLabel()); } + /** + * Test that errors occurred during importing images are logged. + * + * @magentoDataIsolation enabled + * @magentoAppIsolation enabled + * @magentoDataFixture mediaImportImageFixture + * @magentoDataFixture mediaImportImageFixtureError + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testSaveMediaImageError() + { + $this->logger->expects(self::once())->method('critical'); + $this->importDataForMediaTest('import_media.csv', 1); + } + /** * Copy fixture images into media import directory */ @@ -717,6 +741,30 @@ public static function mediaImportImageFixtureRollback() $mediaDirectory->delete('catalog'); } + /** + * Copy incorrect fixture image into media import directory. + */ + public static function mediaImportImageFixtureError() + { + /** @var \Magento\Framework\Filesystem\Directory\Write $mediaDirectory */ + $mediaDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + \Magento\Framework\Filesystem::class + )->getDirectoryWrite( + DirectoryList::MEDIA + ); + $dirPath = $mediaDirectory->getAbsolutePath('import'); + $items = [ + [ + 'source' => __DIR__ . '/_files/magento_additional_image_error.jpg', + 'dest' => $dirPath . '/magento_additional_image_two.jpg', + ], + ]; + foreach ($items as $item) { + copy($item['source'], $item['dest']); + } + } + + /** * Export CSV string to array * @@ -1564,8 +1612,9 @@ public function testProductWithWrappedAdditionalAttributes() * Import and check data from file * * @param string $fileName + * @param int $expectedErrors */ - private function importDataForMediaTest($fileName) + private function importDataForMediaTest(string $fileName, int $expectedErrors = 0) { $filesystem = $this->objectManager->create(\Magento\Framework\Filesystem::class); $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); @@ -1603,7 +1652,7 @@ private function importDataForMediaTest($fileName) $this->assertTrue($errors->getErrorsCount() == 0); $this->_model->importData(); - $this->assertTrue($this->_model->getErrorAggregator()->getErrorsCount() == 0); + $this->assertTrue($this->_model->getErrorAggregator()->getErrorsCount() == $expectedErrors); } /** diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/magento_additional_image_error.jpg b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/magento_additional_image_error.jpg new file mode 100644 index 0000000000000..e69de29bb2d1d From 29d175ddd2de94eb50ce72e1006c2afdb5be00aa Mon Sep 17 00:00:00 2001 From: Rulo Date: Fri, 27 Oct 2017 18:03:59 -0400 Subject: [PATCH 8/9] Admin product search - Pressing enter does not submit #4696 --- .../Ui/view/base/web/templates/grid/filters/filters.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/filters/filters.html b/app/code/Magento/Ui/view/base/web/templates/grid/filters/filters.html index 2af1a430a6e00..eab2523b06e41 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/filters/filters.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/filters/filters.html @@ -14,7 +14,7 @@ -
+
From 56f8a399629f5ae7611c346d062d591abc2eee3a Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Sat, 28 Oct 2017 01:26:33 +0200 Subject: [PATCH 9/9] Fixed issue #11581: Changed references from Zend_Pdf_Color_RGB to the correct camel case class name Zend_Pdf_Color_Rgb --- app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php | 4 ++-- app/code/Magento/Sales/Model/Order/Pdf/Invoice.php | 4 ++-- app/code/Magento/Sales/Model/Order/Pdf/Shipment.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index 6e2265315245d..74f3eebf8fcb9 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -75,12 +75,12 @@ public function __construct( protected function _drawHeader(\Zend_Pdf_Page $page) { $this->_setFontRegular($page, 10); - $page->setFillColor(new \Zend_Pdf_Color_RGB(0.93, 0.92, 0.92)); + $page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92)); $page->setLineColor(new \Zend_Pdf_Color_GrayScale(0.5)); $page->setLineWidth(0.5); $page->drawRectangle(25, $this->y, 570, $this->y - 30); $this->y -= 10; - $page->setFillColor(new \Zend_Pdf_Color_RGB(0, 0, 0)); + $page->setFillColor(new \Zend_Pdf_Color_Rgb(0, 0, 0)); //columns headers $lines[0][] = ['text' => __('Products'), 'feed' => 35]; diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index 2912969a99718..f294128a72f9f 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -82,12 +82,12 @@ protected function _drawHeader(\Zend_Pdf_Page $page) { /* Add table head */ $this->_setFontRegular($page, 10); - $page->setFillColor(new \Zend_Pdf_Color_RGB(0.93, 0.92, 0.92)); + $page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92)); $page->setLineColor(new \Zend_Pdf_Color_GrayScale(0.5)); $page->setLineWidth(0.5); $page->drawRectangle(25, $this->y, 570, $this->y - 15); $this->y -= 10; - $page->setFillColor(new \Zend_Pdf_Color_RGB(0, 0, 0)); + $page->setFillColor(new \Zend_Pdf_Color_Rgb(0, 0, 0)); //columns headers $lines[0][] = ['text' => __('Products'), 'feed' => 35]; diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index be74efda2d265..b171fccdeb05b 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -80,12 +80,12 @@ protected function _drawHeader(\Zend_Pdf_Page $page) { /* Add table head */ $this->_setFontRegular($page, 10); - $page->setFillColor(new \Zend_Pdf_Color_RGB(0.93, 0.92, 0.92)); + $page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92)); $page->setLineColor(new \Zend_Pdf_Color_GrayScale(0.5)); $page->setLineWidth(0.5); $page->drawRectangle(25, $this->y, 570, $this->y - 15); $this->y -= 10; - $page->setFillColor(new \Zend_Pdf_Color_RGB(0, 0, 0)); + $page->setFillColor(new \Zend_Pdf_Color_Rgb(0, 0, 0)); //columns headers $lines[0][] = ['text' => __('Products'), 'feed' => 100];