Skip to content

Commit

Permalink
MAGETWO-43857: [github] cache types don't properly invalidate all the…
Browse files Browse the repository at this point in the history
… time #1844
  • Loading branch information
Joan He committed Oct 23, 2015
1 parent f6f2691 commit bbb9f6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/code/Magento/Theme/Model/Design/Backend/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function afterSave()
parent::afterSave();
if ($this->isValueChanged()) {
$this->_cacheManager->clean();
$this->_eventManager->dispatch('adminhtml_cache_flush_system');
}
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class ThemeTest extends \PHPUnit_Framework_TestCase
*/
protected $cacheTypeListMock;

/**
* @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $eventManagerMock;

/**
* @var \Magento\Framework\App\CacheInterface | \PHPUnit_Framework_MockObject_MockObject
*/
Expand All @@ -48,9 +53,15 @@ protected function setUp()
$this->cacheManagerMock = $this->getMockBuilder('Magento\Framework\App\CacheInterface')
->disableOriginalConstructor()
->getMock();
$this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
->disableOriginalConstructor()
->getMock();
$this->context = $objectManager->getObject(
'Magento\Framework\Model\Context',
['cacheManager' => $this->cacheManagerMock]
[
'cacheManager' => $this->cacheManagerMock,
'eventDispatcher' => $this->eventManagerMock,
]
);

$this->designMock = $this->getMockBuilder('Magento\Framework\View\DesignInterface')->getMock();
Expand Down Expand Up @@ -100,6 +111,11 @@ public function testAfterSave($callNumber, $oldValue)
$this->configMock->expects($this->any())
->method('getValue')
->willReturn($oldValue);
if ($callNumber) {
$this->eventManagerMock->expects($this->at(3))
->method('dispatch')
->with('adminhtml_cache_flush_system');
}
$this->model->setValue('some_value');
$this->assertInstanceOf(get_class($this->model), $this->model->afterSave());
}
Expand Down

0 comments on commit bbb9f6c

Please sign in to comment.