From ee431f1f0561b0745ac98973f53f12424f960744 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov <bkorablov@magento.com> Date: Mon, 17 Oct 2016 17:26:24 +0300 Subject: [PATCH] MAGETWO-56317: [GitHub] -[2.1.0] underscore in site url breaks admin redirect - The page isn't redirecting properly #5809 --- .../Config/Model/Config/Backend/Baseurl.php | 6 ++++-- .../InstallStoreConfigurationCommandTest.php | 15 +++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Config/Model/Config/Backend/Baseurl.php b/app/code/Magento/Config/Model/Config/Backend/Baseurl.php index 8a7a75d3d8d..fd09c2b95e5 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Baseurl.php +++ b/app/code/Magento/Config/Model/Config/Backend/Baseurl.php @@ -197,7 +197,8 @@ class Baseurl extends \Magento\Framework\App\Config\Value * @return void * @throws \Magento\Framework\Exception\LocalizedException */ - private function validateUrl($value) { + private function validateUrl($value) + { if (!filter_var($value, FILTER_VALIDATE_URL)) { throw new \Magento\Framework\Exception\LocalizedException( __('Domain Name can contain only letters, digits and hyphen.') @@ -212,7 +213,8 @@ class Baseurl extends \Magento\Framework\App\Config\Value * @return void * @throws \Magento\Framework\Exception\LocalizedException */ - private function validateSchemes($value) { + private function validateSchemes($value) + { if (!in_array($value, $this->allowedSchemes)) { throw new \Magento\Framework\Exception\LocalizedException( __('You can use only following schemes: %1', implode(', ', $this->allowedSchemes)) diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallStoreConfigurationCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallStoreConfigurationCommandTest.php index 17ba8b11d55..c9de37ce9d1 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallStoreConfigurationCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallStoreConfigurationCommandTest.php @@ -11,8 +11,10 @@ use Symfony\Component\Console\Tester\CommandTester; use Magento\Setup\Model\Installer; use Magento\Framework\ObjectManagerInterface; use Magento\Setup\Model\StoreConfigurationDataMapper; -use Magento\Framework\Url\Validator; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class InstallStoreConfigurationCommandTest extends \PHPUnit_Framework_TestCase { /** @@ -102,13 +104,6 @@ class InstallStoreConfigurationCommandTest extends \PHPUnit_Framework_TestCase */ public function testExecuteInvalidData(array $option, $error) { - $url= $this->getMock(\Magento\Framework\Url\Validator::class, [], [], '', false); - $url->expects($this->any())->method('isValid')->will($this->returnValue(false)); - if (!isset($option['--' . StoreConfigurationDataMapper::KEY_BASE_URL_SECURE])) { - $url->expects($this->any())->method('getMessages')->will($this->returnValue([ - Validator::INVALID_URL => 'Invalid URL.' - ])); - } $localeLists= $this->getMock(\Magento\Framework\Validator\Locale::class, [], [], '', false); $localeLists->expects($this->any())->method('isValid')->will($this->returnValue(false)); $timezoneLists= $this->getMock(\Magento\Framework\Validator\Timezone::class, [], [], '', false); @@ -117,10 +112,6 @@ class InstallStoreConfigurationCommandTest extends \PHPUnit_Framework_TestCase $currencyLists->expects($this->any())->method('isValid')->will($this->returnValue(false)); $returnValueMapOM = [ - [ - \Magento\Framework\Url\Validator::class, - $url - ], [ \Magento\Framework\Validator\Locale::class, $localeLists -- GitLab