本文整理汇总了PHP中Magento\Framework\App\Cache\TypeListInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP TypeListInterface::expects方法的具体用法?PHP TypeListInterface::expects怎么用?PHP TypeListInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Cache\TypeListInterface
的用法示例。
在下文中一共展示了TypeListInterface::expects方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAfterSave
/**
* @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());
}
示例2: testAfterDelete
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());
}
示例3: testExecute
/**
* @dataProvider invalidateCacheDataProvider
* @param bool $cacheState
*/
public function testExecute($cacheState)
{
$this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue($cacheState));
if ($cacheState) {
$this->_typeListMock->expects($this->once())->method('invalidate')->with($this->equalTo('full_page'));
}
$this->_model->execute($this->observerMock);
}
示例4: testAfterExecuteInvalidate
public function testAfterExecuteInvalidate()
{
$subject = $this->getMockBuilder('Magento\\Catalog\\Model\\Indexer\\Category\\Product\\AbstractAction')->disableOriginalConstructor()->getMockForAbstractClass();
$result = $this->getMockBuilder('Magento\\Catalog\\Model\\Indexer\\Category\\Product\\AbstractAction')->disableOriginalConstructor()->getMockForAbstractClass();
$this->config->expects($this->once())->method('isEnabled')->willReturn(true);
$this->typeList->expects($this->once())->method('invalidate')->with('full_page');
$this->assertEquals($result, $this->execute->afterExecute($subject, $result));
}
示例5: testExecuteNoChanged
/**
* @dataProvider invalidateCacheDataProvider
* @param bool $cacheState
*/
public function testExecuteNoChanged($cacheState)
{
$this->configMock->expects($this->once())->method('isEnabled')->will($this->returnValue($cacheState));
$this->typeListMock->expects($this->never())->method('invalidate');
if ($cacheState) {
$this->objectMock->expects($this->once())->method('getIdentities')->will($this->returnValue([]));
}
$this->model->execute($this->observerMock);
}
示例6: testAroundSave
public function testAroundSave()
{
$subject = $this->getMockBuilder('Magento\\Catalog\\Model\\ResourceModel\\Attribute')->disableOriginalConstructor()->getMock();
$attribute = $this->getMockBuilder('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute')->disableOriginalConstructor()->getMock();
$self = $this;
$proceed = function ($object) use($self, $attribute) {
$self->assertEquals($object, $attribute);
};
$this->config->expects($this->once())->method('isEnabled')->willReturn(true);
$this->typeList->expects($this->once())->method('invalidate')->with('full_page');
$this->save->aroundSave($subject, $proceed, $attribute);
}
示例7: testAfterSave
/**
* @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')->willReturn($oldValue);
$this->model->setValue('some_value');
$this->assertInstanceOf(get_class($this->model), $this->model->afterSave());
}
示例8: testSetCurrencySymbolData
public function testSetCurrencySymbolData()
{
$websiteId = 1;
$groupId = 2;
$currencies = 'USD,EUR';
$symbols = [];
$value['options']['fields']['customsymbol']['inherit'] = 1;
$this->prepareMocksForGetCurrencySymbolsData($websiteId, $groupId, $currencies);
/**
* @var \Magento\Config\Model\Config|\PHPUnit_Framework_MockObject_MockObject
*/
$configMock = $this->getMock('Magento\\Config\\Model\\Config', ['setSection', 'setWebsite', 'setStore', 'setGroups', 'save'], [], '', false);
$this->configFactoryMock->expects($this->any())->method('create')->willReturn($configMock);
$configMock->expects($this->any())->method('setSection')->with(Currencysymbol::CONFIG_SECTION)->willReturnSelf();
$configMock->expects($this->any())->method('setWebsite')->with(null)->willReturnSelf();
$configMock->expects($this->any())->method('setStore')->with(null)->willReturnSelf();
$configMock->expects($this->any())->method('setGroups')->with($value)->willReturnSelf();
$this->coreConfigMock->expects($this->once())->method('reinit');
$this->cacheTypeListMock->expects($this->atLeastOnce())->method('invalidate');
$this->eventManagerMock->expects($this->atLeastOnce())->method('dispatch')->willReturnMap([['admin_system_config_changed_section_currency_before_reinit', null, null], ['admin_system_config_changed_section_currency', null, null]]);
$this->assertInstanceOf('Magento\\CurrencySymbol\\Model\\System\\Currencysymbol', $this->model->setCurrencySymbolsData($symbols));
}
示例9: testGetAvailableTypes
public function testGetAvailableTypes()
{
$types = [['id' => 'foo', 'status' => true], ['id' => 'bar', 'status' => false]];
$this->cacheTypeList->expects($this->once())->method('getTypes')->willReturn($types);
$this->assertSame(['foo', 'bar'], $this->model->getAvailableTypes());
}
示例10: testAfterDelete
/**
* @return void;
*/
public function testAfterDelete()
{
$this->cacheTypeListMock->expects($this->once())->method('invalidate');
$this->assertInstanceOf(get_class($this->model), $this->model->afterDelete());
}