• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UiComponent\ContextInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\View\Element\UiComponent\ContextInterface的典型用法代码示例。如果您正苦于以下问题:PHP ContextInterface类的具体用法?PHP ContextInterface怎么用?PHP ContextInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ContextInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:AbstractElementTest.php


示例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);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:10,代码来源:ColumnsTest.php


示例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);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:UseConfigSettingsTest.php


示例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);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:8,代码来源:AccountLockTest.php


示例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);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:16,代码来源:Wysiwyg.php


示例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);
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:15,代码来源:AbstractComponent.php


示例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);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:13,代码来源:MultilineTest.php


示例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, [], []);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:9,代码来源:ConfirmationTest.php


示例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]);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:9,代码来源:NameTest.php


示例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']]);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:9,代码来源:EditActionTest.php


示例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');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:AttributeColumnTest.php


示例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);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:ColumnsTest.php


示例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]]);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:12,代码来源:StoreTest.php


示例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]);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:AttributesTest.php


示例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();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:35,代码来源:SelectTest.php


示例16: testPrepareDataSource

 public function testPrepareDataSource()
 {
     $dataSource = ['data' => ['items' => [['entity_id' => 1]]]];
     $expectedDataSource = ['data' => ['items' => [['entity_id' => 1, 'name' => ['edit' => ['href' => 'http://magento.com/customer/index/edit', 'label' => new \Magento\Framework\Phrase('Edit'), 'hidden' => false]]]]]];
     $this->context->expects($this->once())->method('getFilterParam')->with('store_id')->willReturn(null);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with('customer/*/edit', ['id' => 1, 'store' => null])->willReturn('http://magento.com/customer/index/edit');
     $dataSource = $this->component->prepareDataSource($dataSource);
     $this->assertEquals($expectedDataSource, $dataSource);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:ActionsTest.php


示例17: testPrepareSuccess

 /**
  * Run test for prepare method
  *
  * @param array $data
  * @param array $expectedData
  * @return void
  *
  * @dataProvider prepareSuccessDataProvider
  */
 public function testPrepareSuccess(array $data, array $expectedData)
 {
     $this->uiComponentFactoryMock->expects($this->once())->method('create')->with(self::NAME, $data['config']['formElement'], $this->arrayHasKey('context'))->willReturn($this->getWrappedComponentMock());
     $this->contextMock->expects($this->any())->method('getNamespace')->willReturn(self::COMPONENT_NAMESPACE);
     $this->field->setData($data);
     $this->field->prepare();
     $result = $this->field->getData();
     $this->assertEquals($expectedData, $result);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:FieldTest.php


示例18: testPrepare

 /**
  * Run test prepare method
  *
  * @return void
  */
 public function testPrepare()
 {
     $buttons = ['button1' => 'button1', 'button2' => 'button2'];
     /** @var Listing $listing */
     $listing = $this->objectManager->getObject('Magento\\Ui\\Component\\Listing', ['context' => $this->contextMock, 'data' => ['js_config' => ['extends' => 'test_config_extends', 'testData' => 'testValue'], 'buttons' => $buttons]]);
     $this->contextMock->expects($this->at(0))->method('getNamespace')->willReturn(Listing::NAME);
     $this->contextMock->expects($this->once())->method('addComponentDefinition')->with($listing->getComponentName(), ['extends' => 'test_config_extends', 'testData' => 'testValue']);
     $this->contextMock->expects($this->once())->method('addButtons')->with($buttons, $listing);
     $listing->prepare();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:ListingTest.php


示例19: testPrepare

 /**
  * Run test prepare method
  *
  * @param string $name
  * @param array $filterData
  * @param array|null $expectedCondition
  * @dataProvider getPrepareDataProvider
  * @return void
  */
 public function testPrepare($name, $filterData, $expectedCondition)
 {
     $this->contextMock->expects($this->any())->method('getNamespace')->willReturn(Range::NAME);
     $this->contextMock->expects($this->any())->method('addComponentDefinition')->with(Range::NAME, ['extends' => Range::NAME]);
     $this->contextMock->expects($this->any())->method('getRequestParam')->with(UiContext::FILTER_VAR)->willReturn($filterData);
     if ($expectedCondition !== null) {
         /** @var DataProviderInterface $dataProvider */
         $dataProvider = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponent\\DataProvider\\DataProviderInterface', [], '', false);
         $dataProvider->expects($this->any())->method('addFilter')->with($expectedCondition, $name);
         $this->contextMock->expects($this->any())->method('getDataProvider')->willReturn($dataProvider);
     }
     $range = new Range($this->contextMock, $this->uiComponentFactory, [], ['name' => $name]);
     $range->prepare();
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:23,代码来源:RangeTest.php


示例20: testPrepare

 /**
  * Run test prepare method
  *
  * @return void
  */
 public function testPrepare()
 {
     $resultData = ['js_config' => ['extends' => 'test_config_extends', 'testData' => 'testValue'], 'config' => ['options' => [['value' => 20, 'label' => 20], ['value' => 30, 'label' => 30], ['value' => 50, 'label' => 50], ['value' => 100, 'label' => 100], ['value' => 200, 'label' => 200], ['value' => 20, 'label' => 'options1'], ['value' => 40, 'label' => 'options2']], 'pageSize' => 20, 'current' => 2]];
     /** @var Paging $paging */
     $paging = $this->objectManager->getObject('Magento\\Ui\\Component\\Paging', ['context' => $this->contextMock, 'data' => ['js_config' => ['extends' => 'test_config_extends', 'testData' => 'testValue'], 'config' => ['options' => ['options1' => ['label' => 'options1', 'value' => '20'], 'options2' => ['label' => 'options2', 'value' => '40']], 'current' => 2, 'pageSize' => 20]]]);
     /** @var DataProviderInterface|\PHPUnit_Framework_MockObject_MockObject $dataProviderMock */
     $dataProviderMock = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponent\\DataProvider\\DataProviderInterface', [], '', false);
     $this->contextMock->expects($this->once())->method('getRequestParam')->with('paging')->willReturn(['pageSize' => 5, 'current' => 3]);
     $this->contextMock->expects($this->once())->method('getDataProvider')->willReturn($dataProviderMock);
     $dataProviderMock->expects($this->once())->method('setLimit')->with(3, 5);
     $this->contextMock->expects($this->once())->method('addComponentDefinition')->with($paging->getComponentName(), ['extends' => 'test_config_extends', 'testData' => 'testValue']);
     $paging->prepare();
     $this->assertEquals($paging->getData(), $resultData);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:PagingTest.php



注:本文中的Magento\Framework\View\Element\UiComponent\ContextInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Page\Config类代码示例发布时间:2022-05-23
下一篇:
PHP Template\Context类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap