@@ -160,6 +160,39 @@ public function testInitFormCanNotShowTab()
160
160
161
161
$ this ->assertSame ($ this ->model , $ this ->model ->initForm ());
162
162
}
163
+
164
+ /**
165
+ * Test getSubscriberStatusChangedDate
166
+ */
167
+ public function testGetSubscriberStatusChangedDate ()
168
+ {
169
+ $ customerId = 999 ;
170
+ $ websiteId = 1 ;
171
+ $ storeId = 1 ;
172
+ $ isSubscribed = true ;
173
+
174
+ $ this ->registryMock ->method ('registry ' )->with (RegistryConstants::CURRENT_CUSTOMER_ID )
175
+ ->willReturn ($ customerId );
176
+
177
+ $ customer = $ this ->getMockForAbstractClass (CustomerInterface::class);
178
+ $ customer ->method ('getWebsiteId ' )->willReturn ($ websiteId );
179
+ $ customer ->method ('getStoreId ' )->willReturn ($ storeId );
180
+ $ customer ->method ('getId ' )->willReturn ($ customerId );
181
+ $ this ->customerRepository ->method ('getById ' )->with ($ customerId )->willReturn ($ customer );
182
+
183
+ $ subscriberMock = $ this ->getMockBuilder (Subscriber::class)
184
+ ->disableOriginalConstructor ()
185
+ ->setMethods (['loadByCustomer ' , 'getChangeStatusAt ' , 'isSubscribed ' , 'getData ' ])
186
+ ->getMock ();
187
+
188
+ $ subscriberMock ->method ('loadByCustomer ' )->with ($ customerId , $ websiteId )->willReturnSelf ();
189
+ $ subscriberMock ->method ('getChangeStatusAt ' )->willReturn ('' );
190
+ $ subscriberMock ->method ('isSubscribed ' )->willReturn ($ isSubscribed );
191
+ $ subscriberMock ->method ('getData ' )->willReturn ([]);
192
+ $ this ->subscriberFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ subscriberMock );
193
+
194
+ $ this ->assertEquals ('' , $ this ->model ->getStatusChangedDate ());
195
+ }
163
196
164
197
/**
165
198
* Test to initialize the form
0 commit comments