Skip to content

Commit f327e9e

Browse files
committed
Fix the Magento Weee tests that worked with the old Zend_Json dependancy
1 parent 1b990e8 commit f327e9e

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

app/code/Magento/Weee/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
8686
*
8787
* @param \Magento\Framework\App\Helper\Context $context
8888
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
89-
* @param WeeeDisplayConfig $weeeTax
89+
* @param \Magento\Weee\Model\Tax $weeeTax
9090
* @param \Magento\Weee\Model\Config $weeeConfig
9191
* @param \Magento\Tax\Helper\Data $taxData
9292
* @param \Magento\Framework\Registry $coreRegistry

app/code/Magento/Weee/Test/Unit/Model/Attribute/Backend/Weee/TaxTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515

1616
class TaxTest extends \PHPUnit_Framework_TestCase
1717
{
18-
/**
19-
* @var \Magento\Weee\Model\Attribute\Backend\Weee\Tax
20-
*/
21-
protected $model;
22-
2318
/**
2419
* @var ObjectManager
2520
*/
@@ -28,12 +23,14 @@ class TaxTest extends \PHPUnit_Framework_TestCase
2823
protected function setUp()
2924
{
3025
$this->objectManager = new ObjectManager($this);
31-
$this->model = $this->objectManager->getObject(\Magento\Weee\Model\Attribute\Backend\Weee\Tax::class);
3226
}
3327

3428
public function testGetBackendModelName()
3529
{
36-
$this->assertEquals(\Magento\Weee\Model\Attribute\Backend\Weee\Tax::class, $this->model->getBackendModelName());
30+
$this->assertEquals(
31+
\Magento\Weee\Model\Attribute\Backend\Weee\Tax::class,
32+
\Magento\Weee\Model\Attribute\Backend\Weee\Tax::getBackendModelName()
33+
);
3734
}
3835

3936
/**

app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTaxTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,12 @@ public function verifyTotals($address, $addressData)
242242

243243
public function testFetch()
244244
{
245+
$serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class)->getMock();
245246
$weeeTotal = 17;
246-
$totalMock = new \Magento\Quote\Model\Quote\Address\Total();
247+
$totalMock = new \Magento\Quote\Model\Quote\Address\Total(
248+
[],
249+
$serializerMock
250+
);
247251
$taxHelper = $this->setupTaxHelper([]);
248252
$weeeHelper = $this->setupWeeeHelper(['getTotalAmounts' => $weeeTotal]);
249253
$this->weeeCollector = $this->objectManagerHelper->getObject(
@@ -262,7 +266,11 @@ public function testFetch()
262266

263267
public function testFetchWithZeroAmounts()
264268
{
265-
$totalMock = new \Magento\Quote\Model\Quote\Address\Total();
269+
$serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class)->getMock();
270+
$totalMock = new \Magento\Quote\Model\Quote\Address\Total(
271+
[],
272+
$serializerMock
273+
);
266274
$taxHelper = $this->setupTaxHelper([]);
267275
$weeeHelper = $this->setupWeeeHelper(['getTotalAmounts' => null]);
268276
$this->weeeCollector = $this->objectManagerHelper->getObject(

app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ public function testCollect(
298298
$storeMock = $this->getMock(\Magento\Store\Model\Store::class, [], [], '', false);
299299
$quoteMock->expects($this->any())->method('getStore')->will($this->returnValue($storeMock));
300300
$addressMock = $this->setupAddressMock($items);
301-
$totalMock = new \Magento\Quote\Model\Quote\Address\Total();
301+
$totalMock = new \Magento\Quote\Model\Quote\Address\Total(
302+
[],
303+
$this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class)->getMock()
304+
);
302305
$shippingAssignmentMock = $this->setupShippingAssignmentMock($addressMock, $items);
303306

304307
$taxHelper = $this->setupTaxHelper($taxConfig);

0 commit comments

Comments
 (0)