-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-67634: Product Wizard: Use result type Layout instead of page…
… layout #9129 - Unit test added
- Loading branch information
1 parent
f28d3b7
commit 1fe6b0b
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/WizardTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\ConfigurableProduct\Test\Unit\Controller\Adminhtml\Product; | ||
|
||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
|
||
class WizardTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $resultFactory; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $productBuilder; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $request; | ||
|
||
/** | ||
* @var \Magento\ConfigurableProduct\Controller\Adminhtml\Product\Wizard | ||
*/ | ||
private $model; | ||
|
||
protected function setUp() | ||
{ | ||
$this->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(); | ||
} | ||
} |