@@ -46,11 +46,6 @@ class CheckoutAgreementsRepositoryTest extends \PHPUnit_Framework_TestCase
46
46
*/
47
47
private $ agrFactoryMock ;
48
48
49
- /**
50
- * @var \PHPUnit_Framework_MockObject_MockObject
51
- */
52
- private $ dataObjHelperMock ;
53
-
54
49
/**
55
50
* @var \PHPUnit_Framework_MockObject_MockObject
56
51
*/
@@ -82,8 +77,7 @@ protected function setUp()
82
77
'' ,
83
78
false
84
79
);
85
- $ this ->dataObjHelperMock = $ this ->getMock ('Magento\Framework\Api\DataObjectHelper ' , [], [], '' , false );
86
- $ methods = ['addData ' , 'getData ' , 'setStores ' , 'getAgreementId ' , 'getId ' , 'setStoreId ' ];
80
+ $ methods = ['addData ' , 'getData ' , 'setStores ' , 'getAgreementId ' , 'getId ' ];
87
81
$ this ->agreementMock =
88
82
$ this ->getMock ('\Magento\CheckoutAgreements\Model\Agreement ' , $ methods , [], '' , false );
89
83
$ this ->storeMock = $ this ->getMock ('Magento\Store\Model\Store ' , [], [], '' , false );
@@ -92,8 +86,7 @@ protected function setUp()
92
86
$ this ->storeManagerMock ,
93
87
$ this ->scopeConfigMock ,
94
88
$ this ->resourceMock ,
95
- $ this ->agrFactoryMock ,
96
- $ this ->dataObjHelperMock
89
+ $ this ->agrFactoryMock
97
90
);
98
91
}
99
92
@@ -150,16 +143,10 @@ public function testUpdate()
150
143
->expects ($ this ->once ())
151
144
->method ('load ' )
152
145
->with ($ this ->agreementMock , $ agreementId );
153
- $ this ->agreementMock ->expects ($ this ->once ())->method ('setStoreId ' )->with (1 );
154
146
$ this ->storeManagerMock ->expects ($ this ->never ())->method ('getStore ' );
155
147
$ this ->agreementMock ->expects ($ this ->once ())->method ('setStores ' );
156
148
$ this ->agreementMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ agreementId );
157
149
$ this ->agreementMock ->expects ($ this ->any ())->method ('getData ' )->willReturn (['data ' ]);
158
- $ this ->dataObjHelperMock
159
- ->expects ($ this ->once ())
160
- ->method ('populateWithArray ' )
161
- ->with ($ this ->agreementMock , ['data ' ], 'Magento\CheckoutAgreements\Api\Data\AgreementInterface ' )
162
- ->willReturn ($ this ->agreementMock );
163
150
$ this ->agreementMock
164
151
->expects ($ this ->once ())
165
152
->method ('addData ' )->with (['data ' ])
@@ -194,14 +181,7 @@ public function testDeleteById()
194
181
->method ('load ' )
195
182
->with ($ this ->agreementMock , $ agreementId )
196
183
->willReturn ($ this ->agreementMock );
197
- $ this ->agreementMock ->expects ($ this ->any ())->method ('setStoreId ' )->with (null );
198
184
$ this ->agreementMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ agreementId );
199
- $ this ->agreementMock ->expects ($ this ->once ())->method ('getData ' )->willReturn (['data ' ]);
200
- $ this ->dataObjHelperMock
201
- ->expects ($ this ->once ())
202
- ->method ('populateWithArray ' )
203
- ->with ($ this ->agreementMock , ['data ' ], 'Magento\CheckoutAgreements\Api\Data\AgreementInterface ' )
204
- ->willReturn ($ this ->agreementMock );
205
185
$ this ->resourceMock ->expects ($ this ->once ())->method ('delete ' );
206
186
$ this ->assertTrue ($ this ->model ->deleteById (1 ));
207
187
}
@@ -218,14 +198,7 @@ public function testDeleteByIdWithException()
218
198
->method ('load ' )
219
199
->with ($ this ->agreementMock , $ agreementId )
220
200
->willReturn ($ this ->agreementMock );
221
- $ this ->agreementMock ->expects ($ this ->any ())->method ('setStoreId ' )->with (null );
222
201
$ this ->agreementMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ agreementId );
223
- $ this ->agreementMock ->expects ($ this ->once ())->method ('getData ' )->willReturn (['data ' ]);
224
- $ this ->dataObjHelperMock
225
- ->expects ($ this ->once ())
226
- ->method ('populateWithArray ' )
227
- ->with ($ this ->agreementMock , ['data ' ], 'Magento\CheckoutAgreements\Api\Data\AgreementInterface ' )
228
- ->willReturn ($ this ->agreementMock );
229
202
$ this ->resourceMock ->expects ($ this ->once ())->method ('delete ' )->willThrowException (new \Exception ());
230
203
$ this ->assertTrue ($ this ->model ->deleteById (1 ));
231
204
}
0 commit comments