20 private $metadataMock;
24 $this->metadataMock = $this->getMockBuilder(
26 )->disableOriginalConstructor()->getMock();
41 $isCustomerSaveTransaction,
48 $dataObjectMock = $this->getMockBuilder(\
Magento\Framework\DataObject::class)
49 ->disableOriginalConstructor()
54 'getIsDefaultBilling',
55 'getIsDefaultShipping',
56 'getIsCustomerSaveTransaction',
60 $dataObjectMock->expects($this->any())
62 ->willReturn($entityId);
63 $dataObjectMock->expects($this->once())
65 ->willReturn([
'is_billing_address' => 1]);
66 $dataObjectMock->expects($this->once())
67 ->method(
'getDataByKey')
68 ->with(
'is_billing_address')
70 $dataObjectMock->expects($this->once())
71 ->method(
'getIsCustomerSaveTransaction')
72 ->willReturn($isCustomerSaveTransaction);
73 $dataObjectMock->expects($this->any())
74 ->method(
'getIsDefaultBilling')
75 ->willReturn($isDefaultBilling);
76 $dataObjectMock->expects($this->any())
77 ->method(
'getIsDefaultShipping')
78 ->willReturn($isDefaultShipping);
80 $this->metadataMock->expects($this->once())
82 ->with($dataObjectMock)
83 ->willReturn([
'is_billing_address' =>
null]);
85 $this->model->registerSnapshot($dataObjectMock);
87 $this->assertEquals($expected, $this->model->isModified($dataObjectMock));
105 $dataObjectMock = $this->getMockBuilder(\
Magento\Framework\DataObject::class)
106 ->disableOriginalConstructor()
113 $dataObjectMock->expects($this->any())
116 $dataObjectMock->expects($this->once())
118 ->willReturn([
'is_billing_address' => 1]);
120 $this->metadataMock->expects($this->once())
121 ->method(
'getFields')
122 ->with($dataObjectMock)
123 ->willReturn([
'is_billing_address' =>
null]);
125 $this->model->registerSnapshot($dataObjectMock);
127 $this->assertEquals(
true, $this->model->isModified($dataObjectMock));
testIsModified( $isCustomerSaveTransaction, $isDefaultBilling, $isDefaultShipping, $expected)