From ae5d7828efe6e937dc670f851cfd30e01a09cdae Mon Sep 17 00:00:00 2001 From: Sylwester Fiolka Date: Tue, 24 Jan 2017 12:01:15 +0100 Subject: [PATCH 01/28] edited the customer account edit form: moved additional info container outside hidden fieldset --- .../Magento/Customer/view/frontend/templates/form/edit.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml index 6d62ae76a6279..e265a306bff39 100644 --- a/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml @@ -77,8 +77,8 @@ autocomplete="off" /> - getChildHtml('form_additional_info'); ?> + getChildHtml('form_additional_info'); ?>
From d923e49513a65d0dbefbbbffbf7cdd28032cd2ba Mon Sep 17 00:00:00 2001 From: Viktor Paladiychuk Date: Mon, 30 Jan 2017 18:22:42 +0200 Subject: [PATCH 02/28] MAGETWO-62660: [GitHub] Overly aggressive performance optimizations of the static content deployment #7862 --- .../Deploy/Model/Deploy/LocaleQuickDeploy.php | 102 ++++++++++++++++-- .../Model/Deploy/LocaleQuickDeployTest.php | 100 ++++++++++++++--- 2 files changed, 177 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php index 0d990b555cb66..a8a4c4f02acd1 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php @@ -6,15 +6,18 @@ namespace Magento\Deploy\Model\Deploy; -use Magento\Deploy\Model\DeployManager; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\App\Utility\Files; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\WriteInterface; use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\Console\Cli; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; -use \Magento\Framework\RequireJs\Config as RequireJsConfig; +use Magento\Framework\RequireJs\Config as RequireJsConfig; +use Magento\Framework\App\View\Asset\Publisher; +use Magento\Framework\View\Asset\Repository; +use Magento\Framework\App\ObjectManager; +use Magento\Translation\Model\Js\Config as TranslationJsConfig; +use Magento\Framework\TranslateInterface; class LocaleQuickDeploy implements DeployInterface { @@ -38,16 +41,52 @@ class LocaleQuickDeploy implements DeployInterface */ private $options = []; + /** + * @var Repository + */ + private $assetRepo; + + /** + * @var Publisher + */ + private $assetPublisher; + + /** + * @var TranslationJsConfig + */ + private $translationJsConfig; + + /** + * @var TranslateInterface + */ + private $translator; + /** * @param Filesystem $filesystem * @param OutputInterface $output * @param array $options + * @param Repository $assetRepo + * @param Publisher $assetPublisher + * @param TranslationJsConfig $translationJsConfig + * @param TranslateInterface $translator */ - public function __construct(\Magento\Framework\Filesystem $filesystem, OutputInterface $output, $options = []) - { + public function __construct( + Filesystem $filesystem, + OutputInterface $output, + $options = [], + Repository $assetRepo = null, + Publisher $assetPublisher = null, + TranslationJsConfig $translationJsConfig = null, + TranslateInterface $translator = null + ) { $this->filesystem = $filesystem; $this->output = $output; $this->options = $options; + $this->assetRepo = $assetRepo ?: ObjectManager::getInstance()->get(Repository::class); + $this->assetPublisher = $assetPublisher ?: ObjectManager::getInstance()->get(Publisher::class); + $this->translationJsConfig = $translationJsConfig + ?: ObjectManager::getInstance()->get(TranslationJsConfig::class); + $this->translator = $translator ?: ObjectManager::getInstance()->get(TranslateInterface::class); } /** @@ -67,13 +106,13 @@ private function getStaticDirectory() */ public function deploy($area, $themePath, $locale) { - if (isset($this->options[Options::DRY_RUN]) && $this->options[Options::DRY_RUN]) { + if (!empty($this->options[Options::DRY_RUN])) { return Cli::RETURN_SUCCESS; } $this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ==="); - if (!isset($this->options[self::DEPLOY_BASE_LOCALE])) { + if (empty($this->options[self::DEPLOY_BASE_LOCALE])) { throw new \InvalidArgumentException('Deploy base locale must be set for Quick Deploy'); } $processedFiles = 0; @@ -88,7 +127,7 @@ public function deploy($area, $themePath, $locale) $this->deleteLocaleResource($newLocalePath); $this->deleteLocaleResource($newRequireJsPath); - if (isset($this->options[Options::SYMLINK_LOCALE]) && $this->options[Options::SYMLINK_LOCALE]) { + if (!empty($this->options[Options::SYMLINK_LOCALE])) { $this->getStaticDirectory()->createSymlink($baseLocalePath, $newLocalePath); $this->getStaticDirectory()->createSymlink($baseRequireJsPath, $newRequireJsPath); @@ -98,20 +137,65 @@ public function deploy($area, $themePath, $locale) $this->getStaticDirectory()->readRecursively($baseLocalePath), $this->getStaticDirectory()->readRecursively($baseRequireJsPath) ); + $jsDictionaryEnabled = $this->translationJsConfig->dictionaryEnabled(); foreach ($localeFiles as $path) { if ($this->getStaticDirectory()->isFile($path)) { $destination = $this->replaceLocaleInPath($path, $baseLocale, $locale); - $this->getStaticDirectory()->copyFile($path, $destination); + if (!$jsDictionaryEnabled || !$this->isJsDictionary($path)) { + $this->getStaticDirectory()->copyFile($path, $destination); + } $processedFiles++; } } + if ($jsDictionaryEnabled) { + $this->deployJsDictionary($area, $themePath, $locale); + $processedFiles++; + } + $this->output->writeln("\nSuccessful copied: {$processedFiles} files; errors: {$errorAmount}\n---\n"); } return Cli::RETURN_SUCCESS; } + /** + * Define if provided path is js dictionary + * + * @param string $path + * @return bool + */ + private function isJsDictionary($path) + { + return strpos($path, $this->translationJsConfig->getDictionaryFileName()) !== false; + } + + /** + * Deploy js-dictionary for specific locale, theme and area + * + * @param string $area + * @param string $themePath + * @param string $locale + * @return void + */ + private function deployJsDictionary($area, $themePath, $locale) + { + $this->translator->setLocale($locale); + $this->translator->loadData($area, true); + + $asset = $this->assetRepo->createAsset( + $this->translationJsConfig->getDictionaryFileName(), + ['area' => $area, 'theme' => $themePath, 'locale' => $locale] + ); + if ($this->output->isVeryVerbose()) { + $this->output->writeln("\tDeploying the file to '{$asset->getPath()}'"); + } else { + $this->output->write('.'); + } + + $this->assetPublisher->publish($asset); + } + /** * @param string $path * @return void diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php index 6c693fe5f3d85..f3b885bec4f01 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php @@ -11,7 +11,12 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Symfony\Component\Console\Output\OutputInterface; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; -use \Magento\Framework\RequireJs\Config as RequireJsConfig; +use Magento\Framework\RequireJs\Config as RequireJsConfig; +use Magento\Translation\Model\Js\Config as TranslationJsConfig; +use Magento\Framework\TranslateInterface; +use Magento\Framework\View\Asset\Repository; +use Magento\Framework\View\Asset\LocalInterface as Asset; +use Magento\Framework\App\View\Asset\Publisher; class LocaleQuickDeployTest extends \PHPUnit_Framework_TestCase { @@ -25,15 +30,46 @@ class LocaleQuickDeployTest extends \PHPUnit_Framework_TestCase */ private $staticDirectoryMock; + /** + * @var TranslationJsConfig|\PHPUnit_Framework_MockObject_MockObject + */ + private $translationJsConfig; + + /** + * @var TranslateInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $translator; + + /** + * @var Repository|\PHPUnit_Framework_MockObject_MockObject + */ + private $assetRepo; + + /** + * @var Asset|\PHPUnit_Framework_MockObject_MockObject + */ + private $asset; + + /** + * @var Publisher|\PHPUnit_Framework_MockObject_MockObject + */ + private $assetPublisher; + protected function setUp() { $this->outputMock = $this->getMockBuilder(OutputInterface::class) - ->setMethods(['writeln']) + ->setMethods(['writeln', 'isVeryVerbose']) ->getMockForAbstractClass(); $this->staticDirectoryMock = $this->getMockBuilder(WriteInterface::class) ->setMethods(['createSymlink', 'getAbsolutePath', 'getRelativePath', 'copyFile', 'readRecursively']) ->getMockForAbstractClass(); + + $this->translationJsConfig = $this->getMock(TranslationJsConfig::class, [], [], '', false); + $this->translator = $this->getMockForAbstractClass(TranslateInterface::class, [], '', false, false, true); + $this->assetRepo = $this->getMock(Repository::class, [], [], '', false); + $this->asset = $this->getMockForAbstractClass(Asset::class, [], '', false, false, true);; + $this->assetPublisher = $this->getMock(Publisher::class, [], [], '', false); } /** @@ -68,29 +104,57 @@ public function testDeployWithSymlinkStrategy() public function testDeployWithCopyStrategy() { - $area = 'adminhtml'; $themePath = 'Magento/backend'; $locale = 'uk_UA'; - $baseLocal = 'en_US'; + $baseLocale = 'en_US'; + $baseDir = $baseLocale . 'dir'; + $file1 = 'file1'; + $file2 = 'file2'; + $baseFile1 = $baseLocale . $file1; + $baseFile2 = $baseLocale . $file2; + + $dictionary = TranslationJsConfig::DICTIONARY_FILE_NAME; + $baseDictionary = $baseLocale . $dictionary; + $this->staticDirectoryMock->expects(self::never())->method('createSymlink'); - $this->staticDirectoryMock->expects(self::exactly(2))->method('readRecursively')->willReturnMap([ - ['adminhtml/Magento/backend/en_US', [$baseLocal . 'file1', $baseLocal . 'dir']], - [RequireJsConfig::DIR_NAME . '/adminhtml/Magento/backend/en_US', [$baseLocal . 'file2']] - ]); - $this->staticDirectoryMock->expects(self::exactly(3))->method('isFile')->willReturnMap([ - [$baseLocal . 'file1', true], - [$baseLocal . 'dir', false], - [$baseLocal . 'file2', true], + $this->staticDirectoryMock->expects(self::exactly(2))->method('readRecursively')->willReturnMap( + [ + ['adminhtml/Magento/backend/en_US', [$baseFile1, $baseDir]], + [RequireJsConfig::DIR_NAME . '/adminhtml/Magento/backend/en_US', [$baseFile2, $baseDictionary]] + ] + ); + $this->staticDirectoryMock->expects(self::exactly(4))->method('isFile')->willReturnMap([ + [$baseFile1, true], + [$baseDir, false], + [$baseFile2, true], + [$baseDictionary, true] ]); $this->staticDirectoryMock->expects(self::exactly(2))->method('copyFile')->withConsecutive( - [$baseLocal . 'file1', $locale . 'file1', null], - [$baseLocal . 'file2', $locale . 'file2', null] + [$baseFile1, $locale . $file1, null], + [$baseFile2, $locale . $file2, null] ); + $this->translationJsConfig->expects(self::exactly(4))->method('getDictionaryFileName') + ->willReturn($dictionary); + + $this->translationJsConfig->expects($this->once())->method('dictionaryEnabled')->willReturn(true); + + $this->translator->expects($this->once())->method('setLocale')->with($locale); + $this->translator->expects($this->once())->method('loadData')->with($area, true); + + $this->assetRepo->expects($this->once())->method('createAsset') + ->with( + $dictionary, + ['area' => $area, 'theme' => $themePath, 'locale' => $locale] + ) + ->willReturn($this->asset); + + $this->assetPublisher->expects($this->once())->method('publish'); + $model = $this->getModel([ - DeployInterface::DEPLOY_BASE_LOCALE => $baseLocal, + DeployInterface::DEPLOY_BASE_LOCALE => $baseLocale, Options::SYMLINK_LOCALE => 0, ]); $model->deploy($area, $themePath, $locale); @@ -107,7 +171,11 @@ private function getModel($options = []) [ 'output' => $this->outputMock, 'staticDirectory' => $this->staticDirectoryMock, - 'options' => $options + 'options' => $options, + 'translationJsConfig' => $this->translationJsConfig, + 'translator' => $this->translator, + 'assetRepo' => $this->assetRepo, + 'assetPublisher' => $this->assetPublisher ] ); } From 2f245a07c7c6fa0525b8db6f5bd6523938124321 Mon Sep 17 00:00:00 2001 From: Viktor Paladiychuk Date: Wed, 1 Feb 2017 15:35:12 +0200 Subject: [PATCH 03/28] MAGETWO-62660: [GitHub] Overly aggressive performance optimizations of the static content deployment #7862 --- .../Model/Deploy/JsDictionaryDeploy.php | 86 ++++++++++++++ .../Deploy/Model/Deploy/LocaleQuickDeploy.php | 88 ++++++--------- .../Deploy/Model/DeployStrategyFactory.php | 6 + .../Model/Deploy/JsDictionaryDeployTest.php | 105 ++++++++++++++++++ .../Model/Deploy/LocaleQuickDeployTest.php | 56 ++++------ 5 files changed, 252 insertions(+), 89 deletions(-) create mode 100644 app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php create mode 100644 app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php diff --git a/app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php b/app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php new file mode 100644 index 0000000000000..4431a426660a1 --- /dev/null +++ b/app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php @@ -0,0 +1,86 @@ +assetRepo = $assetRepo; + $this->assetPublisher = $assetPublisher; + $this->translationJsConfig = $translationJsConfig; + $this->translator = $translator; + $this->output = $output; + } + + /** + * {@inheritdoc} + */ + public function deploy($area, $themePath, $locale) + { + $this->translator->setLocale($locale); + $this->translator->loadData($area, true); + + $asset = $this->assetRepo->createAsset( + $this->translationJsConfig->getDictionaryFileName(), + ['area' => $area, 'theme' => $themePath, 'locale' => $locale] + ); + if ($this->output->isVeryVerbose()) { + $this->output->writeln("\tDeploying the file to '{$asset->getPath()}'"); + } else { + $this->output->write('.'); + } + + $this->assetPublisher->publish($asset); + + return Cli::RETURN_SUCCESS; + } +} diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php index a8a4c4f02acd1..cc0214a4e5f22 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php @@ -13,11 +13,9 @@ use Magento\Framework\Console\Cli; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; use Magento\Framework\RequireJs\Config as RequireJsConfig; -use Magento\Framework\App\View\Asset\Publisher; -use Magento\Framework\View\Asset\Repository; +use Magento\Framework\Translate\Js\Config as TranslationJsConfig; use Magento\Framework\App\ObjectManager; -use Magento\Translation\Model\Js\Config as TranslationJsConfig; -use Magento\Framework\TranslateInterface; +use Magento\Deploy\Model\DeployStrategyFactory; class LocaleQuickDeploy implements DeployInterface { @@ -42,51 +40,41 @@ class LocaleQuickDeploy implements DeployInterface private $options = []; /** - * @var Repository - */ - private $assetRepo; - - /** - * @var Publisher + * @var TranslationJsConfig */ - private $assetPublisher; + private $translationJsConfig; /** - * @var TranslationJsConfig + * @var DeployStrategyFactory */ - private $translationJsConfig; + private $deployStrategyFactory; /** - * @var TranslateInterface + * @var DeployInterface[] */ - private $translator; + private $deploys; /** * @param Filesystem $filesystem * @param OutputInterface $output * @param array $options - * @param Repository $assetRepo - * @param Publisher $assetPublisher * @param TranslationJsConfig $translationJsConfig - * @param TranslateInterface $translator + * @param DeployStrategyFactory $deployStrategyFactory */ public function __construct( Filesystem $filesystem, OutputInterface $output, $options = [], - Repository $assetRepo = null, - Publisher $assetPublisher = null, TranslationJsConfig $translationJsConfig = null, - TranslateInterface $translator = null + DeployStrategyFactory $deployStrategyFactory = null ) { $this->filesystem = $filesystem; $this->output = $output; $this->options = $options; - $this->assetRepo = $assetRepo ?: ObjectManager::getInstance()->get(Repository::class); - $this->assetPublisher = $assetPublisher ?: ObjectManager::getInstance()->get(Publisher::class); $this->translationJsConfig = $translationJsConfig ?: ObjectManager::getInstance()->get(TranslationJsConfig::class); - $this->translator = $translator ?: ObjectManager::getInstance()->get(TranslateInterface::class); + $this->deployStrategyFactory = $deployStrategyFactory + ?: ObjectManager::getInstance()->get(DeployStrategyFactory::class); } /** @@ -140,16 +128,23 @@ public function deploy($area, $themePath, $locale) $jsDictionaryEnabled = $this->translationJsConfig->dictionaryEnabled(); foreach ($localeFiles as $path) { if ($this->getStaticDirectory()->isFile($path)) { - $destination = $this->replaceLocaleInPath($path, $baseLocale, $locale); if (!$jsDictionaryEnabled || !$this->isJsDictionary($path)) { + $destination = $this->replaceLocaleInPath($path, $baseLocale, $locale); $this->getStaticDirectory()->copyFile($path, $destination); + $processedFiles++; } - $processedFiles++; } } if ($jsDictionaryEnabled) { - $this->deployJsDictionary($area, $themePath, $locale); + $this->getDeploy( + DeployStrategyFactory::DEPLOY_STRATEGY_JS_DICTIONARY, + [ + 'output' => $this->output, + 'translationJsConfig' => $this->translationJsConfig + ] + ) + ->deploy($area, $themePath, $locale); $processedFiles++; } @@ -160,40 +155,29 @@ public function deploy($area, $themePath, $locale) } /** - * Define if provided path is js dictionary + * Get deploy strategy according to required strategy * - * @param string $path - * @return bool + * @param string $strategy + * @param array $params + * @return DeployInterface */ - private function isJsDictionary($path) + private function getDeploy($strategy, $params) { - return strpos($path, $this->translationJsConfig->getDictionaryFileName()) !== false; + if (empty($this->deploys[$strategy])) { + $this->deploys[$strategy] = $this->deployStrategyFactory->create($strategy, $params); + } + return $this->deploys[$strategy]; } /** - * Deploy js-dictionary for specific locale, theme and area + * Define if provided path is js dictionary * - * @param string $area - * @param string $themePath - * @param string $locale - * @return void + * @param string $path + * @return bool */ - private function deployJsDictionary($area, $themePath, $locale) + private function isJsDictionary($path) { - $this->translator->setLocale($locale); - $this->translator->loadData($area, true); - - $asset = $this->assetRepo->createAsset( - $this->translationJsConfig->getDictionaryFileName(), - ['area' => $area, 'theme' => $themePath, 'locale' => $locale] - ); - if ($this->output->isVeryVerbose()) { - $this->output->writeln("\tDeploying the file to '{$asset->getPath()}'"); - } else { - $this->output->write('.'); - } - - $this->assetPublisher->publish($asset); + return strpos($path, $this->translationJsConfig->getDictionaryFileName()) !== false; } /** diff --git a/app/code/Magento/Deploy/Model/DeployStrategyFactory.php b/app/code/Magento/Deploy/Model/DeployStrategyFactory.php index 536f344e600cc..7ba159ba62c4f 100644 --- a/app/code/Magento/Deploy/Model/DeployStrategyFactory.php +++ b/app/code/Magento/Deploy/Model/DeployStrategyFactory.php @@ -22,6 +22,11 @@ class DeployStrategyFactory */ const DEPLOY_STRATEGY_QUICK = 'quick'; + /** + * Strategy for deploying js dictionary + */ + const DEPLOY_STRATEGY_JS_DICTIONARY = 'js-dictionary'; + /** * @param ObjectManagerInterface $objectManager */ @@ -41,6 +46,7 @@ public function create($type, array $arguments = []) $strategyMap = [ self::DEPLOY_STRATEGY_STANDARD => Deploy\LocaleDeploy::class, self::DEPLOY_STRATEGY_QUICK => Deploy\LocaleQuickDeploy::class, + self::DEPLOY_STRATEGY_JS_DICTIONARY => Deploy\JsDictionaryDeploy::class ]; if (!isset($strategyMap[$type])) { diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php new file mode 100644 index 0000000000000..ff181556db119 --- /dev/null +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php @@ -0,0 +1,105 @@ +output = $this->getMockBuilder(OutputInterface::class) + ->setMethods(['writeln', 'isVeryVerbose']) + ->getMockForAbstractClass(); + + $this->translationJsConfig = $this->getMock(TranslationJsConfig::class, [], [], '', false); + $this->translator = $this->getMockForAbstractClass(TranslateInterface::class, [], '', false, false, true); + $this->assetRepo = $this->getMock(Repository::class, [], [], '', false); + $this->asset = $this->getMockForAbstractClass(Asset::class, [], '', false, false, true); + $this->assetPublisher = $this->getMock(Publisher::class, [], [], '', false); + + $this->model = (new ObjectManager($this))->getObject( + JsDictionaryDeploy::class, + [ + 'translationJsConfig' => $this->translationJsConfig, + 'translator' => $this->translator, + 'assetRepo' => $this->assetRepo, + 'assetPublisher' => $this->assetPublisher, + 'output' => $this->output + ] + ); + } + + public function testDeploy() + { + $area = 'adminhtml'; + $themePath = 'Magento/backend'; + $locale = 'uk_UA'; + + $dictionary = 'js-translation.json'; + + $this->translationJsConfig->expects(self::exactly(1))->method('getDictionaryFileName') + ->willReturn($dictionary); + + $this->translator->expects($this->once())->method('setLocale')->with($locale); + $this->translator->expects($this->once())->method('loadData')->with($area, true); + + $this->assetRepo->expects($this->once())->method('createAsset') + ->with( + $dictionary, + ['area' => $area, 'theme' => $themePath, 'locale' => $locale] + ) + ->willReturn($this->asset); + + $this->assetPublisher->expects($this->once())->method('publish'); + + $this->model->deploy($area, $themePath, $locale); + } + +} \ No newline at end of file diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php index f3b885bec4f01..4bd76a921e42d 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php @@ -12,11 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; use Magento\Framework\RequireJs\Config as RequireJsConfig; -use Magento\Translation\Model\Js\Config as TranslationJsConfig; -use Magento\Framework\TranslateInterface; -use Magento\Framework\View\Asset\Repository; -use Magento\Framework\View\Asset\LocalInterface as Asset; -use Magento\Framework\App\View\Asset\Publisher; +use Magento\Framework\Translate\Js\Config as TranslationJsConfig; +use Magento\Deploy\Model\Deploy\JsDictionaryDeploy; +use Magento\Deploy\Model\DeployStrategyFactory; class LocaleQuickDeployTest extends \PHPUnit_Framework_TestCase { @@ -36,24 +34,14 @@ class LocaleQuickDeployTest extends \PHPUnit_Framework_TestCase private $translationJsConfig; /** - * @var TranslateInterface|\PHPUnit_Framework_MockObject_MockObject + * @var JsDictionaryDeploy|\PHPUnit_Framework_MockObject_MockObject */ - private $translator; + private $jsDictionaryDeploy; /** - * @var Repository|\PHPUnit_Framework_MockObject_MockObject + * @var DeployStrategyFactory|\PHPUnit_Framework_MockObject_MockObject */ - private $assetRepo; - - /** - * @var Asset|\PHPUnit_Framework_MockObject_MockObject - */ - private $asset; - - /** - * @var Publisher|\PHPUnit_Framework_MockObject_MockObject - */ - private $assetPublisher; + private $deployStrategyFactory; protected function setUp() { @@ -66,10 +54,10 @@ protected function setUp() ->getMockForAbstractClass(); $this->translationJsConfig = $this->getMock(TranslationJsConfig::class, [], [], '', false); - $this->translator = $this->getMockForAbstractClass(TranslateInterface::class, [], '', false, false, true); - $this->assetRepo = $this->getMock(Repository::class, [], [], '', false); - $this->asset = $this->getMockForAbstractClass(Asset::class, [], '', false, false, true);; - $this->assetPublisher = $this->getMock(Publisher::class, [], [], '', false); + + $this->deployStrategyFactory = $this->getMock(DeployStrategyFactory::class, [], [], '', false); + + $this->jsDictionaryDeploy = $this->getMock(JsDictionaryDeploy::class, [], [], '', false); } /** @@ -114,10 +102,9 @@ public function testDeployWithCopyStrategy() $baseFile1 = $baseLocale . $file1; $baseFile2 = $baseLocale . $file2; - $dictionary = TranslationJsConfig::DICTIONARY_FILE_NAME; + $dictionary = 'js-translation.json'; $baseDictionary = $baseLocale . $dictionary; - $this->staticDirectoryMock->expects(self::never())->method('createSymlink'); $this->staticDirectoryMock->expects(self::exactly(2))->method('readRecursively')->willReturnMap( [ @@ -136,22 +123,19 @@ public function testDeployWithCopyStrategy() [$baseFile2, $locale . $file2, null] ); - $this->translationJsConfig->expects(self::exactly(4))->method('getDictionaryFileName') + $this->translationJsConfig->expects(self::exactly(3))->method('getDictionaryFileName') ->willReturn($dictionary); $this->translationJsConfig->expects($this->once())->method('dictionaryEnabled')->willReturn(true); - $this->translator->expects($this->once())->method('setLocale')->with($locale); - $this->translator->expects($this->once())->method('loadData')->with($area, true); - - $this->assetRepo->expects($this->once())->method('createAsset') + $this->deployStrategyFactory->expects($this->once())->method('create') ->with( - $dictionary, - ['area' => $area, 'theme' => $themePath, 'locale' => $locale] + DeployStrategyFactory::DEPLOY_STRATEGY_JS_DICTIONARY, + ['output' => $this->outputMock, 'translationJsConfig' => $this->translationJsConfig] ) - ->willReturn($this->asset); + ->willReturn($this->jsDictionaryDeploy); - $this->assetPublisher->expects($this->once())->method('publish'); + $this->jsDictionaryDeploy->expects($this->once())->method('deploy')->with($area, $themePath, $locale); $model = $this->getModel([ DeployInterface::DEPLOY_BASE_LOCALE => $baseLocale, @@ -173,9 +157,7 @@ private function getModel($options = []) 'staticDirectory' => $this->staticDirectoryMock, 'options' => $options, 'translationJsConfig' => $this->translationJsConfig, - 'translator' => $this->translator, - 'assetRepo' => $this->assetRepo, - 'assetPublisher' => $this->assetPublisher + 'deployStrategyFactory' => $this->deployStrategyFactory ] ); } From de490780a45749a0b3a98a979b3aec9409bac649 Mon Sep 17 00:00:00 2001 From: Viktor Paladiychuk Date: Wed, 1 Feb 2017 15:40:36 +0200 Subject: [PATCH 04/28] MAGETWO-62660: [GitHub] Overly aggressive performance optimizations of the static content deployment #7862 --- app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php b/app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php index 4431a426660a1..9c6a309a0f968 100644 --- a/app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/JsDictionaryDeploy.php @@ -13,6 +13,9 @@ use Magento\Framework\Console\Cli; use Symfony\Component\Console\Output\OutputInterface; +/** + * Deploy class for js dictionary + */ class JsDictionaryDeploy implements DeployInterface { /** From 7743000b141ed3fe961c3ff9568acc6fe0a2ae8f Mon Sep 17 00:00:00 2001 From: Viktor Paladiychuk Date: Thu, 2 Feb 2017 15:23:03 +0200 Subject: [PATCH 05/28] MAGETWO-62660: [GitHub] Overly aggressive performance optimizations of the static content deployment #7862 --- .../Deploy/Model/Deploy/LocaleQuickDeploy.php | 14 +++++++------- .../Unit/Model/Deploy/JsDictionaryDeployTest.php | 1 - .../Unit/Model/Deploy/LocaleQuickDeployTest.php | 4 ---- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php index cc0214a4e5f22..d407f11fca55e 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php @@ -138,13 +138,13 @@ public function deploy($area, $themePath, $locale) if ($jsDictionaryEnabled) { $this->getDeploy( - DeployStrategyFactory::DEPLOY_STRATEGY_JS_DICTIONARY, - [ - 'output' => $this->output, - 'translationJsConfig' => $this->translationJsConfig - ] - ) - ->deploy($area, $themePath, $locale); + DeployStrategyFactory::DEPLOY_STRATEGY_JS_DICTIONARY, + [ + 'output' => $this->output, + 'translationJsConfig' => $this->translationJsConfig + ] + ) + ->deploy($area, $themePath, $locale); $processedFiles++; } diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php index ff181556db119..34d9ebd4aa986 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php @@ -3,7 +3,6 @@ * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Deploy\Test\Unit\Model\Deploy; use Symfony\Component\Console\Output\OutputInterface; diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php index 4bd76a921e42d..d50c8ce055894 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php @@ -48,15 +48,11 @@ protected function setUp() $this->outputMock = $this->getMockBuilder(OutputInterface::class) ->setMethods(['writeln', 'isVeryVerbose']) ->getMockForAbstractClass(); - $this->staticDirectoryMock = $this->getMockBuilder(WriteInterface::class) ->setMethods(['createSymlink', 'getAbsolutePath', 'getRelativePath', 'copyFile', 'readRecursively']) ->getMockForAbstractClass(); - $this->translationJsConfig = $this->getMock(TranslationJsConfig::class, [], [], '', false); - $this->deployStrategyFactory = $this->getMock(DeployStrategyFactory::class, [], [], '', false); - $this->jsDictionaryDeploy = $this->getMock(JsDictionaryDeploy::class, [], [], '', false); } From 8c68a3d84173fa62192c195a95624706c2f343bb Mon Sep 17 00:00:00 2001 From: Viktor Paladiychuk Date: Thu, 2 Feb 2017 15:25:07 +0200 Subject: [PATCH 06/28] MAGETWO-62660: [GitHub] Overly aggressive performance optimizations of the static content deployment #7862 --- .../Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php index 34d9ebd4aa986..80d2b4f2b1ba4 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php @@ -83,7 +83,7 @@ public function testDeploy() $dictionary = 'js-translation.json'; - $this->translationJsConfig->expects(self::exactly(1))->method('getDictionaryFileName') + $this->translationJsConfig->expects(self::once())->method('getDictionaryFileName') ->willReturn($dictionary); $this->translator->expects($this->once())->method('setLocale')->with($locale); From 25f945f6199ef9a585908d961d23b2dd8e960730 Mon Sep 17 00:00:00 2001 From: dmanners Date: Thu, 2 Feb 2017 10:50:55 +0000 Subject: [PATCH 07/28] Remove the usage of Zend_Db_Expr from the captcha module --- .../Captcha/Model/ResourceModel/Log.php | 9 +- app/code/Magento/Captcha/composer.json | 3 +- composer.json | 1 + composer.lock | 240 +++++++++++------- 4 files changed, 156 insertions(+), 97 deletions(-) diff --git a/app/code/Magento/Captcha/Model/ResourceModel/Log.php b/app/code/Magento/Captcha/Model/ResourceModel/Log.php index 182a1a2b42d85..f746f1aa9d330 100644 --- a/app/code/Magento/Captcha/Model/ResourceModel/Log.php +++ b/app/code/Magento/Captcha/Model/ResourceModel/Log.php @@ -66,6 +66,7 @@ protected function _construct() * * @param string|null $login * @return $this + * @throws \Magento\Framework\Exception\LocalizedException */ public function logAttempt($login) { @@ -78,7 +79,7 @@ public function logAttempt($login) 'count' => 1, 'updated_at' => $this->_coreDate->gmtDate() ], - ['count' => new \Zend_Db_Expr('count+1'), 'updated_at'] + ['count' => new \Zend\Db\Sql\Expression('count+1'), 'updated_at'] ); } $ip = $this->_remoteAddress->getRemoteAddress(); @@ -91,7 +92,7 @@ public function logAttempt($login) 'count' => 1, 'updated_at' => $this->_coreDate->gmtDate() ], - ['count' => new \Zend_Db_Expr('count+1'), 'updated_at'] + ['count' => new \Zend\Db\Sql\Expression('count+1'), 'updated_at'] ); } return $this; @@ -102,6 +103,7 @@ public function logAttempt($login) * * @param string $login * @return $this + * @throws \Magento\Framework\Exception\LocalizedException */ public function deleteUserAttempts($login) { @@ -126,6 +128,7 @@ public function deleteUserAttempts($login) * Get count attempts by ip * * @return null|int + * @throws \Magento\Framework\Exception\LocalizedException */ public function countAttemptsByRemoteAddress() { @@ -152,6 +155,7 @@ public function countAttemptsByRemoteAddress() * * @param string $login * @return null|int + * @throws \Magento\Framework\Exception\LocalizedException */ public function countAttemptsByUserLogin($login) { @@ -176,6 +180,7 @@ public function countAttemptsByUserLogin($login) * Delete attempts with expired in update_at time * * @return void + * @throws \Magento\Framework\Exception\LocalizedException */ public function deleteOldAttempts() { diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index 45ecd32464e9c..d474e5c879749 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -7,7 +7,8 @@ "magento/module-customer": "100.2.*", "magento/module-checkout": "100.2.*", "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/framework": "100.2.*", + "zendframework/zend-db": "~2.4.6" }, "type": "magento2-module", "version": "100.2.0-dev", diff --git a/composer.json b/composer.json index 0e2190b50024d..5cb99e8776696 100644 --- a/composer.json +++ b/composer.json @@ -31,6 +31,7 @@ "zendframework/zend-serializer": "~2.4.6", "zendframework/zend-log": "~2.4.6", "zendframework/zend-http": "~2.4.6", + "zendframework/zend-db": "~2.4.6", "magento/zendframework1": "~1.12.16", "colinmollenhour/credis": "1.6", "colinmollenhour/php-redis-session-abstract": "1.2", diff --git a/composer.lock b/composer.lock index 343fca47ec628..1c1950b30f9bc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +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": "202a6fdf0e8b7b87c1c858701f76cae1", - "content-hash": "251322bcc94fb1a18fe5747989eb04ab", + "content-hash": "086c7eb802d5f3450e00055f29f2b846", "packages": [ { "name": "braintree/braintree_php", @@ -52,7 +51,7 @@ } ], "description": "Braintree PHP Client Library", - "time": "2015-11-19 19:14:47" + "time": "2015-11-19T19:14:47+00:00" }, { "name": "colinmollenhour/cache-backend-file", @@ -88,7 +87,7 @@ ], "description": "The stock Zend_Cache_Backend_File backend has extremely poor performance for cleaning by tags making it become unusable as the number of cached items increases. This backend makes many changes resulting in a huge performance boost, especially for tag cleaning.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_File", - "time": "2016-05-02 16:24:47" + "time": "2016-05-02T16:24:47+00:00" }, { "name": "colinmollenhour/cache-backend-redis", @@ -124,7 +123,7 @@ ], "description": "Zend_Cache backend using Redis with full support for tags.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis", - "time": "2016-05-02 16:23:36" + "time": "2016-05-02T16:23:36+00:00" }, { "name": "colinmollenhour/credis", @@ -163,7 +162,7 @@ ], "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", "homepage": "https://github.com/colinmollenhour/credis", - "time": "2015-11-28 01:20:04" + "time": "2015-11-28T01:20:04+00:00" }, { "name": "colinmollenhour/php-redis-session-abstract", @@ -201,7 +200,7 @@ ], "description": "A Redis-based session handler with optimistic locking", "homepage": "https://github.com/colinmollenhour/php-redis-session-abstract", - "time": "2016-08-04 18:05:51" + "time": "2016-08-04T18:05:51+00:00" }, { "name": "composer/composer", @@ -276,7 +275,7 @@ "dependency", "package" ], - "time": "2016-03-03 15:15:10" + "time": "2016-03-03T15:15:10+00:00" }, { "name": "composer/semver", @@ -338,7 +337,7 @@ "validation", "versioning" ], - "time": "2016-08-30 16:08:34" + "time": "2016-08-30T16:08:34+00:00" }, { "name": "composer/spdx-licenses", @@ -399,7 +398,7 @@ "spdx", "validator" ], - "time": "2016-09-28 07:17:45" + "time": "2016-09-28T07:17:45+00:00" }, { "name": "justinrainbow/json-schema", @@ -465,7 +464,7 @@ "json", "schema" ], - "time": "2016-01-25 15:43:01" + "time": "2016-01-25T15:43:01+00:00" }, { "name": "league/climate", @@ -514,7 +513,7 @@ "php", "terminal" ], - "time": "2015-01-18 14:31:58" + "time": "2015-01-18T14:31:58+00:00" }, { "name": "magento/composer", @@ -550,7 +549,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2016-03-08 20:50:51" + "time": "2016-03-08T20:50:51+00:00" }, { "name": "magento/magento-composer-installer", @@ -629,7 +628,7 @@ "composer-installer", "magento" ], - "time": "2016-10-06 16:05:07" + "time": "2016-10-06T16:05:07+00:00" }, { "name": "magento/zendframework1", @@ -676,7 +675,7 @@ "ZF1", "framework" ], - "time": "2017-01-17 16:40:08" + "time": "2017-01-17T16:40:08+00:00" }, { "name": "monolog/monolog", @@ -752,7 +751,7 @@ "logging", "psr-3" ], - "time": "2015-08-09 17:44:44" + "time": "2015-08-09T17:44:44+00:00" }, { "name": "oyejorge/less.php", @@ -814,7 +813,7 @@ "php", "stylesheet" ], - "time": "2015-12-30 05:47:36" + "time": "2015-12-30T05:47:36+00:00" }, { "name": "paragonie/random_compat", @@ -862,7 +861,7 @@ "pseudorandom", "random" ], - "time": "2016-11-07 23:38:38" + "time": "2016-11-07T23:38:38+00:00" }, { "name": "pelago/emogrifier", @@ -918,7 +917,7 @@ ], "description": "Converts CSS styles into inline style attributes in your HTML code", "homepage": "http://www.pelagodesign.com/sidecar/emogrifier/", - "time": "2015-05-15 11:37:51" + "time": "2015-05-15T11:37:51+00:00" }, { "name": "phpseclib/phpseclib", @@ -1010,7 +1009,7 @@ "x.509", "x509" ], - "time": "2016-10-04 00:57:04" + "time": "2016-10-04T00:57:04+00:00" }, { "name": "psr/log", @@ -1057,7 +1056,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", @@ -1137,7 +1136,7 @@ "identifier", "uuid" ], - "time": "2016-04-24 00:08:55" + "time": "2016-04-24T00:08:55+00:00" }, { "name": "seld/cli-prompt", @@ -1185,7 +1184,7 @@ "input", "prompt" ], - "time": "2016-04-18 09:31:41" + "time": "2016-04-18T09:31:41+00:00" }, { "name": "seld/jsonlint", @@ -1231,7 +1230,7 @@ "parser", "validator" ], - "time": "2016-11-14 17:59:58" + "time": "2016-11-14T17:59:58+00:00" }, { "name": "seld/phar-utils", @@ -1275,7 +1274,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13 18:44:15" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "sjparkinson/static-review", @@ -1328,7 +1327,7 @@ } ], "description": "An extendable framework for version control hooks.", - "time": "2014-09-22 08:40:36" + "time": "2014-09-22T08:40:36+00:00" }, { "name": "symfony/console", @@ -1386,7 +1385,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-07-26 09:08:40" + "time": "2015-07-26T09:08:40+00:00" }, { "name": "symfony/event-dispatcher", @@ -1446,7 +1445,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:30:24" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/filesystem", @@ -1495,7 +1494,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-01-08 20:47:33" + "time": "2017-01-08T20:47:33+00:00" }, { "name": "symfony/finder", @@ -1544,7 +1543,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:32:22" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/process", @@ -1593,7 +1592,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:30:24" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "tedivm/jshrink", @@ -1639,7 +1638,7 @@ "javascript", "minifier" ], - "time": "2014-11-11 03:54:14" + "time": "2014-11-11T03:54:14+00:00" }, { "name": "tubalmartin/cssmin", @@ -1683,7 +1682,7 @@ "minify", "yui" ], - "time": "2014-09-22 08:08:50" + "time": "2014-09-22T08:08:50+00:00" }, { "name": "zendframework/zend-code", @@ -1736,7 +1735,7 @@ "code", "zf2" ], - "time": "2015-05-11 16:17:05" + "time": "2015-05-11T16:17:05+00:00" }, { "name": "zendframework/zend-config", @@ -1793,7 +1792,7 @@ "config", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-console", @@ -1843,7 +1842,7 @@ "console", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-crypt", @@ -1895,7 +1894,60 @@ "crypt", "zf2" ], - "time": "2015-11-23 16:33:27" + "time": "2015-11-23T16:33:27+00:00" + }, + { + "name": "zendframework/zend-db", + "version": "2.4.11", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-db.git", + "reference": "b78b12c68bdafffaecb87f684426ad446b95204f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-db/zipball/b78b12c68bdafffaecb87f684426ad446b95204f", + "reference": "b78b12c68bdafffaecb87f684426ad446b95204f", + "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", + "zendframework/zend-eventmanager": "self.version", + "zendframework/zend-servicemanager": "self.version", + "zendframework/zend-stdlib": "self.version" + }, + "suggest": { + "zendframework/zend-eventmanager": "Zend\\EventManager component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev", + "dev-develop": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Db\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-db", + "keywords": [ + "db", + "zf2" + ], + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-di", @@ -1946,7 +1998,7 @@ "di", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-escaper", @@ -1991,7 +2043,7 @@ "escaper", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-eventmanager", @@ -2037,7 +2089,7 @@ "eventmanager", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-filter", @@ -2093,7 +2145,7 @@ "filter", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-form", @@ -2164,7 +2216,7 @@ "form", "zf2" ], - "time": "2015-09-09 19:11:05" + "time": "2015-09-09T19:11:05+00:00" }, { "name": "zendframework/zend-http", @@ -2215,7 +2267,7 @@ "http", "zf2" ], - "time": "2015-09-14 16:11:20" + "time": "2015-09-14T16:11:20+00:00" }, { "name": "zendframework/zend-i18n", @@ -2279,7 +2331,7 @@ "i18n", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-inputfilter", @@ -2330,7 +2382,7 @@ "inputfilter", "zf2" ], - "time": "2015-09-09 15:44:54" + "time": "2015-09-09T15:44:54+00:00" }, { "name": "zendframework/zend-json", @@ -2384,7 +2436,7 @@ "json", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-loader", @@ -2429,7 +2481,7 @@ "loader", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-log", @@ -2491,7 +2543,7 @@ "logging", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-math", @@ -2542,7 +2594,7 @@ "math", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-modulemanager", @@ -2600,7 +2652,7 @@ "modulemanager", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-mvc", @@ -2688,7 +2740,7 @@ "mvc", "zf2" ], - "time": "2015-09-14 16:32:50" + "time": "2015-09-14T16:32:50+00:00" }, { "name": "zendframework/zend-serializer", @@ -2741,7 +2793,7 @@ "serializer", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-server", @@ -2788,7 +2840,7 @@ "server", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-servicemanager", @@ -2838,7 +2890,7 @@ "servicemanager", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-soap", @@ -2890,7 +2942,7 @@ "soap", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-stdlib", @@ -2945,7 +2997,7 @@ "stdlib", "zf2" ], - "time": "2015-07-21 13:55:46" + "time": "2015-07-21T13:55:46+00:00" }, { "name": "zendframework/zend-text", @@ -2992,7 +3044,7 @@ "text", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-uri", @@ -3040,7 +3092,7 @@ "uri", "zf2" ], - "time": "2015-09-14 16:17:10" + "time": "2015-09-14T16:17:10+00:00" }, { "name": "zendframework/zend-validator", @@ -3105,7 +3157,7 @@ "validator", "zf2" ], - "time": "2015-09-08 21:04:17" + "time": "2015-09-08T21:04:17+00:00" }, { "name": "zendframework/zend-view", @@ -3182,7 +3234,7 @@ "view", "zf2" ], - "time": "2015-06-16 15:22:37" + "time": "2015-06-16T15:22:37+00:00" } ], "packages-dev": [ @@ -3238,7 +3290,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -3296,7 +3348,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2016-12-01 00:05:05" + "time": "2016-12-01T00:05:05+00:00" }, { "name": "lusitanian/oauth", @@ -3363,7 +3415,7 @@ "oauth", "security" ], - "time": "2015-10-07 00:20:04" + "time": "2015-10-07T00:20:04+00:00" }, { "name": "pdepend/pdepend", @@ -3403,7 +3455,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2017-01-10 13:45:16" + "time": "2017-01-10T13:45:16+00:00" }, { "name": "phpmd/phpmd", @@ -3468,7 +3520,7 @@ "phpmd", "pmd" ], - "time": "2016-11-23 20:33:32" + "time": "2016-11-23T20:33:32+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3530,7 +3582,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3575,7 +3627,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -3616,7 +3668,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -3660,7 +3712,7 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2016-05-12T18:03:57+00:00" }, { "name": "phpunit/php-token-stream", @@ -3709,7 +3761,7 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15 14:06:22" + "time": "2016-11-15T14:06:22+00:00" }, { "name": "phpunit/phpunit", @@ -3783,7 +3835,7 @@ "testing", "xunit" ], - "time": "2014-05-02 07:13:40" + "time": "2014-05-02T07:13:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -3839,20 +3891,20 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.2", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { @@ -3903,7 +3955,7 @@ "compare", "equality" ], - "time": "2016-11-19 09:18:40" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", @@ -3955,7 +4007,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", @@ -4005,7 +4057,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -4072,7 +4124,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/finder-facade", @@ -4111,7 +4163,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2016-02-17 07:02:23" + "time": "2016-02-17T07:02:23+00:00" }, { "name": "sebastian/phpcpd", @@ -4162,7 +4214,7 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2013-11-08 09:05:42" + "time": "2013-11-08T09:05:42+00:00" }, { "name": "sebastian/recursion-context", @@ -4215,7 +4267,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2015-11-11T19:50:13+00:00" }, { "name": "sebastian/version", @@ -4250,7 +4302,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -4325,7 +4377,7 @@ "phpcs", "standards" ], - "time": "2014-05-01 03:07:07" + "time": "2014-05-01T03:07:07+00:00" }, { "name": "symfony/config", @@ -4381,20 +4433,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:32:22" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.1.9", + "version": "v3.1.10", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "bedcf6d6b1be2fc25edcde41e8732b7ed9a6f4ba" + "reference": "f4a04433f82eb8ca58555d1b6375293fc7c90d18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bedcf6d6b1be2fc25edcde41e8732b7ed9a6f4ba", - "reference": "bedcf6d6b1be2fc25edcde41e8732b7ed9a6f4ba", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f4a04433f82eb8ca58555d1b6375293fc7c90d18", + "reference": "f4a04433f82eb8ca58555d1b6375293fc7c90d18", "shasum": "" }, "require": { @@ -4441,7 +4493,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-10 14:09:41" + "time": "2017-01-28T00:04:57+00:00" }, { "name": "symfony/stopwatch", @@ -4490,7 +4542,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:32:22" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/yaml", @@ -4539,7 +4591,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-03 13:49:52" + "time": "2017-01-03T13:49:52+00:00" }, { "name": "theseer/fdomdocument", @@ -4579,7 +4631,7 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2015-05-27 22:58:02" + "time": "2015-05-27T22:58:02+00:00" } ], "aliases": [], From 2b0725c8a5a7a7ecbfdfb0b29ea8e1c669c14d0b Mon Sep 17 00:00:00 2001 From: dmanners Date: Fri, 3 Feb 2017 09:43:20 +0000 Subject: [PATCH 08/28] Add case for \Zend\Db\Sql\Expression values in magento framework insertOnDuplicate method --- lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index b0173ab7c8a43..210ced53e5916 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -1879,6 +1879,8 @@ public function insertOnDuplicate($table, array $data, array $fields = []) $field = $this->quoteIdentifier($k); if ($v instanceof \Zend_Db_Expr) { $value = $v->__toString(); + } elseif ($v instanceof \Zend\Db\Sql\Expression) { + $value = $v->getExpression(); } elseif (is_string($v)) { $value = sprintf('VALUES(%s)', $this->quoteIdentifier($v)); } elseif (is_numeric($v)) { From 6b954855d6cac8301391825e2311666a9ec6b092 Mon Sep 17 00:00:00 2001 From: Viktor Paladiychuk Date: Fri, 3 Feb 2017 18:11:07 +0200 Subject: [PATCH 09/28] MAGETWO-62660: [GitHub] Overly aggressive performance optimizations of the static content deployment #7862 [fixed code style] --- .../Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php index 80d2b4f2b1ba4..2533476d44cae 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/JsDictionaryDeployTest.php @@ -100,5 +100,4 @@ public function testDeploy() $this->model->deploy($area, $themePath, $locale); } - -} \ No newline at end of file +} From 695b98b9a3739d5804c2b20cdcca1761f5b146fb Mon Sep 17 00:00:00 2001 From: Viktor Paladiychuk Date: Mon, 6 Feb 2017 13:15:46 +0200 Subject: [PATCH 10/28] MAGETWO-62660: [GitHub] Overly aggressive performance optimizations of the static content deployment #7862 --- app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php index d407f11fca55e..aa238337204cc 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php @@ -17,6 +17,10 @@ use Magento\Framework\App\ObjectManager; use Magento\Deploy\Model\DeployStrategyFactory; +/** + * To avoid duplication of deploying of all static content per each theme/local, this class uses copying/symlinking + * of default static files to other locales, separately calls deploy for js dictionary per each locale + */ class LocaleQuickDeploy implements DeployInterface { /** From f0f61b74aef9281bd0ff65d1064b9969dc872341 Mon Sep 17 00:00:00 2001 From: Giacomo Mirabassi Date: Tue, 7 Feb 2017 14:19:35 +0100 Subject: [PATCH 11/28] Fix "each()" function call on potentially invalid data --- .../Magento/Catalog/Model/ResourceModel/AbstractResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php index b1348697ee946..00cf1be4f2141 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php @@ -563,7 +563,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) } } - if (sizeof($attributesData) == 1) { + if (is_array($attributesData) && sizeof($attributesData) == 1) { $_data = each($attributesData); $attributesData = $_data[1]; } From d3fa692f3d18d207a8db91c39ed20d8ce6f58124 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 31 Jan 2017 07:58:35 +0000 Subject: [PATCH 12/28] Replace usage of Zend_Json in Magento Captcha with the \Magento\Framework\Serialize\SerializerInterface --- .../Captcha/Controller/Refresh/Index.php | 27 +++++++++------- .../Model/Customer/Plugin/AjaxLogin.php | 10 ++++-- .../Unit/Controller/Refresh/IndexTest.php | 21 +++++++++++- .../Model/Customer/Plugin/AjaxLoginTest.php | 32 +++++++++++++++---- 4 files changed, 69 insertions(+), 21 deletions(-) diff --git a/app/code/Magento/Captcha/Controller/Refresh/Index.php b/app/code/Magento/Captcha/Controller/Refresh/Index.php index 0124adc348bb7..7f9954adef2d9 100644 --- a/app/code/Magento/Captcha/Controller/Refresh/Index.php +++ b/app/code/Magento/Captcha/Controller/Refresh/Index.php @@ -17,13 +17,22 @@ class Index extends \Magento\Framework\App\Action\Action */ protected $captchaHelper; + /** + * @var \Magento\Framework\Serialize\SerializerInterface + */ + protected $serializer; + /** * @param Context $context * @param \Magento\Captcha\Helper\Data $captchaHelper */ - public function __construct(Context $context, \Magento\Captcha\Helper\Data $captchaHelper) - { + public function __construct( + Context $context, + \Magento\Captcha\Helper\Data $captchaHelper, + \Magento\Framework\Serialize\SerializerInterface $serializer + ) { $this->captchaHelper = $captchaHelper; + $this->serializer = $serializer; parent::__construct($context); } @@ -34,16 +43,12 @@ public function execute() { $formId = $this->_request->getPost('formId'); if (null === $formId) { - try { - $params = []; - $content = $this->_request->getContent(); - if ($content) { - $params = \Zend_Json::decode($content); - } - $formId = isset($params['formId']) ? $params['formId'] : null; - } catch (\Zend_Json_Exception $exception) { - $formId = null; + $params = []; + $content = $this->_request->getContent(); + if ($content) { + $params = $this->serializer->unserialize($content); } + $formId = isset($params['formId']) ? $params['formId'] : null; } $captchaModel = $this->captchaHelper->getCaptcha($formId); $captchaModel->generate(); diff --git a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php index d2f3cbda170b4..e76f2db1431e5 100644 --- a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php +++ b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php @@ -26,6 +26,11 @@ class AjaxLogin */ protected $resultJsonFactory; + /** + * @var \Magento\Framework\Serialize\SerializerInterface + */ + protected $serializer; + /** * @var array */ @@ -41,11 +46,13 @@ public function __construct( CaptchaHelper $helper, SessionManagerInterface $sessionManager, JsonFactory $resultJsonFactory, + \Magento\Framework\Serialize\SerializerInterface $serializer, array $formIds ) { $this->helper = $helper; $this->sessionManager = $sessionManager; $this->resultJsonFactory = $resultJsonFactory; + $this->serializer = $serializer; $this->formIds = $formIds; } @@ -53,7 +60,6 @@ public function __construct( * @param \Magento\Customer\Controller\Ajax\Login $subject * @param \Closure $proceed * @return $this - * @throws \Zend_Json_Exception * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ @@ -70,7 +76,7 @@ public function aroundExecute( $loginParams = []; $content = $request->getContent(); if ($content) { - $loginParams = \Zend_Json::decode($content); + $loginParams = $this->serializer->unserialize($content); } $username = isset($loginParams['username']) ? $loginParams['username'] : null; $captchaString = isset($loginParams[$captchaInputName]) ? $loginParams[$captchaInputName] : null; diff --git a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php index a99ec53ab2400..adcbd38e9f6d7 100644 --- a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php @@ -47,6 +47,11 @@ class IndexTest extends \PHPUnit_Framework_TestCase */ protected $flagMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $serializerMock; + /** * @var \Magento\Captcha\Controller\Refresh\Index */ @@ -62,6 +67,13 @@ protected function setUp() $this->viewMock = $this->getMock(\Magento\Framework\App\ViewInterface::class); $this->layoutMock = $this->getMock(\Magento\Framework\View\LayoutInterface::class); $this->flagMock = $this->getMock(\Magento\Framework\App\ActionFlag::class, [], [], '', false); + $this->serializerMock = $this->getMock( + \Magento\Framework\Serialize\SerializerInterface::class, + [], + [], + '', + false + ); $this->contextMock->expects($this->any())->method('getRequest')->will($this->returnValue($this->requestMock)); $this->contextMock->expects($this->any())->method('getView')->will($this->returnValue($this->viewMock)); @@ -69,13 +81,18 @@ protected function setUp() $this->contextMock->expects($this->any())->method('getActionFlag')->will($this->returnValue($this->flagMock)); $this->viewMock->expects($this->any())->method('getLayout')->will($this->returnValue($this->layoutMock)); - $this->model = new \Magento\Captcha\Controller\Refresh\Index($this->contextMock, $this->captchaHelperMock); + $this->model = new \Magento\Captcha\Controller\Refresh\Index( + $this->contextMock, + $this->captchaHelperMock, + $this->serializerMock + ); } /** * @dataProvider executeDataProvider * @param int $formId * @param int $callsNumber + * @throws \PHPUnit_Framework_Exception */ public function testExecute($formId, $callsNumber) { @@ -99,6 +116,8 @@ public function testExecute($formId, $callsNumber) $blockMock->expects($this->once())->method('toHtml'); $this->responseMock->expects($this->once())->method('representJson')->with(json_encode(['imgSrc' => 'source'])); $this->flagMock->expects($this->once())->method('set')->with('', 'no-postDispatch', true); + $this->serializerMock->expects($this->exactly($callsNumber)) + ->method('unserialize')->will($this->returnValue($content)); $this->model->execute(); } diff --git a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php index 8047138e34528..e4a640f8efe51 100644 --- a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php @@ -42,6 +42,11 @@ class AjaxLoginTest extends \PHPUnit_Framework_TestCase */ protected $loginControllerMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $serializerMock; + /** * @var array */ @@ -79,11 +84,19 @@ protected function setUp() $this->captchaHelperMock->expects($this->once())->method('getCaptcha') ->with('user_login')->will($this->returnValue($this->captchaMock)); $this->formIds = ['user_login']; + $this->serializerMock = $this->getMock( + \Magento\Framework\Serialize\SerializerInterface::class, + [], + [], + '', + false + ); $this->model = new \Magento\Captcha\Model\Customer\Plugin\AjaxLogin( $this->captchaHelperMock, $this->sessionManagerMock, $this->jsonFactoryMock, + $this->serializerMock, $this->formIds ); } @@ -92,11 +105,12 @@ public function testAroundExecute() { $username = 'name'; $captchaString = 'string'; - $requestContent = json_encode([ + $requestData = [ 'username' => $username, 'captcha_string' => $captchaString, 'captcha_form_id' => $this->formIds[0] - ]); + ]; + $requestContent = json_encode($requestData); $this->requestMock->expects($this->once())->method('getContent')->will($this->returnValue($requestContent)); $this->captchaMock->expects($this->once())->method('isRequired')->with($username) @@ -104,6 +118,7 @@ public function testAroundExecute() $this->captchaMock->expects($this->once())->method('logAttempt')->with($username); $this->captchaMock->expects($this->once())->method('isCorrect')->with($captchaString) ->will($this->returnValue(true)); + $this->serializerMock->expects(($this->once()))->method('unserialize')->will($this->returnValue($requestData)); $closure = function () { return 'result'; @@ -115,11 +130,12 @@ public function testAroundExecuteIncorrectCaptcha() { $username = 'name'; $captchaString = 'string'; - $requestContent = json_encode([ + $requestData = [ 'username' => $username, 'captcha_string' => $captchaString, 'captcha_form_id' => $this->formIds[0] - ]); + ]; + $requestContent = json_encode($requestData); $this->requestMock->expects($this->once())->method('getContent')->will($this->returnValue($requestContent)); $this->captchaMock->expects($this->once())->method('isRequired')->with($username) @@ -127,6 +143,7 @@ public function testAroundExecuteIncorrectCaptcha() $this->captchaMock->expects($this->once())->method('logAttempt')->with($username); $this->captchaMock->expects($this->once())->method('isCorrect') ->with($captchaString)->will($this->returnValue(false)); + $this->serializerMock->expects(($this->once()))->method('unserialize')->will($this->returnValue($requestData)); $this->sessionManagerMock->expects($this->once())->method('setUsername')->with($username); $this->jsonFactoryMock->expects($this->once())->method('create') @@ -147,7 +164,8 @@ public function testAroundExecuteIncorrectCaptcha() */ public function testAroundExecuteCaptchaIsNotRequired($username, $requestContent) { - $this->requestMock->expects($this->once())->method('getContent')->will($this->returnValue($requestContent)); + $this->requestMock->expects($this->once())->method('getContent')->will($this->returnValue(json_encode($requestContent))); + $this->serializerMock->expects(($this->once()))->method('unserialize')->will($this->returnValue($requestContent)); $this->captchaMock->expects($this->once())->method('isRequired')->with($username) ->will($this->returnValue(false)); @@ -168,11 +186,11 @@ public function aroundExecuteCaptchaIsNotRequired() return [ [ 'username' => 'name', - 'requestContent' => json_encode(['username' => 'name', 'captcha_string' => 'string']), + 'requestData' => ['username' => 'name', 'captcha_string' => 'string'], ], [ 'username' => null, - 'requestContent' => json_encode(['captcha_string' => 'string']), + 'requestData' => ['captcha_string' => 'string'], ], ]; } From 5d68d6cd9fd33d9a74adc6bc2ef5b07795e6a319 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 31 Jan 2017 08:05:00 +0000 Subject: [PATCH 13/28] Replace the usage of json_encode in app/code/Magento/Captcha/Controller/Refresh/Index.php to use the lib json serializer object --- app/code/Magento/Captcha/Controller/Refresh/Index.php | 2 +- .../Captcha/Test/Unit/Controller/Refresh/IndexTest.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Captcha/Controller/Refresh/Index.php b/app/code/Magento/Captcha/Controller/Refresh/Index.php index 7f9954adef2d9..d9b946c45bb7a 100644 --- a/app/code/Magento/Captcha/Controller/Refresh/Index.php +++ b/app/code/Magento/Captcha/Controller/Refresh/Index.php @@ -55,7 +55,7 @@ public function execute() $block = $this->_view->getLayout()->createBlock($captchaModel->getBlockName()); $block->setFormId($formId)->setIsAjax(true)->toHtml(); - $this->_response->representJson(json_encode(['imgSrc' => $captchaModel->getImgSrc()])); + $this->_response->representJson($this->serializer->serialize(['imgSrc' => $captchaModel->getImgSrc()])); $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); } } diff --git a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php index adcbd38e9f6d7..2c1c8919e5708 100644 --- a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php @@ -97,6 +97,7 @@ protected function setUp() public function testExecute($formId, $callsNumber) { $content = ['formId' => $formId]; + $imgSource = ['imgSrc' => 'source']; $blockMethods = ['setFormId', 'setIsAjax', 'toHtml']; $blockMock = $this->getMock(\Magento\Captcha\Block\Captcha::class, $blockMethods, [], '', false); @@ -114,10 +115,12 @@ public function testExecute($formId, $callsNumber) $blockMock->expects($this->any())->method('setFormId')->with($formId)->will($this->returnValue($blockMock)); $blockMock->expects($this->any())->method('setIsAjax')->with(true)->will($this->returnValue($blockMock)); $blockMock->expects($this->once())->method('toHtml'); - $this->responseMock->expects($this->once())->method('representJson')->with(json_encode(['imgSrc' => 'source'])); + $this->responseMock->expects($this->once())->method('representJson')->with(json_encode($imgSource)); $this->flagMock->expects($this->once())->method('set')->with('', 'no-postDispatch', true); $this->serializerMock->expects($this->exactly($callsNumber)) ->method('unserialize')->will($this->returnValue($content)); + $this->serializerMock->expects($this->once()) + ->method('serialize')->will($this->returnValue(json_encode($imgSource))); $this->model->execute(); } From 65c9eff45503ba4d284515f91fa5c8bce5513209 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 31 Jan 2017 08:13:26 +0000 Subject: [PATCH 14/28] Replace the usage of json_encode and object manager in app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php --- .../Controller/Adminhtml/Refresh/Refresh.php | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php index 9c7ccc0983db7..79f261d6d4fb0 100644 --- a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php +++ b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php @@ -10,13 +10,37 @@ class Refresh extends \Magento\Backend\App\Action { + /** + * @var \Magento\Framework\View\Result\PageFactory + */ + protected $serializer; + + /** + * @var \Magento\Captcha\Helper\Data + */ + protected $captchaHelper; + + /** + * @param \Magento\Backend\App\Action\Context $context + * @param \Magento\Framework\Serialize\SerializerInterface $serializer + */ + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Framework\Serialize\SerializerInterface $serializer, + \Magento\Captcha\Helper\Data $captchaHelper + ) { + parent::__construct($context); + $this->serializer = $serializer; + $this->captchaHelper = $captchaHelper; + } + /** * {@inheritdoc} */ public function execute() { $formId = $this->getRequest()->getPost('formId'); - $captchaModel = $this->_objectManager->get(\Magento\Captcha\Helper\Data::class)->getCaptcha($formId); + $captchaModel = $this->captchaHelper->getCaptcha($formId); $this->_view->getLayout()->createBlock( $captchaModel->getBlockName() )->setFormId( @@ -24,7 +48,7 @@ public function execute() )->setIsAjax( true )->toHtml(); - $this->getResponse()->representJson(json_encode(['imgSrc' => $captchaModel->getImgSrc()])); + $this->getResponse()->representJson($this->serializer->serialize(['imgSrc' => $captchaModel->getImgSrc()])); $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); } From e80321aca7e53684809a6bc8ed3300b86ffbf0f9 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 31 Jan 2017 08:20:10 +0000 Subject: [PATCH 15/28] Update the phpdocs in the Captcha admin controller to include the captcha helper --- .../Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php index 79f261d6d4fb0..f8ca7cdd048a1 100644 --- a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php +++ b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php @@ -23,6 +23,7 @@ class Refresh extends \Magento\Backend\App\Action /** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Framework\Serialize\SerializerInterface $serializer + * @param \Magento\Captcha\Helper\Data $captchaHelper */ public function __construct( \Magento\Backend\App\Action\Context $context, From debea1867fbbb0393aa6f0b8949dcc9b65e96e24 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 31 Jan 2017 08:39:38 +0000 Subject: [PATCH 16/28] Update phpcods to include the serializer object --- app/code/Magento/Captcha/Controller/Refresh/Index.php | 1 + .../Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php | 1 + .../Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Captcha/Controller/Refresh/Index.php b/app/code/Magento/Captcha/Controller/Refresh/Index.php index d9b946c45bb7a..655a4711e3fa3 100644 --- a/app/code/Magento/Captcha/Controller/Refresh/Index.php +++ b/app/code/Magento/Captcha/Controller/Refresh/Index.php @@ -25,6 +25,7 @@ class Index extends \Magento\Framework\App\Action\Action /** * @param Context $context * @param \Magento\Captcha\Helper\Data $captchaHelper + * @param \Magento\Framework\Serialize\SerializerInterface $serializer */ public function __construct( Context $context, diff --git a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php index e76f2db1431e5..5f81c5ecbb43b 100644 --- a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php +++ b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php @@ -40,6 +40,7 @@ class AjaxLogin * @param CaptchaHelper $helper * @param SessionManagerInterface $sessionManager * @param JsonFactory $resultJsonFactory + * @param \Magento\Framework\Serialize\SerializerInterface $serializer * @param array $formIds */ public function __construct( diff --git a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php index e4a640f8efe51..9b7c892e4de75 100644 --- a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php @@ -164,8 +164,10 @@ public function testAroundExecuteIncorrectCaptcha() */ public function testAroundExecuteCaptchaIsNotRequired($username, $requestContent) { - $this->requestMock->expects($this->once())->method('getContent')->will($this->returnValue(json_encode($requestContent))); - $this->serializerMock->expects(($this->once()))->method('unserialize')->will($this->returnValue($requestContent)); + $this->requestMock->expects($this->once())->method('getContent') + ->will($this->returnValue(json_encode($requestContent))); + $this->serializerMock->expects(($this->once()))->method('unserialize') + ->will($this->returnValue($requestContent)); $this->captchaMock->expects($this->once())->method('isRequired')->with($username) ->will($this->returnValue(false)); From a26f8da559ef90242658331c3f49b0a6ae74a297 Mon Sep 17 00:00:00 2001 From: dmanners Date: Thu, 2 Feb 2017 09:54:33 +0000 Subject: [PATCH 17/28] Fix serializer type hint in the admin controller of mage captcha module --- .../Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php index f8ca7cdd048a1..ebb30e78ce627 100644 --- a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php +++ b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php @@ -11,7 +11,7 @@ class Refresh extends \Magento\Backend\App\Action { /** - * @var \Magento\Framework\View\Result\PageFactory + * @var \Magento\Framework\Serialize\SerializerInterface */ protected $serializer; From 298d3c5bbd9643eceeb4f0eb5cf7c4d06e23e521 Mon Sep 17 00:00:00 2001 From: dmanners Date: Fri, 3 Feb 2017 16:23:08 +0000 Subject: [PATCH 18/28] Make sure that the new dependancy on SerializerInterface is not required --- .../Captcha/Controller/Adminhtml/Refresh/Refresh.php | 8 +++++--- app/code/Magento/Captcha/Controller/Refresh/Index.php | 8 +++++--- .../Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php index ebb30e78ce627..ab202aa9701e1 100644 --- a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php +++ b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php @@ -22,16 +22,18 @@ class Refresh extends \Magento\Backend\App\Action /** * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Framework\Serialize\SerializerInterface $serializer + * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer * @param \Magento\Captcha\Helper\Data $captchaHelper + * @throws \RuntimeException */ public function __construct( \Magento\Backend\App\Action\Context $context, - \Magento\Framework\Serialize\SerializerInterface $serializer, + \Magento\Framework\Serialize\SerializerInterface $serializer = null, \Magento\Captcha\Helper\Data $captchaHelper ) { parent::__construct($context); - $this->serializer = $serializer; + $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\SerializerInterface::class); $this->captchaHelper = $captchaHelper; } diff --git a/app/code/Magento/Captcha/Controller/Refresh/Index.php b/app/code/Magento/Captcha/Controller/Refresh/Index.php index 655a4711e3fa3..9d3ad3fb8d48b 100644 --- a/app/code/Magento/Captcha/Controller/Refresh/Index.php +++ b/app/code/Magento/Captcha/Controller/Refresh/Index.php @@ -25,15 +25,17 @@ class Index extends \Magento\Framework\App\Action\Action /** * @param Context $context * @param \Magento\Captcha\Helper\Data $captchaHelper - * @param \Magento\Framework\Serialize\SerializerInterface $serializer + * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer + * @throws \RuntimeException */ public function __construct( Context $context, \Magento\Captcha\Helper\Data $captchaHelper, - \Magento\Framework\Serialize\SerializerInterface $serializer + \Magento\Framework\Serialize\SerializerInterface $serializer = null ) { $this->captchaHelper = $captchaHelper; - $this->serializer = $serializer; + $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\SerializerInterface::class); parent::__construct($context); } diff --git a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php index 5f81c5ecbb43b..c7befc63bdf5a 100644 --- a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php +++ b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php @@ -40,20 +40,22 @@ class AjaxLogin * @param CaptchaHelper $helper * @param SessionManagerInterface $sessionManager * @param JsonFactory $resultJsonFactory - * @param \Magento\Framework\Serialize\SerializerInterface $serializer + * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer * @param array $formIds + * @throws \RuntimeException */ public function __construct( CaptchaHelper $helper, SessionManagerInterface $sessionManager, JsonFactory $resultJsonFactory, - \Magento\Framework\Serialize\SerializerInterface $serializer, + \Magento\Framework\Serialize\SerializerInterface $serializer = null, array $formIds ) { $this->helper = $helper; $this->sessionManager = $sessionManager; $this->resultJsonFactory = $resultJsonFactory; - $this->serializer = $serializer; + $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\SerializerInterface::class); $this->formIds = $formIds; } From 6a2e35332b6a6d9d082a8e3a2ebc3eafff8c8918 Mon Sep 17 00:00:00 2001 From: dmanners Date: Fri, 3 Feb 2017 19:01:42 +0000 Subject: [PATCH 19/28] Make sure that the optional dependancies are last in the constructor --- .../Captcha/Controller/Adminhtml/Refresh/Refresh.php | 7 ++++--- .../Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php | 4 ++-- .../Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php index ab202aa9701e1..4c2f51e7416c5 100644 --- a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php +++ b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php @@ -21,15 +21,16 @@ class Refresh extends \Magento\Backend\App\Action protected $captchaHelper; /** + * Refresh constructor. * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer * @param \Magento\Captcha\Helper\Data $captchaHelper + * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer * @throws \RuntimeException */ public function __construct( \Magento\Backend\App\Action\Context $context, - \Magento\Framework\Serialize\SerializerInterface $serializer = null, - \Magento\Captcha\Helper\Data $captchaHelper + \Magento\Captcha\Helper\Data $captchaHelper, + \Magento\Framework\Serialize\SerializerInterface $serializer = null ) { parent::__construct($context); $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() diff --git a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php index c7befc63bdf5a..7e22196731b89 100644 --- a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php +++ b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php @@ -48,8 +48,8 @@ public function __construct( CaptchaHelper $helper, SessionManagerInterface $sessionManager, JsonFactory $resultJsonFactory, - \Magento\Framework\Serialize\SerializerInterface $serializer = null, - array $formIds + array $formIds, + \Magento\Framework\Serialize\SerializerInterface $serializer = null ) { $this->helper = $helper; $this->sessionManager = $sessionManager; diff --git a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php index 9b7c892e4de75..a24b034b18934 100644 --- a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php @@ -96,8 +96,8 @@ protected function setUp() $this->captchaHelperMock, $this->sessionManagerMock, $this->jsonFactoryMock, - $this->serializerMock, - $this->formIds + $this->formIds, + $this->serializerMock ); } From c5bb856b27a356cf8ee2ddf5c41da22b22a54bef Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 7 Feb 2017 16:44:10 +0000 Subject: [PATCH 20/28] Specifically ask for the Json Serializer object and not just relying on the interface that could change --- .../Captcha/Controller/Adminhtml/Refresh/Refresh.php | 10 ++++------ app/code/Magento/Captcha/Controller/Refresh/Index.php | 8 ++++---- .../Captcha/Model/Customer/Plugin/AjaxLogin.php | 8 ++++---- .../Captcha/Test/Unit/Controller/Refresh/IndexTest.php | 2 +- .../Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php index 4c2f51e7416c5..47e0103dd1907 100644 --- a/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php +++ b/app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php @@ -11,7 +11,7 @@ class Refresh extends \Magento\Backend\App\Action { /** - * @var \Magento\Framework\Serialize\SerializerInterface + * @var \Magento\Framework\Serialize\Serializer\Json */ protected $serializer; @@ -24,17 +24,15 @@ class Refresh extends \Magento\Backend\App\Action * Refresh constructor. * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Captcha\Helper\Data $captchaHelper - * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer - * @throws \RuntimeException + * @param \Magento\Framework\Serialize\Serializer\Json $serializer */ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Captcha\Helper\Data $captchaHelper, - \Magento\Framework\Serialize\SerializerInterface $serializer = null + \Magento\Framework\Serialize\Serializer\Json $serializer ) { parent::__construct($context); - $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\SerializerInterface::class); + $this->serializer = $serializer; $this->captchaHelper = $captchaHelper; } diff --git a/app/code/Magento/Captcha/Controller/Refresh/Index.php b/app/code/Magento/Captcha/Controller/Refresh/Index.php index 9d3ad3fb8d48b..ef757d1b2fc35 100644 --- a/app/code/Magento/Captcha/Controller/Refresh/Index.php +++ b/app/code/Magento/Captcha/Controller/Refresh/Index.php @@ -18,24 +18,24 @@ class Index extends \Magento\Framework\App\Action\Action protected $captchaHelper; /** - * @var \Magento\Framework\Serialize\SerializerInterface + * @var \Magento\Framework\Serialize\Serializer\Json */ protected $serializer; /** * @param Context $context * @param \Magento\Captcha\Helper\Data $captchaHelper - * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer * @throws \RuntimeException */ public function __construct( Context $context, \Magento\Captcha\Helper\Data $captchaHelper, - \Magento\Framework\Serialize\SerializerInterface $serializer = null + \Magento\Framework\Serialize\Serializer\Json $serializer = null ) { $this->captchaHelper = $captchaHelper; $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\SerializerInterface::class); + ->get(\Magento\Framework\Serialize\Serializer\Json::class); parent::__construct($context); } diff --git a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php index 7e22196731b89..a21c007056e73 100644 --- a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php +++ b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php @@ -27,7 +27,7 @@ class AjaxLogin protected $resultJsonFactory; /** - * @var \Magento\Framework\Serialize\SerializerInterface + * @var \Magento\Framework\Serialize\Serializer\Json */ protected $serializer; @@ -40,8 +40,8 @@ class AjaxLogin * @param CaptchaHelper $helper * @param SessionManagerInterface $sessionManager * @param JsonFactory $resultJsonFactory - * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer * @param array $formIds + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer * @throws \RuntimeException */ public function __construct( @@ -49,13 +49,13 @@ public function __construct( SessionManagerInterface $sessionManager, JsonFactory $resultJsonFactory, array $formIds, - \Magento\Framework\Serialize\SerializerInterface $serializer = null + \Magento\Framework\Serialize\Serializer\Json $serializer = null ) { $this->helper = $helper; $this->sessionManager = $sessionManager; $this->resultJsonFactory = $resultJsonFactory; $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\SerializerInterface::class); + ->get(\Magento\Framework\Serialize\Serializer\Json::class); $this->formIds = $formIds; } diff --git a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php index 2c1c8919e5708..5fcb4c4fe8828 100644 --- a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php @@ -68,7 +68,7 @@ protected function setUp() $this->layoutMock = $this->getMock(\Magento\Framework\View\LayoutInterface::class); $this->flagMock = $this->getMock(\Magento\Framework\App\ActionFlag::class, [], [], '', false); $this->serializerMock = $this->getMock( - \Magento\Framework\Serialize\SerializerInterface::class, + \Magento\Framework\Serialize\Serializer\Json::class, [], [], '', diff --git a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php index a24b034b18934..858b4bc8d9ebc 100644 --- a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php @@ -85,7 +85,7 @@ protected function setUp() ->with('user_login')->will($this->returnValue($this->captchaMock)); $this->formIds = ['user_login']; $this->serializerMock = $this->getMock( - \Magento\Framework\Serialize\SerializerInterface::class, + \Magento\Framework\Serialize\Serializer\Json::class, [], [], '', From afd5c6f7991b78b90d41f71c19e1d426267c95d4 Mon Sep 17 00:00:00 2001 From: dmanners Date: Fri, 3 Feb 2017 16:17:26 +0000 Subject: [PATCH 21/28] Remove Zend_Json from Ajax/Serializer class in Mage Catalog --- .../Product/Edit/Tab/Ajax/Serializer.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php index f93eaa19599ba..452bd54da1b51 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php @@ -5,8 +5,30 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax; +use Magento\Framework\View\Element\Template; + class Serializer extends \Magento\Framework\View\Element\Template { + /** + * @var \Magento\Framework\Serialize\SerializerInterface + */ + private $serializer; + + /** + * @param Template\Context $context + * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer + * @param array $data + */ + public function __construct( + Template\Context $context, + \Magento\Framework\Serialize\SerializerInterface $serializer = null, + array $data = [] + ) { + parent::__construct($context, $data); + $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\SerializerInterface::class); + } + /** * @return $this */ @@ -19,6 +41,7 @@ public function _construct() /** * @return string + * @deprecated */ public function getProductsJSON() { @@ -30,6 +53,6 @@ public function getProductsJSON() $result[$id] = $product->toArray(['qty', 'position']); } } - return $result ? \Zend_Json::encode($result) : '{}'; + return $result ? $this->serializer->serialize($result) : '{}'; } } From d4d0b6a09d5e553116f68bbb2244b15c6ecb08bc Mon Sep 17 00:00:00 2001 From: dmanners Date: Fri, 3 Feb 2017 21:35:35 +0000 Subject: [PATCH 22/28] Update the Ajax serializer to have a deprecated notice in the class phpdocs --- .../Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php index 452bd54da1b51..c6678590a2ceb 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php @@ -7,6 +7,11 @@ use Magento\Framework\View\Element\Template; +/** + * Class Serializer + * @package Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax + * @deprecated + */ class Serializer extends \Magento\Framework\View\Element\Template { /** @@ -18,6 +23,7 @@ class Serializer extends \Magento\Framework\View\Element\Template * @param Template\Context $context * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer * @param array $data + * @throws \RuntimeException */ public function __construct( Template\Context $context, From 4135880a9ce7acfb02a94a3495f054146ab72018 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 7 Feb 2017 16:49:13 +0000 Subject: [PATCH 23/28] Specifically ask for the Json Serializer object and not just relying on the interface that could change --- .../Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php index c6678590a2ceb..82e9de3ba16a9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php @@ -15,24 +15,24 @@ class Serializer extends \Magento\Framework\View\Element\Template { /** - * @var \Magento\Framework\Serialize\SerializerInterface + * @var \Magento\Framework\Serialize\Serializer\Json */ private $serializer; /** * @param Template\Context $context - * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer * @param array $data * @throws \RuntimeException */ public function __construct( Template\Context $context, - \Magento\Framework\Serialize\SerializerInterface $serializer = null, + \Magento\Framework\Serialize\Serializer\Json $serializer = null, array $data = [] ) { parent::__construct($context, $data); $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\SerializerInterface::class); + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** From 3c8f1321d875cd1daf16fb3520759cf15828d3e6 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 7 Feb 2017 16:52:08 +0000 Subject: [PATCH 24/28] Specifically ask for the Json Serializer object and not just relying on the interface that could change --- .../Gateway/Response/VaultDetailsHandler.php | 11 ++++++----- .../Unit/Gateway/Response/VaultDetailsHandlerTest.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php b/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php index c1a19af3c8a1b..f6c1cf4f2b8b0 100644 --- a/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php +++ b/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php @@ -42,32 +42,33 @@ class VaultDetailsHandler implements HandlerInterface protected $config; /** - * @var \Magento\Framework\Serialize\SerializerInterface + * @var \Magento\Framework\Serialize\Serializer\Json */ private $serializer; /** - * Constructor + * VaultDetailsHandler constructor. * * @param PaymentTokenInterfaceFactory $paymentTokenFactory * @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory * @param Config $config * @param SubjectReader $subjectReader - * @param \Magento\Framework\Serialize\SerializerInterface $serializer + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @throws \RuntimeException */ public function __construct( PaymentTokenInterfaceFactory $paymentTokenFactory, OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory, Config $config, SubjectReader $subjectReader, - \Magento\Framework\Serialize\SerializerInterface $serializer = null + \Magento\Framework\Serialize\Serializer\Json $serializer = null ) { $this->paymentTokenFactory = $paymentTokenFactory; $this->paymentExtensionFactory = $paymentExtensionFactory; $this->config = $config; $this->subjectReader = $subjectReader; $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\SerializerInterface::class); + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Response/VaultDetailsHandlerTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Response/VaultDetailsHandlerTest.php index c6ccc2d7ec93f..3a009c2ee06c6 100644 --- a/app/code/Magento/Braintree/Test/Unit/Gateway/Response/VaultDetailsHandlerTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Response/VaultDetailsHandlerTest.php @@ -123,7 +123,7 @@ protected function setUp() ->willReturn($mapperArray); $this->serializer = $this->getMock( - \Magento\Framework\Serialize\SerializerInterface::class, + \Magento\Framework\Serialize\Serializer\Json::class, [], [], '', From 116dab5d7d139fefbc61c16e06918c9ed1e968c4 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Tue, 7 Feb 2017 17:36:09 -0600 Subject: [PATCH 25/28] MAGETWO-64327: [GitHub] [PR] Remove Zend1 db from captcha module magento/magento2#8402 - updated composer.lock file --- composer.lock | 115 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 84 insertions(+), 31 deletions(-) diff --git a/composer.lock b/composer.lock index 9d48076d1d8e2..43aed0d655764 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "8273e2855879d0ad9fd54d990282d309", - "content-hash": "c66d62a5e411d8db22d8990678b7c0ac", + "hash": "809100182d4f43100e8a3b5a9cec99ad", + "content-hash": "dec954aef52a7ea9cdf64328f2cb8388", "packages": [ { "name": "braintree/braintree_php", @@ -1392,7 +1392,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.16", + "version": "v2.8.17", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1452,7 +1452,7 @@ }, { "name": "symfony/filesystem", - "version": "v3.2.2", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -1501,7 +1501,7 @@ }, { "name": "symfony/finder", - "version": "v3.2.2", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1550,16 +1550,16 @@ }, { "name": "symfony/process", - "version": "v2.8.16", + "version": "v2.8.17", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231" + "reference": "0110ac49348d14eced7d3278ea7485f22196932e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ebb3c2abe0940a703f08e0cbe373f62d97d40231", - "reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231", + "url": "https://api.github.com/repos/symfony/process/zipball/0110ac49348d14eced7d3278ea7485f22196932e", + "reference": "0110ac49348d14eced7d3278ea7485f22196932e", "shasum": "" }, "require": { @@ -1595,7 +1595,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:30:24" + "time": "2017-02-03 12:08:06" }, { "name": "tedivm/jshrink", @@ -1899,6 +1899,59 @@ ], "time": "2015-11-23 16:33:27" }, + { + "name": "zendframework/zend-db", + "version": "2.4.11", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-db.git", + "reference": "b78b12c68bdafffaecb87f684426ad446b95204f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-db/zipball/b78b12c68bdafffaecb87f684426ad446b95204f", + "reference": "b78b12c68bdafffaecb87f684426ad446b95204f", + "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", + "zendframework/zend-eventmanager": "self.version", + "zendframework/zend-servicemanager": "self.version", + "zendframework/zend-stdlib": "self.version" + }, + "suggest": { + "zendframework/zend-eventmanager": "Zend\\EventManager component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev", + "dev-develop": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Db\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-db", + "keywords": [ + "db", + "zf2" + ], + "time": "2015-05-07 14:55:31" + }, { "name": "zendframework/zend-di", "version": "2.4.11", @@ -3845,16 +3898,16 @@ }, { "name": "sebastian/comparator", - "version": "1.2.2", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { @@ -3905,7 +3958,7 @@ "compare", "equality" ], - "time": "2016-11-19 09:18:40" + "time": "2017-01-29 09:50:25" }, { "name": "sebastian/diff", @@ -4331,16 +4384,16 @@ }, { "name": "symfony/config", - "version": "v3.2.2", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "c5ea878b5a7f6a01b9a2f182f905831711b9ff3f" + "reference": "2ffa7b84d647b8be1788d46b44e438cb3d62056c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/c5ea878b5a7f6a01b9a2f182f905831711b9ff3f", - "reference": "c5ea878b5a7f6a01b9a2f182f905831711b9ff3f", + "url": "https://api.github.com/repos/symfony/config/zipball/2ffa7b84d647b8be1788d46b44e438cb3d62056c", + "reference": "2ffa7b84d647b8be1788d46b44e438cb3d62056c", "shasum": "" }, "require": { @@ -4383,20 +4436,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:32:22" + "time": "2017-02-06 12:04:21" }, { "name": "symfony/dependency-injection", - "version": "v3.1.9", + "version": "v3.1.10", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "bedcf6d6b1be2fc25edcde41e8732b7ed9a6f4ba" + "reference": "f4a04433f82eb8ca58555d1b6375293fc7c90d18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bedcf6d6b1be2fc25edcde41e8732b7ed9a6f4ba", - "reference": "bedcf6d6b1be2fc25edcde41e8732b7ed9a6f4ba", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f4a04433f82eb8ca58555d1b6375293fc7c90d18", + "reference": "f4a04433f82eb8ca58555d1b6375293fc7c90d18", "shasum": "" }, "require": { @@ -4443,11 +4496,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-10 14:09:41" + "time": "2017-01-28 00:04:57" }, { "name": "symfony/stopwatch", - "version": "v3.2.2", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -4496,16 +4549,16 @@ }, { "name": "symfony/yaml", - "version": "v2.8.16", + "version": "v2.8.17", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2" + "reference": "322a8c2dfbca15ad6b1b27e182899f98ec0e0153" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2", - "reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/322a8c2dfbca15ad6b1b27e182899f98ec0e0153", + "reference": "322a8c2dfbca15ad6b1b27e182899f98ec0e0153", "shasum": "" }, "require": { @@ -4541,7 +4594,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-03 13:49:52" + "time": "2017-01-21 16:40:50" }, { "name": "theseer/fdomdocument", From 31b442b53573f7a6d1b6b99a0027f680f95a8feb Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Wed, 8 Feb 2017 12:06:57 +0200 Subject: [PATCH 26/28] MAGETWO-64331: [GitHub] [PR] Remove Zend1 Json from Magento Captcha module magento/magento2#8331 - Reduced coupling for the test --- .../Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php index 5fcb4c4fe8828..2be84ada99ca4 100644 --- a/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php @@ -92,7 +92,6 @@ protected function setUp() * @dataProvider executeDataProvider * @param int $formId * @param int $callsNumber - * @throws \PHPUnit_Framework_Exception */ public function testExecute($formId, $callsNumber) { From 742afea787df554abd2a994b5d55edf9737391bd Mon Sep 17 00:00:00 2001 From: Eino Keskitalo Date: Wed, 8 Feb 2017 12:20:51 +0200 Subject: [PATCH 27/28] Remove outdated comment --- app/code/Magento/MediaStorage/Helper/File/Storage/Database.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/MediaStorage/Helper/File/Storage/Database.php b/app/code/Magento/MediaStorage/Helper/File/Storage/Database.php index 5d22b3aa1e681..02da14b9038bf 100644 --- a/app/code/Magento/MediaStorage/Helper/File/Storage/Database.php +++ b/app/code/Magento/MediaStorage/Helper/File/Storage/Database.php @@ -77,7 +77,6 @@ public function __construct( /** * Check if we use DB storage - * Note: Disabled as not completed feature * * @return bool */ From 0d01e4ca2e4b0f119d22c8a6df394427f6aa5a46 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 8 Feb 2017 15:22:32 -0600 Subject: [PATCH 28/28] MAGETWO-64327: [GitHub] [PR] Remove Zend1 db from captcha module magento/magento2#8402 - updated composer.lock file --- composer.lock | 161 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 140 insertions(+), 21 deletions(-) diff --git a/composer.lock b/composer.lock index 43aed0d655764..0e37e08a9cbd9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "809100182d4f43100e8a3b5a9cec99ad", - "content-hash": "dec954aef52a7ea9cdf64328f2cb8388", + "hash": "19f69b22940e467182c3276cb21d25c2", + "content-hash": "63dfc7237cae2286c4d8f36d66ddde03", "packages": [ { "name": "braintree/braintree_php", @@ -518,22 +518,22 @@ }, { "name": "magento/composer", - "version": "1.0.3", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/magento/composer.git", - "reference": "b53f7c8a037860b467083e94de7c17cfd323e365" + "reference": "13eee8c93b27d4cea5562d449be4a4cc7a0867d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/composer/zipball/b53f7c8a037860b467083e94de7c17cfd323e365", - "reference": "b53f7c8a037860b467083e94de7c17cfd323e365", + "url": "https://api.github.com/repos/magento/composer/zipball/13eee8c93b27d4cea5562d449be4a4cc7a0867d2", + "reference": "13eee8c93b27d4cea5562d449be4a4cc7a0867d2", "shasum": "" }, "require": { "composer/composer": "1.0.0-beta1", "php": "~5.5.0|~5.6.0|~7.0.0", - "symfony/console": "~2.3 <2.7" + "symfony/console": "~2.3, !=2.7.0" }, "require-dev": { "phpunit/phpunit": "4.1.0" @@ -550,7 +550,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2016-03-08 20:50:51" + "time": "2017-02-07 21:59:01" }, { "name": "magento/magento-composer-installer", @@ -1334,27 +1334,27 @@ }, { "name": "symfony/console", - "version": "v2.6.13", - "target-dir": "Symfony/Component/Console", + "version": "v2.8.17", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" + "reference": "f3c234cd8db9f7e520a91d695db7d8bb5daeb7a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", - "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", + "url": "https://api.github.com/repos/symfony/console/zipball/f3c234cd8db9f7e520a91d695db7d8bb5daeb7a4", + "reference": "f3c234cd8db9f7e520a91d695db7d8bb5daeb7a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/debug": "~2.7,>=2.7.2|~3.0.0", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.1" + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1364,13 +1364,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Console\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1388,7 +1391,64 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-07-26 09:08:40" + "time": "2017-02-06 12:04:06" + }, + { + "name": "symfony/debug", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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 Debug Component", + "homepage": "https://symfony.com", + "time": "2016-07-30 07:22:48" }, { "name": "symfony/event-dispatcher", @@ -1548,6 +1608,65 @@ "homepage": "https://symfony.com", "time": "2017-01-02 20:32:22" }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14 01:06:16" + }, { "name": "symfony/process", "version": "v2.8.17",