/** * @param int $callNumber * @param string $oldValue * @dataProvider afterSaveDataProvider */ public function testAfterSave($callNumber, $oldValue) { $this->cacheTypeListMock->expects($this->exactly($callNumber))->method('invalidate'); $this->configMock->expects($this->any())->method('getValue')->willReturnMap([[Theme::XML_PATH_INVALID_CACHES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, ['block_html' => 1, 'layout' => 1, 'translate' => 1]], [null, \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, $oldValue]]); $this->model->setValue('some_value'); $this->assertInstanceOf(get_class($this->model), $this->model->afterSave()); }
public function testAfterDelete() { $this->configMock->expects($this->any())->method('getValue')->willReturnMap([[Theme::XML_PATH_INVALID_CACHES, ScopeInterface::SCOPE_STORE, null, ['block_html' => 1, 'layout' => 1, 'translate' => 1]], [null, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, 'old_value']]); $this->cacheTypeListMock->expects($this->exactly(2))->method('invalidate'); $this->model->setValue('some_value'); $this->assertSame($this->model, $this->model->afterDelete()); }
/** * @test * @return void * @covers \Magento\Theme\Model\Design\Backend\Theme::beforeSave * @covers \Magento\Theme\Model\Design\Backend\Theme::__construct */ public function testBeforeSave() { $this->design->expects($this->once())->method('setDesignTheme')->with('some_value', Area::AREA_FRONTEND); $this->model->setValue('some_value'); $this->assertInstanceOf(get_class($this->model), $this->model->beforeSave()); }