From 21038b59a7f3e24c14983210948f9ccf846cdd7e Mon Sep 17 00:00:00 2001 From: Matthias Kleine Date: Tue, 4 Apr 2017 16:14:02 +0200 Subject: [PATCH 1/2] Use result type Layout instead of page to avoid unnecessary removal of default layout handle and to fit type hint --- .../Controller/Adminhtml/Product/Wizard.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Wizard.php b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Wizard.php index 77c882e6e776c..a065914ae01be 100644 --- a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Wizard.php +++ b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Wizard.php @@ -38,9 +38,7 @@ public function execute() $this->productBuilder->build($this->getRequest()); /** @var \Magento\Framework\View\Result\Layout $resultLayout */ - $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_PAGE); - $resultLayout->getLayout()->getUpdate()->removeHandle('default'); - + $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); return $resultLayout; } } From 1fe6b0bec3fdb288f214dcf9c95afe244f32b3d7 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 21 Apr 2017 14:05:52 +0300 Subject: [PATCH 2/2] MAGETWO-67634: Product Wizard: Use result type Layout instead of page layout #9129 - Unit test added --- .../Adminhtml/Product/WizardTest.php | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/WizardTest.php diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/WizardTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/WizardTest.php new file mode 100644 index 0000000000000..ea3f87d5ea4db --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/WizardTest.php @@ -0,0 +1,70 @@ +resultFactory = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class) + ->disableOriginalConstructor() + ->getMock(); + $this->productBuilder = $this->getMockBuilder(\Magento\Catalog\Controller\Adminhtml\Product\Builder::class) + ->disableOriginalConstructor() + ->setMethods(['build']) + ->getMock(); + $this->request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $context = $this->getMockBuilder(\Magento\Backend\App\Action\Context::class) + ->disableOriginalConstructor() + ->getMock(); + + $context->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactory); + $context->expects($this->any())->method('getRequest')->willReturn($this->request); + + $objectManagerHelper = new ObjectManagerHelper($this); + $this->model = $objectManagerHelper->getObject( + \Magento\ConfigurableProduct\Controller\Adminhtml\Product\Wizard::class, + [ + 'context' => $context, + 'productBuilder' => $this->productBuilder + ] + ); + } + + public function testExecute() + { + $this->productBuilder->expects($this->once())->method('build')->with($this->request); + $this->resultFactory->expects($this->once())->method('create')->with(ResultFactory::TYPE_LAYOUT); + + $this->model->execute(); + } +}