32 $this->_authorizationMock = $this->createMock(\
Magento\Framework\AuthorizationInterface::class);
33 $this->_urlInterfaceMock = $this->createMock(\
Magento\Framework\UrlInterface::class);
34 $this->_cacheTypeListMock = $this->createMock(\
Magento\Framework\
App\Cache\TypeListInterface::class);
36 $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
42 $this->_messageModel = $objectManagerHelper->getObject(
43 \
Magento\AdminNotification\Model\System\Message\CacheOutdated::class,
55 $this->_cacheTypeListMock->expects(
60 $this->returnValue($cacheTypes)
62 $this->assertEquals($expectedSum, $this->_messageModel->getIdentity());
70 $cacheTypeMock1 = $this->createPartialMock(\stdClass::class, [
'getCacheType']);
71 $cacheTypeMock1->expects($this->any())->method(
'getCacheType')->will($this->returnValue(
'Simple'));
73 $cacheTypeMock2 = $this->createPartialMock(\stdClass::class, [
'getCacheType']);
74 $cacheTypeMock2->expects($this->any())->method(
'getCacheType')->will($this->returnValue(
'Advanced'));
77 [
'c13cfaddc2c53e8d32f59bfe89719beb', [$cacheTypeMock1]],
78 [
'69aacdf14d1d5fcef7168b9ac308215e', [$cacheTypeMock1, $cacheTypeMock2]]
90 $this->_authorizationMock->expects($this->once())->method(
'isAllowed')->will($this->returnValue($allowed));
91 $this->_cacheTypeListMock->expects(
96 $this->returnValue($cacheTypes)
98 $this->assertEquals($expected, $this->_messageModel->isDisplayed());
106 $cacheTypesMock = $this->createPartialMock(\stdClass::class, [
'getCacheType']);
107 $cacheTypesMock->expects($this->any())->method(
'getCacheType')->will($this->returnValue(
'someVal'));
108 $cacheTypes = [$cacheTypesMock, $cacheTypesMock];
111 [
false,
false, $cacheTypes],
113 [
true,
true, $cacheTypes]
119 $messageText =
'One or more of the Cache Types are invalidated';
121 $this->_cacheTypeListMock->expects($this->any())->method(
'getInvalidated')->will($this->returnValue([]));
122 $this->_urlInterfaceMock->expects($this->once())->method(
'getUrl')->will($this->returnValue(
'someURL'));
123 $this->assertContains($messageText, $this->_messageModel->getText());
128 $url =
'backend/admin/cache';
129 $this->_urlInterfaceMock->expects($this->once())->method(
'getUrl')->will($this->returnValue(
$url));
130 $this->assertEquals(
$url, $this->_messageModel->getLink());
testIsDisplayed($expected, $allowed, $cacheTypes)
testGetIdentity($expectedSum, $cacheTypes)
getIdentityDataProvider()
isDisplayedDataProvider()