Skip to content

Commit a205aa4

Browse files
author
Leonid Poluyanov
committed
Merge remote-tracking branch 'm2mainline/develop' into MAGETWO-39764
2 parents 70e0e26 + 5360185 commit a205aa4

File tree

306 files changed

+8918
-2994
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+8918
-2994
lines changed

app/code/Magento/Backend/Model/Search/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function load()
9696
->setValue($this->getQuery() . '%')
9797
->create();
9898
}
99-
$this->searchCriteriaBuilder->addFilter($filters);
99+
$this->searchCriteriaBuilder->addFilters($filters);
100100
$searchCriteria = $this->searchCriteriaBuilder->create();
101101
$searchResults = $this->customerRepository->getList($searchCriteria);
102102

app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ class Form extends \Magento\Catalog\Controller\Adminhtml\Product
1919
/**
2020
* @param Action\Context $context
2121
* @param Product\Builder $productBuilder
22-
* @param Product\Initialization\Helper $iniitializationHelper
22+
* @param Product\Initialization\Helper $initializationHelper
2323
*/
2424
public function __construct(
2525
\Magento\Backend\App\Action\Context $context,
2626
Product\Builder $productBuilder,
27-
Product\Initialization\Helper $iniitializationHelper
27+
Product\Initialization\Helper $initializationHelper
2828
) {
29-
$this->initializationHelper = $iniitializationHelper;
29+
$this->initializationHelper = $initializationHelper;
3030
parent::__construct($context, $productBuilder);
3131
}
3232

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Unit\Controller\Adminhtml\Bundle\Product\Edit;
8+
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
10+
11+
class FormTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/** @var \Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit\Form */
14+
protected $controller;
15+
16+
/** @var ObjectManagerHelper */
17+
protected $objectManagerHelper;
18+
19+
/**
20+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface
21+
*/
22+
protected $request;
23+
24+
/**
25+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface
26+
*/
27+
protected $response;
28+
29+
/**
30+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Controller\Adminhtml\Product\Builder
31+
*/
32+
protected $productBuilder;
33+
34+
/**
35+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper
36+
*/
37+
protected $initializationHelper;
38+
39+
/**
40+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ViewInterface
41+
*/
42+
protected $view;
43+
44+
/**
45+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\App\Action\Context
46+
*/
47+
protected $context;
48+
49+
protected function setUp()
50+
{
51+
$this->objectManagerHelper = new ObjectManagerHelper($this);
52+
53+
$this->context = $this->getMockBuilder('\Magento\Backend\App\Action\Context')
54+
->disableOriginalConstructor()
55+
->getMock();
56+
$this->request = $this->getMock('Magento\Framework\App\RequestInterface');
57+
$this->response = $this->getMock(
58+
'\Magento\Framework\App\ResponseInterface',
59+
[
60+
'sendResponse',
61+
'setBody'
62+
]
63+
);
64+
$this->productBuilder = $this->getMockBuilder('\Magento\Catalog\Controller\Adminhtml\Product\Builder')
65+
->disableOriginalConstructor()
66+
->setMethods(['build'])
67+
->getMock();
68+
$this->initializationHelper = $this->getMockBuilder(
69+
'\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper'
70+
)
71+
->disableOriginalConstructor()
72+
->setMethods(['initialize'])
73+
->getMock();
74+
$this->view = $this->getMock('\Magento\Framework\App\ViewInterface');
75+
76+
$this->context->expects($this->any())
77+
->method('getRequest')
78+
->will($this->returnValue($this->request));
79+
$this->context->expects($this->any())
80+
->method('getResponse')
81+
->will($this->returnValue($this->response));
82+
$this->context->expects($this->any())
83+
->method('getView')
84+
->will($this->returnValue($this->view));
85+
86+
$this->controller = $this->objectManagerHelper->getObject(
87+
'\Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit\Form',
88+
[
89+
'context' => $this->context,
90+
'productBuilder' => $this->productBuilder,
91+
'initializationHelper' => $this->initializationHelper
92+
]
93+
);
94+
}
95+
96+
public function testExecute()
97+
{
98+
$product = $this->getMockBuilder('\Magento\Catalog\Model\Product')
99+
->disableOriginalConstructor()
100+
->setMethods(['_wakeup', 'getId'])
101+
->getMock();
102+
$layout = $this->getMock('\Magento\Framework\View\LayoutInterface');
103+
$block = $this->getMockBuilder('Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle')
104+
->disableOriginalConstructor()
105+
->setMethods(['setIndex', 'toHtml'])
106+
->getMock();
107+
108+
$this->productBuilder->expects($this->once())->method('build')->with($this->request)->willReturn($product);
109+
$this->initializationHelper->expects($this->any())->method('initialize')->willReturn($product);
110+
$this->response->expects($this->once())->method('setBody')->willReturnSelf();
111+
$this->view->expects($this->once())->method('getLayout')->willReturn($layout);
112+
$layout->expects($this->once())->method('createBlock')->willReturn($block);
113+
$block->expects($this->once())->method('toHtml')->willReturnSelf();
114+
115+
$this->controller->execute();
116+
}
117+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Unit\Controller\Adminhtml\Bundle\Selection;
8+
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
10+
11+
class GridTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/** @var \Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Grid */
14+
protected $controller;
15+
16+
/** @var ObjectManagerHelper */
17+
protected $objectManagerHelper;
18+
19+
/**
20+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface
21+
*/
22+
protected $request;
23+
24+
/**
25+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface
26+
*/
27+
protected $response;
28+
29+
/**
30+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ViewInterface
31+
*/
32+
protected $view;
33+
34+
/**
35+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\App\Action\Context
36+
*/
37+
protected $context;
38+
39+
protected function setUp()
40+
{
41+
$this->objectManagerHelper = new ObjectManagerHelper($this);
42+
43+
$this->context = $this->getMockBuilder('\Magento\Backend\App\Action\Context')
44+
->disableOriginalConstructor()
45+
->getMock();
46+
$this->request = $this->getMock('Magento\Framework\App\RequestInterface');
47+
$this->response = $this->getMock(
48+
'\Magento\Framework\App\ResponseInterface',
49+
[
50+
'sendResponse',
51+
'setBody'
52+
]
53+
);
54+
$this->view = $this->getMock('\Magento\Framework\App\ViewInterface');
55+
56+
$this->context->expects($this->any())
57+
->method('getRequest')
58+
->will($this->returnValue($this->request));
59+
$this->context->expects($this->any())
60+
->method('getResponse')
61+
->will($this->returnValue($this->response));
62+
$this->context->expects($this->any())
63+
->method('getView')
64+
->will($this->returnValue($this->view));
65+
66+
$this->controller = $this->objectManagerHelper->getObject(
67+
'\Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Grid',
68+
[
69+
'context' => $this->context
70+
]
71+
);
72+
}
73+
74+
public function testExecute()
75+
{
76+
$layout = $this->getMock('\Magento\Framework\View\LayoutInterface');
77+
$block = $this->getMockBuilder(
78+
'Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Search\Grid'
79+
)
80+
->disableOriginalConstructor()
81+
->setMethods(['setIndex', 'toHtml'])
82+
->getMock();
83+
84+
$this->response->expects($this->once())->method('setBody')->willReturnSelf();
85+
$this->request->expects($this->once())->method('getParam')->with('index')->willReturn('index');
86+
$this->view->expects($this->once())->method('getLayout')->willReturn($layout);
87+
$layout->expects($this->once())->method('createBlock')->willReturn($block);
88+
$block->expects($this->once())->method('setIndex')->willReturnSelf();
89+
$block->expects($this->once())->method('toHtml')->willReturnSelf();
90+
91+
$this->assertEquals($this->response, $this->controller->execute());
92+
}
93+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Unit\Controller\Adminhtml\Bundle\Selection;
8+
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
10+
11+
class SearchTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/** @var \Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Search */
14+
protected $controller;
15+
16+
/** @var ObjectManagerHelper */
17+
protected $objectManagerHelper;
18+
19+
/**
20+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface
21+
*/
22+
protected $request;
23+
24+
/**
25+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface
26+
*/
27+
protected $response;
28+
29+
/**
30+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ViewInterface
31+
*/
32+
protected $view;
33+
34+
/**
35+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\App\Action\Context
36+
*/
37+
protected $context;
38+
39+
protected function setUp()
40+
{
41+
$this->objectManagerHelper = new ObjectManagerHelper($this);
42+
43+
$this->context = $this->getMockBuilder('\Magento\Backend\App\Action\Context')
44+
->disableOriginalConstructor()
45+
->getMock();
46+
$this->request = $this->getMock('Magento\Framework\App\RequestInterface');
47+
$this->response = $this->getMock(
48+
'\Magento\Framework\App\ResponseInterface',
49+
[
50+
'sendResponse',
51+
'setBody'
52+
]
53+
);
54+
$this->view = $this->getMock('\Magento\Framework\App\ViewInterface');
55+
56+
$this->context->expects($this->any())
57+
->method('getRequest')
58+
->will($this->returnValue($this->request));
59+
$this->context->expects($this->any())
60+
->method('getResponse')
61+
->will($this->returnValue($this->response));
62+
$this->context->expects($this->any())
63+
->method('getView')
64+
->will($this->returnValue($this->view));
65+
66+
$this->controller = $this->objectManagerHelper->getObject(
67+
'\Magento\Bundle\Controller\Adminhtml\Bundle\Selection\Search',
68+
[
69+
'context' => $this->context
70+
]
71+
);
72+
}
73+
74+
public function testExecute()
75+
{
76+
$layout = $this->getMock('\Magento\Framework\View\LayoutInterface');
77+
$block = $this->getMockBuilder('Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Search')
78+
->disableOriginalConstructor()
79+
->setMethods(['setIndex', 'setFirstShow', 'toHtml'])
80+
->getMock();
81+
82+
$this->response->expects($this->once())->method('setBody')->willReturnSelf();
83+
$this->request->expects($this->once())->method('getParam')->with('index')->willReturn('index');
84+
$this->view->expects($this->once())->method('getLayout')->willReturn($layout);
85+
$layout->expects($this->once())->method('createBlock')->willReturn($block);
86+
$block->expects($this->once())->method('setIndex')->willReturnSelf();
87+
$block->expects($this->once())->method('setFirstShow')->with(true)->willReturnSelf();
88+
$block->expects($this->once())->method('toHtml')->willReturnSelf();
89+
90+
$this->assertEquals($this->response, $this->controller->execute());
91+
}
92+
}

0 commit comments

Comments
 (0)