Skip to content

Commit eb8be8c

Browse files
committed
MAGETWO-63626: Remove all usages of serialize/unserilize
1 parent 9982931 commit eb8be8c

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ class ProductsListTest extends \PHPUnit_Framework_TestCase
7878
*/
7979
private $priceCurrency;
8080

81+
/**
82+
* @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject
83+
*/
84+
private $serializer;
85+
8186
protected function setUp()
8287
{
8388
$this->collectionFactory =
@@ -91,7 +96,12 @@ protected function setUp()
9196
$this->httpContext = $this->getMock(\Magento\Framework\App\Http\Context::class);
9297
$this->builder = $this->getMock(\Magento\Rule\Model\Condition\Sql\Builder::class, [], [], '', false);
9398
$this->rule = $this->getMock(\Magento\CatalogWidget\Model\Rule::class, [], [], '', false);
94-
$this->widgetConditionsHelper = $this->getMock(\Magento\Widget\Helper\Conditions::class);
99+
$this->serializer = $this->getMock(\Magento\Framework\Serialize\Serializer\Json::class, [], [], '', false);
100+
$this->widgetConditionsHelper = $this->getMock(
101+
\Magento\Widget\Helper\Conditions::class,
102+
[],
103+
['serializer' => $this->serializer]
104+
);
95105
$this->storeManager = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class);
96106
$this->design = $this->getMock(\Magento\Framework\View\DesignInterface::class);
97107

app/code/Magento/Widget/Model/Widget/Instance.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,6 @@ class Instance extends \Magento\Framework\Model\AbstractModel
116116
*/
117117
private $serializer;
118118

119-
/**
120-
* Product type model instance.
121-
*
122-
* @var \Magento\Catalog\Model\Product\Type
123-
*/
124-
private $_productType;
125-
126-
/**
127-
* Widget config reader instance.
128-
*
129-
* @var \Magento\Widget\Model\Config\Reader
130-
*/
131-
private $_reader;
132-
133119
/**
134120
* @param \Magento\Framework\Model\Context $context
135121
* @param \Magento\Framework\Registry $registry

dev/tests/integration/testsuite/Magento/Widget/_files/new_widget.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111
$model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
1212
->get(\Magento\Widget\Model\Widget\Instance::class);
1313

14+
// Set default theme as work ground for MAGETWO-63643
15+
/** @var \Magento\Framework\View\Design\ThemeInterface $theme */
16+
$theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
17+
\Magento\Framework\View\Design\ThemeInterface::class
18+
);
19+
$theme->load('Magento/luma', 'theme_path');
20+
1421
$model->setData(
1522
[
1623
'instance_type' => 'Magento\\Widget\\NewSampleWidget',
17-
'theme_id' => '4',
24+
'theme_id' => $theme->getId(),
1825
'title' => 'New Sample widget title',
1926
'store_ids' => [
2027
0 => '0',
@@ -28,4 +35,4 @@
2835
]
2936
);
3037

31-
$resourceModel->save($model);
38+
$resourceModel->save($model);

0 commit comments

Comments
 (0)