本文整理匯總了PHP中Magento\Framework\View\Element\UiComponent\ContextInterface類的典型用法代碼示例。如果您正苦於以下問題:PHP ContextInterface類的具體用法?PHP ContextInterface怎麽用?PHP ContextInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ContextInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
protected function setUp()
{
$this->objectManager = new ObjectManager($this);
$this->contextMock = $this->getMockBuilder(ContextInterface::class)->getMockForAbstractClass();
$this->processorMock = $this->getMockBuilder(Processor::class)->disableOriginalConstructor()->getMock();
$this->contextMock->expects($this->any())->method('getProcessor')->willReturn($this->processorMock);
}
示例2: setUp
/**
* Set up
*/
public function setUp()
{
$this->objectManager = new ObjectManager($this);
$this->contextMock = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface', [], '', false, true, true, []);
$processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
$this->contextMock->expects($this->any())->method('getProcessor')->willReturn($processor);
}
示例3: setUp
/**
* @return void
*/
protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);
$processorMock = $this->getMock('Magento\\Framework\\View\\Element\\UiComponent\\Processor', [], [], '', false, false);
$processorMock->expects($this->once())->method('register');
$this->contextMock = $this->getMock('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface');
$this->contextMock->expects($this->any())->method('getProcessor')->willReturn($processorMock);
}
示例4: setup
public function setup()
{
$this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->getMockForAbstractClass();
$processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
$this->context->expects($this->any())->method('getProcessor')->willReturn($processor);
$this->uiComponentFactory = $this->getMock('Magento\\Framework\\View\\Element\\UiComponentFactory', [], [], '', false);
$this->component = new AccountLock($this->context, $this->uiComponentFactory);
}
示例5: __construct
/**
* @param ContextInterface $context
* @param FormFactory $formFactory
* @param ConfigInterface $wysiwygConfig
* @param array $components
* @param array $data
* @param array $config
*/
public function __construct(ContextInterface $context, FormFactory $formFactory, ConfigInterface $wysiwygConfig, array $components = [], array $data = [], array $config = [])
{
$wysiwygConfigData = isset($config['wysiwygConfigData']) ? $config['wysiwygConfigData'] : [];
$this->form = $formFactory->create();
$this->editor = $this->form->addField($context->getNamespace() . '_' . $data['name'], 'Magento\\Framework\\Data\\Form\\Element\\Editor', ['force_load' => true, 'rows' => 20, 'name' => $data['name'], 'config' => $wysiwygConfig->getConfig($wysiwygConfigData), 'wysiwyg' => isset($config['wysiwyg']) ? $config['wysiwyg'] : null]);
$data['config']['content'] = $this->editor->getElementHtml();
parent::__construct($context, $components, $data);
}
示例6: __construct
/**
* Constructor
*
* @param ContextInterface $context
* @param UiComponentInterface[] $components
* @param array $data
*/
public function __construct(ContextInterface $context, array $components = [], array $data = [])
{
$this->context = $context;
$this->components = $components;
$this->initObservers($data);
$this->context->getProcessor()->register($this);
$this->_data = array_replace_recursive($this->_data, $data);
}
示例7: setUp
/**
* Set up
*
* @return void
*/
protected function setUp()
{
$this->uiComponentFactoryMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponentFactory')->disableOriginalConstructor()->getMock();
$this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->getMockForAbstractClass();
$processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
$this->contextMock->expects($this->any())->method('getProcessor')->willReturn($processor);
$this->multiline = new Multiline($this->contextMock, $this->uiComponentFactoryMock);
}
示例8: setup
public function setup()
{
$this->processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
$this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->getMockForAbstractClass();
$this->context->expects($this->once())->method('getProcessor')->willReturn($this->processor);
$this->uiComponentFactory = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponentFactory')->disableOriginalConstructor()->getMock();
$this->scopeConfig = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->getMockForAbstractClass();
$this->confirmation = new Confirmation($this->context, $this->uiComponentFactory, $this->scopeConfig, [], []);
}
示例9: setUp
protected function setUp()
{
$this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->getMockForAbstractClass();
$this->contextMock = $this->getMockBuilder(ContextInterface::class)->getMockForAbstractClass();
$this->uiElementProcessorMock = $this->getMockBuilder(UiElementProcessor::class)->disableOriginalConstructor()->getMock();
$this->contextMock->expects(static::any())->method('getProcessor')->willReturn($this->uiElementProcessorMock);
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->nameColumn = $this->objectManagerHelper->getObject(NameColumn::class, ['urlBuilder' => $this->urlBuilderMock, 'context' => $this->contextMock]);
}
示例10: setup
public function setup()
{
$this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->getMockForAbstractClass();
$processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
$this->context->expects($this->any())->method('getProcessor')->willReturn($processor);
$this->uiComponentFactory = $this->getMock('Magento\\Framework\\View\\Element\\UiComponentFactory', [], [], '', false);
$this->urlBuilder = $this->getMockForAbstractClass('Magento\\Framework\\UrlInterface', [], '', false);
$this->component = new EditAction($this->context, $this->uiComponentFactory, $this->urlBuilder, [], ['name' => 'name', 'config' => ['editUrlPath' => 'theme/design_config/edit']]);
}
示例11: setup
public function setup()
{
$this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->getMockForAbstractClass();
$processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
$this->context->expects($this->any())->method('getProcessor')->willReturn($processor);
$this->uiComponentFactory = $this->getMock('Magento\\Framework\\View\\Element\\UiComponentFactory', [], [], '', false);
$this->attributeRepository = $this->getMock('Magento\\Customer\\Ui\\Component\\Listing\\AttributeRepository', [], [], '', false);
$this->attributeMetadata = $this->getMockForAbstractClass('\\Magento\\Customer\\Api\\Data\\AttributeMetadataInterface', [], '', false);
$this->component = new AttributeColumn($this->context, $this->uiComponentFactory, $this->attributeRepository);
$this->component->setData('name', 'gender');
}
示例12: setUp
protected function setUp()
{
$this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->getMockForAbstractClass();
$processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
$this->context->expects($this->any())->method('getProcessor')->willReturn($processor);
$this->columnFactory = $this->getMock('Magento\\Customer\\Ui\\Component\\ColumnFactory', ['create'], [], '', false);
$this->attributeRepository = $this->getMock('Magento\\Customer\\Ui\\Component\\Listing\\AttributeRepository', [], [], '', false);
$this->attribute = $this->getMock('Magento\\Customer\\Model\\Attribute', [], [], '', false);
$this->column = $this->getMockForAbstractClass('Magento\\Ui\\Component\\Listing\\Columns\\ColumnInterface', [], '', false);
$this->inlineEditUpdater = $this->getMockBuilder('Magento\\Customer\\Ui\\Component\\Listing\\Column\\InlineEditUpdater')->disableOriginalConstructor()->getMock();
$this->component = new Columns($this->context, $this->columnFactory, $this->attributeRepository, $this->inlineEditUpdater);
}
示例13: setUp
protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->processorMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->setMethods([])->getMock();
$this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->disableOriginalConstructor()->setMethods([])->getMock();
$this->uiComponentFactoryMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponentFactory')->disableOriginalConstructor()->setMethods([])->getMock();
$this->systemStoreMock = $this->getMockBuilder('Magento\\Store\\Model\\System\\Store')->disableOriginalConstructor()->setMethods([])->getMock();
$this->escaperMock = $this->getMockBuilder('Magento\\Framework\\Escaper')->disableOriginalConstructor()->setMethods([])->getMock();
$this->contextMock->expects($this->atLeastOnce())->method('getProcessor')->willReturn($this->processorMock);
$this->processorMock->expects($this->atLeastOnce())->method('register');
$this->model = $objectManager->getObject('Magento\\Store\\Ui\\Component\\Listing\\Column\\Store', ['context' => $this->contextMock, 'uiComponent' => $this->uiComponentFactoryMock, 'systemStore' => $this->systemStoreMock, 'escaper' => $this->escaperMock, 'components' => [], 'data' => ['name' => $this->name]]);
}
示例14: setUp
protected function setUp()
{
$this->contextMock = $this->getMockBuilder(ContextInterface::class)->getMockForAbstractClass();
$this->attributeRepositoryMock = $this->getMockBuilder(ProductAttributeRepositoryInterface::class)->getMockForAbstractClass();
$this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)->disableOriginalConstructor()->getMock();
$this->uiElementProcessorMock = $this->getMockBuilder(UiElementProcessor::class)->disableOriginalConstructor()->getMock();
$this->searchCriteriaMock = $this->getMockBuilder(SearchCriteria::class)->disableOriginalConstructor()->getMock();
$this->searchResultsMock = $this->getMockBuilder(ProductAttributeSearchResultsInterface::class)->getMockForAbstractClass();
$this->contextMock->expects(static::any())->method('getProcessor')->willReturn($this->uiElementProcessorMock);
$this->searchCriteriaBuilderMock->expects(static::any())->method('addFilter')->willReturnSelf();
$this->searchCriteriaBuilderMock->expects(static::any())->method('create')->willReturn($this->searchCriteriaMock);
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->attributesColumn = $this->objectManagerHelper->getObject(AttributesColumn::class, ['context' => $this->contextMock, 'attributeRepository' => $this->attributeRepositoryMock, 'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock]);
}
示例15: testPrepare
/**
* Run test prepare method
*
* @param array $data
* @param array $filterData
* @param array|null $expectedCondition
* @dataProvider getPrepareDataProvider
* @return void
*/
public function testPrepare($data, $filterData, $expectedCondition)
{
$name = $data['name'];
/** @var UiComponentInterface $uiComponent */
$uiComponent = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponentInterface', [], '', false);
$uiComponent->expects($this->any())->method('getContext')->willReturn($this->contextMock);
$this->contextMock->expects($this->any())->method('getNamespace')->willReturn(Select::NAME);
$this->contextMock->expects($this->any())->method('addComponentDefinition')->with(Select::NAME, ['extends' => Select::NAME]);
$this->contextMock->expects($this->any())->method('getFiltersParams')->willReturn($filterData);
/** @var DataProviderInterface $dataProvider */
$dataProvider = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponent\\DataProvider\\DataProviderInterface', ['addFilter'], '', false);
$this->contextMock->expects($this->any())->method('getDataProvider')->willReturn($dataProvider);
if ($expectedCondition !== null) {
$filterMock = $this->getMock('Magento\\Framework\\Api\\Filter');
$this->filterBuilderMock->expects($this->any())->method('setConditionType')->with($expectedCondition)->willReturnSelf();
$this->filterBuilderMock->expects($this->any())->method('setField')->with($name)->willReturnSelf();
$this->filterBuilderMock->expects($this->any())->method('setValue')->willReturnSelf();
$this->filterBuilderMock->expects($this->any())->method('create')->willReturn($filterMock);
$dataProvider->expects($this->any())->method('addFilter')->with($filterMock);
}
/** @var \Magento\Framework\Data\OptionSourceInterface $selectOptions */
$selectOptions = $this->getMockForAbstractClass('Magento\\Framework\\Data\\OptionSourceInterface', [], '', false);
$this->uiComponentFactory->expects($this->any())->method('create')->with($name, Select::COMPONENT, ['context' => $this->contextMock, 'options' => $selectOptions])->willReturn($uiComponent);
$date = new Select($this->contextMock, $this->uiComponentFactory, $this->filterBuilderMock, $this->filterModifierMock, $selectOptions, [], $data);
$date->prepare();
}