Skip to content

Commit 31764a5

Browse files
committed
Add back in the mock of the jsonEncoder to the test case
1 parent 5568b8d commit 31764a5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/code/Magento/Customer/Block/CustomerScopeData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class CustomerScopeData extends \Magento\Framework\View\Element\Template
2525
private $serializer;
2626

2727
/**
28-
* CustomerScopeData constructor.
2928
* @param \Magento\Framework\View\Element\Template\Context $context
3029
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
3130
* @param array $data
3231
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
3332
* @throws \RuntimeException
33+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3434
*/
3535
public function __construct(
3636
\Magento\Framework\View\Element\Template\Context $context,

app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Magento\Store\Api\Data\StoreInterface;
1111
use Magento\Store\Model\StoreManagerInterface;
1212
use Magento\Customer\Block\CustomerScopeData;
13-
use Magento\Framework\Json\EncoderInterface;
1413

1514
class CustomerScopeDataTest extends \PHPUnit_Framework_TestCase
1615
{
@@ -26,6 +25,9 @@ class CustomerScopeDataTest extends \PHPUnit_Framework_TestCase
2625
/** @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */
2726
private $scopeConfigMock;
2827

28+
/** @var \Magento\Framework\Json\EncoderInterface|\PHPUnit_Framework_MockObject_MockObject */
29+
private $encoderMock;
30+
2931
/** @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject */
3032
private $serializerMock;
3133

@@ -41,6 +43,9 @@ protected function setUp()
4143
$this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
4244
->getMock();
4345

46+
$this->encoderMock = $this->getMockBuilder(\Magento\Framework\Json\EncoderInterface::class)
47+
->getMock();
48+
4449
$this->serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class)
4550
->getMock();
4651

@@ -54,7 +59,7 @@ protected function setUp()
5459

5560
$this->model = new CustomerScopeData(
5661
$this->contextMock,
57-
null,
62+
$this->encoderMock,
5863
[],
5964
$this->serializerMock
6065
);

0 commit comments

Comments
 (0)