-
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.
Merge remote-tracking branch 'main/develop' into MAGETWO-32996
- Loading branch information
Showing
201 changed files
with
8,700 additions
and
2,802 deletions.
There are no files selected for viewing
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
117 changes: 117 additions & 0 deletions
117
app/code/Magento/Bundle/Test/Unit/Controller/Adminhtml/Bundle/Product/Edit/FormTest.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,117 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Bundle\Test\Unit\Controller\Adminhtml\Bundle\Product\Edit; | ||
|
||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
|
||
class FormTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** @var \Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit\Form */ | ||
protected $controller; | ||
|
||
/** @var ObjectManagerHelper */ | ||
protected $objectManagerHelper; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface | ||
*/ | ||
protected $response; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Controller\Adminhtml\Product\Builder | ||
*/ | ||
protected $productBuilder; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper | ||
*/ | ||
protected $initializationHelper; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ViewInterface | ||
*/ | ||
protected $view; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\App\Action\Context | ||
*/ | ||
protected $context; | ||
|
||
protected function setUp() | ||
{ | ||
$this->objectManagerHelper = new ObjectManagerHelper($this); | ||
|
||
$this->context = $this->getMockBuilder('\Magento\Backend\App\Action\Context') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->request = $this->getMock('Magento\Framework\App\RequestInterface'); | ||
$this->response = $this->getMock( | ||
'\Magento\Framework\App\ResponseInterface', | ||
[ | ||
'sendResponse', | ||
'setBody' | ||
] | ||
); | ||
$this->productBuilder = $this->getMockBuilder('\Magento\Catalog\Controller\Adminhtml\Product\Builder') | ||
->disableOriginalConstructor() | ||
->setMethods(['build']) | ||
->getMock(); | ||
$this->initializationHelper = $this->getMockBuilder( | ||
'\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper' | ||
) | ||
->disableOriginalConstructor() | ||
->setMethods(['initialize']) | ||
->getMock(); | ||
$this->view = $this->getMock('\Magento\Framework\App\ViewInterface'); | ||
|
||
$this->context->expects($this->any()) | ||
->method('getRequest') | ||
->will($this->returnValue($this->request)); | ||
$this->context->expects($this->any()) | ||
->method('getResponse') | ||
->will($this->returnValue($this->response)); | ||
$this->context->expects($this->any()) | ||
->method('getView') | ||
->will($this->returnValue($this->view)); | ||
|
||
$this->controller = $this->objectManagerHelper->getObject( | ||
'\Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit\Form', | ||
[ | ||
'context' => $this->context, | ||
'productBuilder' => $this->productBuilder, | ||
'initializationHelper' => $this->initializationHelper | ||
] | ||
); | ||
} | ||
|
||
public function testExecute() | ||
{ | ||
$product = $this->getMockBuilder('\Magento\Catalog\Model\Product') | ||
->disableOriginalConstructor() | ||
->setMethods(['_wakeup', 'getId']) | ||
->getMock(); | ||
$layout = $this->getMock('\Magento\Framework\View\LayoutInterface'); | ||
$block = $this->getMockBuilder('Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle') | ||
->disableOriginalConstructor() | ||
->setMethods(['setIndex', 'toHtml']) | ||
->getMock(); | ||
|
||
$this->productBuilder->expects($this->once())->method('build')->with($this->request)->willReturn($product); | ||
$this->initializationHelper->expects($this->any())->method('initialize')->willReturn($product); | ||
$this->response->expects($this->once())->method('setBody')->willReturnSelf(); | ||
$this->view->expects($this->once())->method('getLayout')->willReturn($layout); | ||
$layout->expects($this->once())->method('createBlock')->willReturn($block); | ||
$block->expects($this->once())->method('toHtml')->willReturnSelf(); | ||
|
||
$this->controller->execute(); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
app/code/Magento/Bundle/Test/Unit/Controller/Adminhtml/Bundle/Selection/GridTest.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,93 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Bundle\Test\Unit\Controller\Adminhtml\Bundle\Selection; | ||
|
||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
|
||
class GridTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** @var \Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Grid */ | ||
protected $controller; | ||
|
||
/** @var ObjectManagerHelper */ | ||
protected $objectManagerHelper; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface | ||
*/ | ||
protected $response; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ViewInterface | ||
*/ | ||
protected $view; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\App\Action\Context | ||
*/ | ||
protected $context; | ||
|
||
protected function setUp() | ||
{ | ||
$this->objectManagerHelper = new ObjectManagerHelper($this); | ||
|
||
$this->context = $this->getMockBuilder('\Magento\Backend\App\Action\Context') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->request = $this->getMock('Magento\Framework\App\RequestInterface'); | ||
$this->response = $this->getMock( | ||
'\Magento\Framework\App\ResponseInterface', | ||
[ | ||
'sendResponse', | ||
'setBody' | ||
] | ||
); | ||
$this->view = $this->getMock('\Magento\Framework\App\ViewInterface'); | ||
|
||
$this->context->expects($this->any()) | ||
->method('getRequest') | ||
->will($this->returnValue($this->request)); | ||
$this->context->expects($this->any()) | ||
->method('getResponse') | ||
->will($this->returnValue($this->response)); | ||
$this->context->expects($this->any()) | ||
->method('getView') | ||
->will($this->returnValue($this->view)); | ||
|
||
$this->controller = $this->objectManagerHelper->getObject( | ||
'\Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Grid', | ||
[ | ||
'context' => $this->context | ||
] | ||
); | ||
} | ||
|
||
public function testExecute() | ||
{ | ||
$layout = $this->getMock('\Magento\Framework\View\LayoutInterface'); | ||
$block = $this->getMockBuilder( | ||
'Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Search\Grid' | ||
) | ||
->disableOriginalConstructor() | ||
->setMethods(['setIndex', 'toHtml']) | ||
->getMock(); | ||
|
||
$this->response->expects($this->once())->method('setBody')->willReturnSelf(); | ||
$this->request->expects($this->once())->method('getParam')->with('index')->willReturn('index'); | ||
$this->view->expects($this->once())->method('getLayout')->willReturn($layout); | ||
$layout->expects($this->once())->method('createBlock')->willReturn($block); | ||
$block->expects($this->once())->method('setIndex')->willReturnSelf(); | ||
$block->expects($this->once())->method('toHtml')->willReturnSelf(); | ||
|
||
$this->assertEquals($this->response, $this->controller->execute()); | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
app/code/Magento/Bundle/Test/Unit/Controller/Adminhtml/Bundle/Selection/SearchTest.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,92 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Bundle\Test\Unit\Controller\Adminhtml\Bundle\Selection; | ||
|
||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
|
||
class SearchTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** @var \Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Search */ | ||
protected $controller; | ||
|
||
/** @var ObjectManagerHelper */ | ||
protected $objectManagerHelper; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface | ||
*/ | ||
protected $response; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ViewInterface | ||
*/ | ||
protected $view; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\App\Action\Context | ||
*/ | ||
protected $context; | ||
|
||
protected function setUp() | ||
{ | ||
$this->objectManagerHelper = new ObjectManagerHelper($this); | ||
|
||
$this->context = $this->getMockBuilder('\Magento\Backend\App\Action\Context') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->request = $this->getMock('Magento\Framework\App\RequestInterface'); | ||
$this->response = $this->getMock( | ||
'\Magento\Framework\App\ResponseInterface', | ||
[ | ||
'sendResponse', | ||
'setBody' | ||
] | ||
); | ||
$this->view = $this->getMock('\Magento\Framework\App\ViewInterface'); | ||
|
||
$this->context->expects($this->any()) | ||
->method('getRequest') | ||
->will($this->returnValue($this->request)); | ||
$this->context->expects($this->any()) | ||
->method('getResponse') | ||
->will($this->returnValue($this->response)); | ||
$this->context->expects($this->any()) | ||
->method('getView') | ||
->will($this->returnValue($this->view)); | ||
|
||
$this->controller = $this->objectManagerHelper->getObject( | ||
'\Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Search', | ||
[ | ||
'context' => $this->context | ||
] | ||
); | ||
} | ||
|
||
public function testExecute() | ||
{ | ||
$layout = $this->getMock('\Magento\Framework\View\LayoutInterface'); | ||
$block = $this->getMockBuilder('Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Search') | ||
->disableOriginalConstructor() | ||
->setMethods(['setIndex', 'setFirstShow', 'toHtml']) | ||
->getMock(); | ||
|
||
$this->response->expects($this->once())->method('setBody')->willReturnSelf(); | ||
$this->request->expects($this->once())->method('getParam')->with('index')->willReturn('index'); | ||
$this->view->expects($this->once())->method('getLayout')->willReturn($layout); | ||
$layout->expects($this->once())->method('createBlock')->willReturn($block); | ||
$block->expects($this->once())->method('setIndex')->willReturnSelf(); | ||
$block->expects($this->once())->method('setFirstShow')->with(true)->willReturnSelf(); | ||
$block->expects($this->once())->method('toHtml')->willReturnSelf(); | ||
|
||
$this->assertEquals($this->response, $this->controller->execute()); | ||
} | ||
} |
Oops, something went wrong.