Skip to content

Commit 1154f03

Browse files
author
Alex Bomko
committed
MAGETWO-38946: Create pull request for a sprint 22 results
- fix tests
1 parent c96e190 commit 1154f03

File tree

8 files changed

+35
-42
lines changed

8 files changed

+35
-42
lines changed

app/code/Magento/Email/Model/AbstractTemplate.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
7272
* @param \Magento\Store\Model\App\Emulation $appEmulation
7373
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
7474
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
75-
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
75+
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
7676
* @param array $data
7777
*/
7878
public function __construct(
7979
\Magento\Framework\Model\Context $context,
80-
\Magento\Framework\View\DesignInterface $design,
8180
\Magento\Framework\Registry $registry,
81+
\Magento\Framework\View\DesignInterface $design,
8282
\Magento\Store\Model\App\Emulation $appEmulation,
8383
\Magento\Store\Model\StoreManagerInterface $storeManager,
84+
array $data = [],
8485
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
85-
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
86-
array $data = []
86+
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null
8787
) {
8888
$this->_design = $design;
8989
$this->_area = isset($data['area']) ? $data['area'] : null;

app/code/Magento/Email/Model/BackendTemplate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class BackendTemplate extends Template
3838
*/
3939
public function __construct(
4040
\Magento\Framework\Model\Context $context,
41-
\Magento\Framework\View\DesignInterface $design,
4241
\Magento\Framework\Registry $registry,
42+
\Magento\Framework\View\DesignInterface $design,
4343
\Magento\Store\Model\App\Emulation $appEmulation,
4444
\Magento\Store\Model\StoreManagerInterface $storeManager,
4545
\Magento\Framework\Filesystem $filesystem,
@@ -53,8 +53,8 @@ public function __construct(
5353
) {
5454
parent::__construct(
5555
$context,
56-
$design,
5756
$registry,
57+
$design,
5858
$appEmulation,
5959
$storeManager,
6060
$filesystem,

app/code/Magento/Email/Model/Template.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,24 +156,26 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento
156156

157157
/**
158158
* @param \Magento\Framework\Model\Context $context
159-
* @param \Magento\Framework\View\DesignInterface $design
160159
* @param \Magento\Framework\Registry $registry
160+
* @param \Magento\Framework\View\DesignInterface $design
161161
* @param \Magento\Store\Model\App\Emulation $appEmulation
162-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
162+
* @param StoreManagerInterface $storeManager
163163
* @param \Magento\Framework\Filesystem $filesystem
164164
* @param \Magento\Framework\View\Asset\Repository $assetRepo
165165
* @param \Magento\Framework\View\FileSystem $viewFileSystem
166166
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
167167
* @param Template\FilterFactory $emailFilterFactory
168168
* @param Template\Config $emailConfig
169169
* @param array $data
170+
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
171+
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
170172
*
171173
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
172174
*/
173175
public function __construct(
174176
\Magento\Framework\Model\Context $context,
175-
\Magento\Framework\View\DesignInterface $design,
176177
\Magento\Framework\Registry $registry,
178+
\Magento\Framework\View\DesignInterface $design,
177179
\Magento\Store\Model\App\Emulation $appEmulation,
178180
StoreManagerInterface $storeManager,
179181
\Magento\Framework\Filesystem $filesystem,
@@ -182,15 +184,26 @@ public function __construct(
182184
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
183185
\Magento\Email\Model\Template\FilterFactory $emailFilterFactory,
184186
\Magento\Email\Model\Template\Config $emailConfig,
185-
array $data = []
187+
array $data = [],
188+
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
189+
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null
186190
) {
187191
$this->_scopeConfig = $scopeConfig;
188192
$this->_filesystem = $filesystem;
189193
$this->_assetRepo = $assetRepo;
190194
$this->_viewFileSystem = $viewFileSystem;
191195
$this->_emailFilterFactory = $emailFilterFactory;
192196
$this->_emailConfig = $emailConfig;
193-
parent::__construct($context, $design, $registry, $appEmulation, $storeManager, null, null, $data);
197+
parent::__construct(
198+
$context,
199+
$registry,
200+
$design,
201+
$appEmulation,
202+
$storeManager,
203+
$data,
204+
$resource,
205+
$resourceCollection
206+
);
194207
}
195208

196209
/**

app/code/Magento/Email/Test/Unit/Model/TemplateTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ protected function getModelMock(array $mockedMethods = [])
122122
->setConstructorArgs(
123123
[
124124
$this->context,
125-
$this->design,
126125
$this->registry,
126+
$this->design,
127127
$this->appEmulation,
128128
$this->storeManager,
129129
$this->filesystem,
@@ -758,8 +758,8 @@ public function testGetType($templateType, $expectedResult)
758758
)->setConstructorArgs(
759759
[
760760
$this->getMock('Magento\Framework\Model\Context', [], [], '', false),
761-
$this->getMock('Magento\Theme\Model\View\Design', [], [], '', false),
762761
$this->getMock('Magento\Framework\Registry', [], [], '', false),
762+
$this->getMock('Magento\Theme\Model\View\Design', [], [], '', false),
763763
$this->getMock('Magento\Store\Model\App\Emulation', [], [], '', false),
764764
$this->getMock('Magento\Store\Model\StoreManager', [], [], '', false),
765765
$this->getMock('Magento\Framework\Filesystem', [], [], '', false),

app/code/Magento/Newsletter/Model/Queue.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ class Queue extends \Magento\Email\Model\AbstractTemplate
120120
* @param \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory
121121
* @param \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder
122122
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
123-
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
123+
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
124124
* @param array $data
125125
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
126126
*/
127127
public function __construct(
128128
\Magento\Framework\Model\Context $context,
129-
\Magento\Framework\View\DesignInterface $design,
130129
\Magento\Framework\Registry $registry,
130+
\Magento\Framework\View\DesignInterface $design,
131131
\Magento\Store\Model\App\Emulation $appEmulation,
132132
\Magento\Store\Model\StoreManagerInterface $storeManager,
133133
\Magento\Newsletter\Model\Template\Filter $templateFilter,
@@ -137,18 +137,18 @@ public function __construct(
137137
\Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory,
138138
\Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder,
139139
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
140-
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
140+
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
141141
array $data = []
142142
) {
143143
parent::__construct(
144144
$context,
145-
$design,
146145
$registry,
146+
$design,
147147
$appEmulation,
148148
$storeManager,
149+
$data,
149150
$resource,
150-
$resourceCollection,
151-
$data
151+
$resourceCollection
152152
);
153153
$this->_templateFilter = $templateFilter;
154154
$this->_date = $date;

app/code/Magento/Newsletter/Model/Template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ class Template extends \Magento\Email\Model\AbstractTemplate
106106
*/
107107
public function __construct(
108108
\Magento\Framework\Model\Context $context,
109-
\Magento\Framework\View\DesignInterface $design,
110109
\Magento\Framework\Registry $registry,
110+
\Magento\Framework\View\DesignInterface $design,
111111
\Magento\Store\Model\App\Emulation $appEmulation,
112112
\Magento\Store\Model\StoreManagerInterface $storeManager,
113113
\Magento\Framework\App\RequestInterface $request,
@@ -117,7 +117,7 @@ public function __construct(
117117
\Magento\Framework\Filter\FilterManager $filterManager,
118118
array $data = []
119119
) {
120-
parent::__construct($context, $design, $registry, $appEmulation, $storeManager, null, null, $data);
120+
parent::__construct($context, $registry, $design, $appEmulation, $storeManager, $data);
121121
$this->_storeManager = $storeManager;
122122
$this->_request = $request;
123123
$this->_filter = $filter;

app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public function testGetProcessedTemplate($isSingleStore)
6565
['_init'],
6666
[
6767
$context,
68-
$design,
6968
$registry,
69+
$design,
7070
$appEmulation,
7171
$storeManager,
7272
$request,

app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,6 @@ public function setUp()
3838

3939
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
4040

41-
$objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface');
42-
$objectManagerMock->expects($this->once())
43-
->method('get')
44-
->with('Magento\Email\Model\Resource\Template')
45-
->will($this->returnValue($objectManagerHelper->getObject('Magento\Email\Model\Resource\Template')));
46-
47-
try {
48-
$this->objectManagerBackup = \Magento\Framework\App\ObjectManager::getInstance();
49-
} catch (\RuntimeException $e) {
50-
$this->objectManagerBackup = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER)
51-
->create($_SERVER);
52-
}
53-
\Magento\Framework\App\ObjectManager::setInstance($objectManagerMock);
54-
5541
$this->template = $objectManagerHelper->getObject(
5642
'Magento\Sales\Model\Email\Template',
5743
[
@@ -60,12 +46,6 @@ public function setUp()
6046
);
6147
}
6248

63-
protected function tearDown()
64-
{
65-
parent::tearDown();
66-
\Magento\Framework\App\ObjectManager::setInstance($this->objectManagerBackup);
67-
}
68-
6949
public function testIncludeTemplate()
7050
{
7151
$this->mockViewFilesystem->expects($this->once())

0 commit comments

Comments
 (0)