本文整理汇总了PHP中Drupal\filter\Entity\FilterFormat::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP FilterFormat::expects方法的具体用法?PHP FilterFormat::expects怎么用?PHP FilterFormat::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\filter\Entity\FilterFormat
的用法示例。
在下文中一共展示了FilterFormat::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
// Mock text format configuration entity object.
$this->format = $this->getMockBuilder('\\Drupal\\filter\\Entity\\FilterFormat')->disableOriginalConstructor()->getMock();
$this->format->expects($this->any())->method('getFilterTypes')->will($this->returnValue(array(FilterInterface::TYPE_HTML_RESTRICTOR)));
$restrictions = array('allowed' => array('p' => TRUE, 'a' => TRUE, '*' => array('style' => FALSE, 'on*' => FALSE)));
$this->format->expects($this->any())->method('getHtmlRestrictions')->will($this->returnValue($restrictions));
}
示例2: setUpBuildForm
/**
* Sets up mocks for buildForm() calls.
*
* @param object $asset
* An asset to load from the entity type manager.
*/
private function setUpBuildForm($asset = NULL)
{
$this->mockFilter->expects($this->exactly(2))->method('id')->willReturn(self::MOCK_FILTER_ID);
$filter_align = new \stdClass();
$filter_align->status = 1;
$this->mockFilter->expects($this->once())->method('filters')->with('filter_align')->willReturn($filter_align);
$catalog_id = 'test_catalog';
$editor_settings['plugins']['embridgeimage']['embridge_image_upload'] = ['max_size' => '2 MB', 'library_id' => 101, 'catalog_id' => $catalog_id, 'directory' => 'test-directory'];
$mock_editor = $this->getMockBuilder(Editor::class)->disableOriginalConstructor()->getMock();
$mock_editor->expects($this->once())->method('getSettings')->willReturn($editor_settings);
$mock_editor_storage = $this->getMockBuilder(EntityStorageInterface::class)->disableOriginalConstructor()->getMock();
$mock_editor_storage->expects($this->once())->method('load')->with(self::MOCK_FILTER_ID)->willReturn($mock_editor);
$mock_catalog = $this->getMockBuilder(EmbridgeCatalog::class)->disableOriginalConstructor()->getMock();
$mock_catalog->expects($this->any())->method('getApplicationId')->willReturn('test_application');
$mock_catalog->expects($this->once())->method('getConversionsArray')->willReturn(['thumb', 'medium', 'large']);
$mock_catalog_storage = $this->getMockBuilder(EntityStorageInterface::class)->disableOriginalConstructor()->getMock();
$mock_catalog_storage->expects($this->once())->method('load')->with($catalog_id)->willReturn($mock_catalog);
$map = [['editor', $mock_editor_storage], ['embridge_catalog', $mock_catalog_storage]];
if ($asset) {
$mock_asset_storage = $this->getMockBuilder(EntityStorageInterface::class)->disableOriginalConstructor()->getMock();
$mock_asset_storage->expects($this->once())->method('load')->willReturn($asset);
$map[] = ['embridge_asset_entity', $mock_asset_storage];
}
$this->entityTypeManager->expects($this->exactly(count($map)))->method('getStorage')->will($this->returnValueMap($map));
}