From 521ad96d08310f200a24d105be4e3e1f4fc6b0f7 Mon Sep 17 00:00:00 2001 From: Angelo Maragna Date: Mon, 16 Jan 2017 16:55:03 +0000 Subject: [PATCH 01/19] Correct php doc --- lib/internal/Magento/Framework/View/Element/Template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Element/Template.php b/lib/internal/Magento/Framework/View/Element/Template.php index 76fb380e67be4..d06f62c696f7e 100644 --- a/lib/internal/Magento/Framework/View/Element/Template.php +++ b/lib/internal/Magento/Framework/View/Element/Template.php @@ -194,7 +194,7 @@ public function setTemplate($template) * Get absolute path to template * * @param string|null $template - * @return string + * @return string|bool */ public function getTemplateFile($template = null) { From 0f53f67dd188263e79acdd6285852c6777a513b3 Mon Sep 17 00:00:00 2001 From: Eino Keskitalo Date: Tue, 17 Jan 2017 11:03:00 +0200 Subject: [PATCH 02/19] After closing the autocomplete dropdown by clicking away from it, return focus to the search input element. Otherwise the searchbox that was opened will not close when clicking away from it. You need to return the focus to it by clicking it again, and only then you can close it by clicking away from it. Steps to reproduce: Search something that gets some search result so that the autocomplete gets populated. Start searching for it again so that the dropdown opens. Click away (dropdown should close). Click away again (the search bar will not close, against user expectation). --- app/code/Magento/Search/view/frontend/web/form-mini.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Search/view/frontend/web/form-mini.js b/app/code/Magento/Search/view/frontend/web/form-mini.js index 81dd09dc6fc95..1f21c6946d98c 100644 --- a/app/code/Magento/Search/view/frontend/web/form-mini.js +++ b/app/code/Magento/Search/view/frontend/web/form-mini.js @@ -86,6 +86,8 @@ define([ setTimeout($.proxy(function () { if (this.autoComplete.is(':hidden')) { this.setActiveState(false); + } else { + this.element.trigger('focus'); } this.autoComplete.hide(); this._updateAriaHasPopup(false); From ced639a616629ffdc682087d7128684f676dacad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=BCnch?= Date: Fri, 27 Jan 2017 16:09:19 +0100 Subject: [PATCH 03/19] Allow digits in communication class type definition Our company vendor prefix "N98" is not allowed. The XSD prohibits the usage of digits. --- .../Magento/Framework/Communication/etc/communication.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Communication/etc/communication.xsd b/lib/internal/Magento/Framework/Communication/etc/communication.xsd index d0534b1a5db01..b2c0777a7a02f 100644 --- a/lib/internal/Magento/Framework/Communication/etc/communication.xsd +++ b/lib/internal/Magento/Framework/Communication/etc/communication.xsd @@ -65,7 +65,7 @@ - + From d695b9243bc058a09b832a2c321fc28a5ea4317e Mon Sep 17 00:00:00 2001 From: bery Date: Mon, 30 Jan 2017 09:47:30 +0100 Subject: [PATCH 04/19] Update AbstractTemplate.php Parameters are passed in an incorrect order --- app/code/Magento/Email/Model/AbstractTemplate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index 96daa5b33d559..66309e6aa03c9 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -352,7 +352,7 @@ public function getProcessedTemplate(array $variables = []) $result = $processor->filter($this->getTemplateText()); } catch (\Exception $e) { $this->cancelDesignConfig(); - throw new \LogicException(__($e->getMessage()), $e); + throw new \LogicException(__($e->getMessage()), $e->getCode(), $e); } if ($isDesignApplied) { $this->cancelDesignConfig(); From 71801e2e8b960bc12d5963480122cef9306a181b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Krej=C4=8D=C3=AD?= Date: Mon, 30 Jan 2017 17:14:58 +0100 Subject: [PATCH 05/19] Fixing bad date format on sales_order grid --- .../Sales/view/adminhtml/ui_component/sales_order_grid.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml index e0a5471b1e45e..10ca4cd574ca2 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml @@ -186,7 +186,7 @@ Magento_Ui/js/grid/columns/date date Purchase Date - MMM dd, YYYY, H:MM:SS A + MMM dd, YYYY, H:mm:ss A From fb31c4c94ec4a5c5bcef9b1c40937a61208aedec Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Mon, 30 Jan 2017 22:13:02 -0800 Subject: [PATCH 06/19] Update 'Continue Shopping' url. --- app/code/Magento/Checkout/view/frontend/templates/success.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/templates/success.phtml b/app/code/Magento/Checkout/view/frontend/templates/success.phtml index 5ef7e992c4e9c..659637fc60e2d 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/success.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/success.phtml @@ -22,7 +22,7 @@
- +
From 52e8f28026f82a1560d1cb1de6a9d4618965fafd Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Mon, 30 Jan 2017 22:15:58 -0800 Subject: [PATCH 07/19] Add getContinueUrl function --- app/code/Magento/Checkout/Block/Onepage/Success.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/code/Magento/Checkout/Block/Onepage/Success.php b/app/code/Magento/Checkout/Block/Onepage/Success.php index 210a1285b29fd..b017f474b562b 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Success.php +++ b/app/code/Magento/Checkout/Block/Onepage/Success.php @@ -122,4 +122,12 @@ protected function canViewOrder(Order $order) return $this->httpContext->getValue(Context::CONTEXT_AUTH) && $this->isVisible($order); } + + /** + * @return string + */ + public function getContinueUrl() + { + return $this->_storeManager->getStore()->getBaseUrl(); + } } From 7f86bc0c798ec2cec5405c56108a150a73237dcd Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Mon, 30 Jan 2017 22:23:12 -0800 Subject: [PATCH 08/19] Update SuccessTest.php --- .../Test/Unit/Block/Onepage/SuccessTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php index 09c3bff0d7dde..664d62310379b 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php @@ -27,12 +27,18 @@ class SuccessTest extends \PHPUnit_Framework_TestCase * @var \Magento\Checkout\Model\Session | \PHPUnit_Framework_MockObject_MockObject */ protected $checkoutSession; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->orderConfig = $this->getMock(\Magento\Sales\Model\Order\Config::class, [], [], '', false); + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface', [], [], '', false); $this->checkoutSession = $this->getMockBuilder( \Magento\Checkout\Model\Session::class @@ -110,4 +116,13 @@ public function invisibleStatusesProvider() [['status1', 'status2'], true] ]; } + + public function testGetContinueUrl() + { + $storeMock = $this->getMock('Magento\Store\Model\Store', [], [], '', false); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); + $storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('Expected Result')); + + $this->assertEquals('Expected Result', $this->block->getContinueUrl()); + } } From c6a9291e77bf2150d917afc93e40380522493515 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 31 Jan 2017 00:17:56 -0800 Subject: [PATCH 09/19] Update failing tests. --- .../Test/Unit/Block/Onepage/SuccessTest.php | 50 ++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php index 664d62310379b..1cdd466b8764c 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php @@ -18,6 +18,11 @@ class SuccessTest extends \PHPUnit_Framework_TestCase */ protected $block; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $layout; + /** * @var \Magento\Sales\Model\Order\Config | \PHPUnit_Framework_MockObject_MockObject */ @@ -27,7 +32,7 @@ class SuccessTest extends \PHPUnit_Framework_TestCase * @var \Magento\Checkout\Model\Session | \PHPUnit_Framework_MockObject_MockObject */ protected $checkoutSession; - + /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -38,17 +43,50 @@ protected function setUp() $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->orderConfig = $this->getMock(\Magento\Sales\Model\Order\Config::class, [], [], '', false); - $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface', [], [], '', false); + $this->storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class, [], [], '', false); + + $this->layout = $this->getMockBuilder(\Magento\Framework\View\LayoutInterface::class) + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + + $this->checkoutSession = $this->getMockBuilder(\Magento\Checkout\Model\Session::class) + ->disableOriginalConstructor() + ->getMock(); - $this->checkoutSession = $this->getMockBuilder( - \Magento\Checkout\Model\Session::class - ) + $eventManager = $this->getMockBuilder(\Magento\Framework\Event\ManagerInterface::class) ->disableOriginalConstructor() + ->setMethods([]) ->getMock(); + $urlBuilder = $this->getMockBuilder(\Magento\Framework\UrlInterface::class) + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + + $scopeConfig = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + $scopeConfig->expects($this->any()) + ->method('getValue') + ->with($this->stringContains('advanced/modules_disable_output/'), \Magento\Store\Model\ScopeInterface::SCOPE_STORE) + ->will($this->returnValue(false)); + + $context = $this->getMockBuilder(\Magento\Framework\View\Element\Template\Context::class) + ->disableOriginalConstructor() + ->setMethods(['getLayout', 'getEventManager', 'getUrlBuilder', 'getScopeConfig', 'getStoreManager']) + ->getMock(); + $context->expects($this->any())->method('getLayout')->will($this->returnValue($this->layout)); + $context->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManager)); + $context->expects($this->any())->method('getUrlBuilder')->will($this->returnValue($urlBuilder)); + $context->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfig)); + $context->expects($this->any())->method('getStoreManager')->will($this->returnValue($this->storeManagerMock)); + $this->block = $objectManager->getObject( \Magento\Checkout\Block\Onepage\Success::class, [ + 'context' => $context, 'orderConfig' => $this->orderConfig, 'checkoutSession' => $this->checkoutSession ] @@ -116,7 +154,7 @@ public function invisibleStatusesProvider() [['status1', 'status2'], true] ]; } - + public function testGetContinueUrl() { $storeMock = $this->getMock('Magento\Store\Model\Store', [], [], '', false); From 068bcde912b00edb0e932568d1350f932ee3cd69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Raye=CC=81?= Date: Tue, 31 Jan 2017 15:32:15 +0100 Subject: [PATCH 10/19] Display correctly "Add" button label for the block class \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray --- .../Config/Form/Field/FieldArray/AbstractFieldArray.php | 8 ++++++++ .../templates/system/config/form/field/array.phtml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php b/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php index f52e28dea0056..bad3181437124 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php @@ -279,4 +279,12 @@ public function getColumns() { return $this->_columns; } + + /** + * @return string + */ + public function getAddButtonLabel() + { + return $this->_addButtonLabel; + } } diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml index 8a40bac76338a..ca09db9e83f6a 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml @@ -28,7 +28,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; From fab492166512eb2c84a18a1eb67636c4bfda702e Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 31 Jan 2017 08:25:03 -0800 Subject: [PATCH 11/19] Fix Code Sniffer errors. Fix line exceeded max length issue. Use ::class syntax. --- .../Checkout/Test/Unit/Block/Onepage/SuccessTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php index 1cdd466b8764c..d64a883426d9f 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php @@ -70,7 +70,11 @@ protected function setUp() ->getMock(); $scopeConfig->expects($this->any()) ->method('getValue') - ->with($this->stringContains('advanced/modules_disable_output/'), \Magento\Store\Model\ScopeInterface::SCOPE_STORE) + ->with( + $this->stringContains( + 'advanced/modules_disable_output/'), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ->will($this->returnValue(false)); $context = $this->getMockBuilder(\Magento\Framework\View\Element\Template\Context::class) @@ -157,7 +161,7 @@ public function invisibleStatusesProvider() public function testGetContinueUrl() { - $storeMock = $this->getMock('Magento\Store\Model\Store', [], [], '', false); + $storeMock = $this->getMock(\Magento\Store\Model\Store::class, [], [], '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('Expected Result')); From d8eaa8f9ee236c7b8516927a683e180c0fe011f9 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 31 Jan 2017 10:15:39 -0800 Subject: [PATCH 12/19] Remove whitespace. Move parenthesis to new line --- .../Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php index d64a883426d9f..18f3c262c5c2a 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php @@ -72,8 +72,9 @@ protected function setUp() ->method('getValue') ->with( $this->stringContains( - 'advanced/modules_disable_output/'), - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + 'advanced/modules_disable_output/' + ), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ->will($this->returnValue(false)); From 6c0e8964602028ff30a756d126f4425a6a133d9f Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 31 Jan 2017 10:37:20 -0800 Subject: [PATCH 13/19] Suppress CouplingBetweenObjects warning for test class --- .../Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php index 18f3c262c5c2a..e22fe32dbbf7c 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php @@ -10,6 +10,7 @@ /** * Class SuccessTest * @package Magento\Checkout\Block\Onepage + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SuccessTest extends \PHPUnit_Framework_TestCase { From 8d007b15fcf68f93e831bd8f3c9ac8a292a6e99d Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 31 Jan 2017 13:27:20 -0800 Subject: [PATCH 14/19] Remove whitespace at end of line. --- app/code/Magento/Checkout/Block/Onepage/Success.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Block/Onepage/Success.php b/app/code/Magento/Checkout/Block/Onepage/Success.php index b017f474b562b..bfff407a902a2 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Success.php +++ b/app/code/Magento/Checkout/Block/Onepage/Success.php @@ -122,7 +122,7 @@ protected function canViewOrder(Order $order) return $this->httpContext->getValue(Context::CONTEXT_AUTH) && $this->isVisible($order); } - + /** * @return string */ From c289d0c29c3a68e15c6753b95226728202ee2a89 Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Wed, 1 Feb 2017 17:06:50 -0600 Subject: [PATCH 15/19] MAGETWO-63881: Accept public PRs #8327, #8336, #8307 - covered additional numeric cases with the communication.xsd schema changes - added integration tests --- .../Framework/Communication/ConfigTest.php | 34 +++++++++++++++++++ .../_files/invalid_communication_numeric.xml | 12 +++++++ .../_files/valid_communication_numeric.xml | 12 +++++++ .../Communication/Config/ConfigParser.php | 2 +- .../Config/Reader/XmlReader/Converter.php | 2 +- .../Communication/etc/communication.xsd | 4 +-- 6 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Communication/_files/invalid_communication_numeric.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Communication/_files/valid_communication_numeric.xml diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php index fa0cd6dd1c239..d4e576d9449d7 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php @@ -22,6 +22,40 @@ public function testGetTopics() $this->assertEquals($expectedParsedTopics, $topics); } + /** + * Get topic configuration by its name + * + * @expectedException \LogicException + * @expectedExceptionMessage Service method specified in the definition of topic "customerDeletedNumbers" is not available. Given "V55\Customer\Api\CustomerRepositoryInterface::delete99" + */ + public function testGetTopicsNumeric() + { + $this->getConfigInstance(__DIR__ . '/_files/valid_communication_numeric.xml')->getTopics(); + } + + /** + * Get topic configuration by its name + * + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage Invalid XML in file 0: + Element 'topic', attribute 'schema': [facet 'pattern'] The value '55\Customer\Api\CustomerRepositoryInterface::delete' is not accepted by the pattern '[a-zA-Z]+[a-zA-Z0-9\\]+::[a-zA-Z0-9]+'. + Line: 9 + + Element 'topic', attribute 'schema': '55\Customer\Api\CustomerRepositoryInterface::delete' is not a valid value of the atomic type 'schemaType'. + Line: 9 + + Element 'handler', attribute 'type': [facet 'pattern'] The value '55\Customer\Api\CustomerRepositoryInterface' is not accepted by the pattern '[a-zA-Z]+[a-zA-Z0-9\\]+'. + Line: 10 + + Element 'handler', attribute 'type': '55\Customer\Api\CustomerRepositoryInterface' is not a valid value of the atomic type 'serviceTypeType'. + Line: 10 + * + */ + public function testGetTopicsNumericInvalid() + { + $this->getConfigInstance(__DIR__ . '/_files/invalid_communication_numeric.xml')->getTopics(); + } + /** * Get topic configuration by its name */ diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/invalid_communication_numeric.xml b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/invalid_communication_numeric.xml new file mode 100644 index 0000000000000..a18b5e6254e52 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/invalid_communication_numeric.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/valid_communication_numeric.xml b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/valid_communication_numeric.xml new file mode 100644 index 0000000000000..97c92163be91f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/valid_communication_numeric.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php b/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php index 39d1635124ea7..b8beef99ccf41 100644 --- a/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php +++ b/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php @@ -25,7 +25,7 @@ class ConfigParser */ public function parseServiceMethod($serviceMethod) { - $pattern = '/^([a-zA-Z\\\\]+)::([a-zA-Z]+)$/'; + $pattern = '/^([a-zA-Z]+[a-zA-Z0-9\\\\]+)::([a-zA-Z0-9]+)$/'; preg_match($pattern, $serviceMethod, $matches); if (!isset($matches[1]) || !isset($matches[2])) { throw new LocalizedException( diff --git a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php index 49b5e4dfd556f..4acc295ea2000 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php +++ b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php @@ -19,7 +19,7 @@ class Converter implements \Magento\Framework\Config\ConverterInterface { /** * @deprecated - * @see ConfigParser::SERVICE_METHOD_NAME_PATTERN + * @see ConfigParser::parseServiceMethod */ const SERVICE_METHOD_NAME_PATTERN = '/^([a-zA-Z\\\\]+)::([a-zA-Z]+)$/'; diff --git a/lib/internal/Magento/Framework/Communication/etc/communication.xsd b/lib/internal/Magento/Framework/Communication/etc/communication.xsd index b2c0777a7a02f..1b91ada103b88 100644 --- a/lib/internal/Magento/Framework/Communication/etc/communication.xsd +++ b/lib/internal/Magento/Framework/Communication/etc/communication.xsd @@ -54,7 +54,7 @@ - + @@ -76,7 +76,7 @@ - + From 08aed7d3bd5aa26335f9e18c6573d7e7a572c107 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 2 Feb 2017 15:55:16 +0200 Subject: [PATCH 16/19] MAGETWO-64081: [GitHub] [PR] Improve Developer Experience for Config Form Field #8354 - Unit Test Added --- .../Form/Field/FieldArray/AbstractTest.php | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php index c529d720714e7..ff62525241806 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php @@ -7,10 +7,14 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { - public function testGetArrayRows() + /** + * @var \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray + */ + private $model; + + protected function setUp() { - /** @var $block \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray */ - $block = $this->getMockForAbstractClass( + $this->model = $this->getMockForAbstractClass( \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray::class, [], '', @@ -19,12 +23,15 @@ public function testGetArrayRows() true, ['escapeHtml'] ); - $block->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0)); + } + public function testGetArrayRows() + { + $this->model->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0)); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $element = $objectManager->getObject(\Magento\Framework\Data\Form\Element\Multiselect::class); $element->setValue([['tet' => 'tst', 'data&1' => 'da&ta1']]); - $block->setElement($element); + $this->model->setElement($element); $this->assertEquals( [ new \Magento\Framework\DataObject( @@ -36,7 +43,17 @@ public function testGetArrayRows() ] ), ], - $block->getArrayRows() + $this->model->getArrayRows() ); } + + public function testGetAddButtonLabel() + { + $contextMock = $this->getMockBuilder(\Magento\Backend\Block\Template\Context::class) + ->disableOriginalConstructor() + ->getMock(); + $this->model->__construct($contextMock); + + $this->assertEquals("Add", $this->model->getAddButtonLabel()); + } } From e55eeedc96c2880a7a5665a014503a13a9632261 Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Thu, 2 Feb 2017 10:45:26 -0600 Subject: [PATCH 17/19] MAGETWO-63881: Accept public PRs #8327, #8336, #8307 - add unit test for AbstractTemplate Exception --- .../Test/Unit/Model/AbstractTemplateTest.php | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php index 248a630023514..1323b46437fe6 100644 --- a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php @@ -241,6 +241,67 @@ public function testGetProcessedTemplate($variables, $templateType, $storeId, $e $this->assertEquals($expectedResult, $model->getProcessedTemplate($variables)); } + /** + * @expectedException \LogicException + */ + public function testGetProcessedTemplateException() { + $filterTemplate = $this->getMockBuilder(\Magento\Email\Model\Template\Filter::class) + ->setMethods([ + 'setUseSessionInUrl', + 'setPlainTemplateMode', + 'setIsChildTemplate', + 'setDesignParams', + 'setVariables', + 'setStoreId', + 'filter', + 'getStoreId', + 'getInlineCssFiles', + ]) + ->disableOriginalConstructor() + ->getMock(); + $filterTemplate->expects($this->once()) + ->method('setUseSessionInUrl') + ->will($this->returnSelf()); + $filterTemplate->expects($this->once()) + ->method('setPlainTemplateMode') + ->will($this->returnSelf()); + $filterTemplate->expects($this->once()) + ->method('setIsChildTemplate') + ->will($this->returnSelf()); + $filterTemplate->expects($this->once()) + ->method('setDesignParams') + ->will($this->returnSelf()); + $filterTemplate->expects($this->any()) + ->method('setStoreId') + ->will($this->returnSelf()); + $filterTemplate->expects($this->any()) + ->method('getStoreId') + ->will($this->returnValue(1)); + + $model = $this->getModelMock([ + 'getDesignParams', + 'applyDesignConfig', + 'getTemplateText', + 'isPlain', + ]); + + $designParams = [ + 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, + 'theme' => 'themeId', + 'locale' => 'localeId', + ]; + $model->expects($this->any()) + ->method('getDesignParams') + ->will($this->returnValue($designParams)); + $model->setTemplateFilter($filterTemplate); + $model->setTemplateType(\Magento\Framework\App\TemplateTypesInterface::TYPE_TEXT); + + $filterTemplate->expects($this->once()) + ->method('filter') + ->will($this->throwException(new \Exception)); + $model->getProcessedTemplate([]); + } + /** * @return array */ From ce7dbb5ad7d8da1f00bde7972073029186595ef6 Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Thu, 2 Feb 2017 14:31:45 -0600 Subject: [PATCH 18/19] MAGETWO-63881: Accept public PRs #8327, #8336, #8307 - disable static test check for long line in unit tests --- .../testsuite/Magento/Framework/Communication/ConfigTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php index d4e576d9449d7..41058eeea6f3f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php @@ -33,6 +33,7 @@ public function testGetTopicsNumeric() $this->getConfigInstance(__DIR__ . '/_files/valid_communication_numeric.xml')->getTopics(); } + // @codingStandardsIgnoreStart /** * Get topic configuration by its name * @@ -51,6 +52,7 @@ public function testGetTopicsNumeric() Line: 10 * */ + // @codingStandardsIgnoreEnd public function testGetTopicsNumericInvalid() { $this->getConfigInstance(__DIR__ . '/_files/invalid_communication_numeric.xml')->getTopics(); From 4b586aaa32966e826c9fc80889bf18cd5fda9ddd Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Thu, 2 Feb 2017 14:46:37 -0600 Subject: [PATCH 19/19] MAGETWO-63881: Accept public PRs #8327, #8336, #8307 - fix static test check for long line in unit tests --- .../testsuite/Magento/Framework/Communication/ConfigTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php index 41058eeea6f3f..b48de3ef87edd 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php @@ -26,7 +26,7 @@ public function testGetTopics() * Get topic configuration by its name * * @expectedException \LogicException - * @expectedExceptionMessage Service method specified in the definition of topic "customerDeletedNumbers" is not available. Given "V55\Customer\Api\CustomerRepositoryInterface::delete99" + * @expectedExceptionMessage Service method specified in the definition of topic "customerDeletedNumbers" is not av */ public function testGetTopicsNumeric() {