当前位置: 首页>>代码示例>>PHP>>正文


PHP DatagridConfiguration::create方法代码示例

本文整理汇总了PHP中Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration::create方法的典型用法代码示例。如果您正苦于以下问题:PHP DatagridConfiguration::create方法的具体用法?PHP DatagridConfiguration::create怎么用?PHP DatagridConfiguration::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration的用法示例。


在下文中一共展示了DatagridConfiguration::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testVisitMetadata

 public function testVisitMetadata()
 {
     $config = DatagridConfiguration::create(['options' => ['mode' => ModeExtension::MODE_CLIENT]]);
     $metadata = MetadataObject::create([]);
     $this->extension->visitMetadata($config, $metadata);
     $this->assertEquals(ModeExtension::MODE_CLIENT, $metadata->offsetGetByPath('mode'));
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:ModeExtensionTest.php

示例2: setUp

 protected function setUp()
 {
     $this->acceptor = $this->getMockBuilder('Oro\\Bundle\\DataGridBundle\\Extension\\Acceptor')->disableOriginalConstructor()->getMock();
     $this->parameters = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datagrid\\ParameterBag');
     $this->grid = new Datagrid(self::TEST_NAME, DatagridConfiguration::create([]), $this->parameters);
     $this->grid->setAcceptor($this->acceptor);
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:DatagridTest.php

示例3: testVisitResult

 public function testVisitResult()
 {
     $result = ResultsObject::create([]);
     $this->extension->visitResult(DatagridConfiguration::create([]), $result);
     $this->assertArrayHasKey('metadata', $result);
     $this->assertInternalType('array', $result['metadata']);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:7,代码来源:MassActionExtensionTest.php

示例4: getDatagrid

 /**
  * @param string $entityName
  * @param bool   $isAlreadyConfigured
  *
  * @return Datagrid
  */
 protected function getDatagrid($entityName, $isAlreadyConfigured)
 {
     $config = DatagridConfiguration::create(['source' => ['query' => ['from' => [['table' => $entityName]]]]]);
     if ($isAlreadyConfigured) {
         $config['mass_actions'] = ['mass_update' => ['action settings']];
     }
     return new Datagrid('test', $config, new ParameterBag());
 }
开发者ID:trustify,项目名称:oroplatform-mass-update-bundle,代码行数:14,代码来源:GridListenerTest.php

示例5: testSetConfig

 /**
  * Test methods getConfig, setConfig
  */
 public function testSetConfig()
 {
     $this->assertSame($this->config, $this->acceptor->getConfig());
     $newConfig = DatagridConfiguration::create([]);
     $this->acceptor->setConfig($newConfig);
     $this->assertSame($newConfig, $this->acceptor->getConfig());
     $this->assertNotSame($this->config, $this->acceptor->getConfig());
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:AcceptorTest.php

示例6: testOnBuildAfterException

 /**
  * @expectedException \Oro\Bundle\DataGridBundle\Exception\LogicException
  * @expectedExceptionMessage cellSelection options `columnName`, `selector` are required
  */
 public function testOnBuildAfterException()
 {
     $config = DatagridConfiguration::create(['options' => ['cellSelection' => ['dataField' => 'id']]]);
     $this->datagrid->expects($this->once())->method('getDatasource')->will($this->returnValue($this->datasource));
     $this->datagrid->expects($this->once())->method('getConfig')->will($this->returnValue($config));
     $this->event->expects($this->once())->method('getDatagrid')->will($this->returnValue($this->datagrid));
     $this->listener->onBuildAfter($this->event);
 }
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:CellSelectionListenerTest.php

示例7: testDispatchGridConfigEvent

 /**
  * @dataProvider eventDataProvider
  *
  * @param array $config
  * @param array $expectedEvents
  */
 public function testDispatchGridConfigEvent(array $config, array $expectedEvents)
 {
     $config = DatagridConfiguration::create($config);
     foreach ($expectedEvents as $k => $event) {
         $this->realDispatcherMock->expects($this->at($k))->method('dispatch')->with($event);
     }
     $event = new GridConfigEvent($config);
     $this->dispatcher->dispatch(self::TEST_EVENT_NAME, $event);
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:EventDispatcherTest.php

示例8: testOnBuildBeforeAccountGroups

 public function testOnBuildBeforeAccountGroups()
 {
     /** @var \PHPUnit_Framework_MockObject_MockObject|DatagridInterface $datagrid */
     $datagrid = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datagrid\\DatagridInterface');
     $config = DatagridConfiguration::create([]);
     $event = new BuildBefore($datagrid, $config);
     $this->listener->onBuildBeforeAccountGroups($event);
     $this->assertEquals($this->expectedTemplateForAccountGroup, $config->toArray());
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:9,代码来源:DatagridListenerTest.php

示例9: testSetColumnOptions

 public function testSetColumnOptions()
 {
     $container = new ContainerBuilder();
     $datagridGuesser = new DatagridGuesser($container, []);
     $config = DatagridConfiguration::create([]);
     $columnOptions = [DatagridGuesser::FORMATTER => ['formatter_prop' => 'test'], DatagridGuesser::SORTER => ['sorter_prop' => 'test'], DatagridGuesser::FILTER => ['filter_prop' => 'test']];
     $datagridGuesser->setColumnOptions($config, 'testColumn', $columnOptions);
     $this->assertEquals(['columns' => ['testColumn' => ['formatter_prop' => 'test']], 'sorters' => ['columns' => ['testColumn' => ['sorter_prop' => 'test']]], 'filters' => ['columns' => ['testColumn' => ['filter_prop' => 'test']]]], $config->toArray());
 }
开发者ID:Maksold,项目名称:platform,代码行数:9,代码来源:DatagridGuesserTest.php

示例10: testOnPreBuildNotApplicable

 public function testOnPreBuildNotApplicable()
 {
     $gridName = ConfigurationProvider::GRID_PREFIX;
     $config = DatagridConfiguration::create([]);
     $event = new PreBuild($config, new ParameterBag([]));
     $this->marketingListHelper->expects($this->any())->method('getMarketingListIdByGridName')->with($this->equalTo($gridName));
     $this->groupByHelper->expects($this->never())->method('getGroupByFields');
     $this->listener->onPreBuild($event);
 }
开发者ID:antrampa,项目名称:crm,代码行数:9,代码来源:CampaignStatisticGroupingListenerTest.php

示例11: testOnPreBuild

 /**
  * @param string $gridName
  * @param array  $parameters
  * @param array  $select
  * @param string $groupBy
  * @param string $expected
  *
  * @dataProvider preBuildDataProvider
  */
 public function testOnPreBuild($gridName, array $parameters, array $select, $groupBy, $expected)
 {
     $config = DatagridConfiguration::create(['name' => $gridName, 'source' => ['query' => ['select' => $select, 'groupBy' => $groupBy]]]);
     $event = new PreBuild($config, new ParameterBag($parameters));
     $this->segmentHelper->expects($this->any())->method('getSegmentIdByGridName')->with($this->equalTo($gridName))->will($this->returnValue(true));
     $this->segmentHelper->expects($this->any())->method('getMarketingListBySegment')->with($this->equalTo(true))->will($this->returnValue(new \stdClass()));
     $this->listener->onPreBuild($event);
     $this->assertEquals($expected, $config->offsetGetByPath(CampaignStatisticDatagridListener::PATH_GROUPBY));
 }
开发者ID:dairdr,项目名称:crm,代码行数:18,代码来源:CampaignStatisticDatagridListenerTest.php

示例12: testVisitDatasourceNoPagerRestrictions

 /**
  * @param array $config
  * @param int $page
  * @param int $maxPerPage
  * @dataProvider visitDatasourceNoRestrictionsDataProvider
  */
 public function testVisitDatasourceNoPagerRestrictions(array $config, $page, $maxPerPage)
 {
     $this->pager->expects($this->once())->method('setPage')->with($page);
     $this->pager->expects($this->once())->method('setMaxPerPage')->with($maxPerPage);
     /** @var DatasourceInterface $dataSource */
     $dataSource = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datasource\\DatasourceInterface');
     $configObject = DatagridConfiguration::create($config);
     $this->extension->setParameters(new ParameterBag());
     $this->extension->visitDatasource($configObject, $dataSource);
 }
开发者ID:Maksold,项目名称:platform,代码行数:16,代码来源:OrmPagerExtensionTest.php

示例13: testBuildBeforeFrontendItems

 /**
  * @param array $inputData
  * @param array $expectedData
  * @dataProvider buildBeforeFrontendQuotesProvider
  */
 public function testBuildBeforeFrontendItems(array $inputData, array $expectedData)
 {
     $this->securityProvider->expects($this->any())->method('isGrantedViewLocal')->with($this->entityClass)->willReturn($inputData['grantedViewLocal']);
     $this->securityProvider->expects($this->any())->method('isGrantedViewAccountUser')->with($this->entityClass)->willReturn($inputData['grantedViewAccountUser']);
     $this->securityProvider->expects($this->any())->method('getLoggedUser')->willReturn($inputData['user']);
     $datagridConfig = DatagridConfiguration::create($inputData['config']);
     $event = new BuildBefore($this->datagrid, $datagridConfig);
     $this->listener->onBuildBeforeFrontendItems($event);
     $this->assertEquals($expectedData['config'], $datagridConfig->toArray());
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:15,代码来源:AccountDatagridListenerTest.php

示例14: testOnBuildBefore

 public function testOnBuildBefore()
 {
     $entityClassResolver = $this->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\EntityClassResolver')->disableOriginalConstructor()->getMock();
     $entityClassResolver->expects($this->any())->method('getEntityClass')->willReturn('Oro\\Bundle\\TagBundle\\Tests\\Unit\\Fixtures\\Taggable');
     $listener = new TagsGridListener($entityClassResolver);
     $config = DatagridConfiguration::create(['name' => 'test_grid', 'extended_entity_name' => 'Oro\\Bundle\\TagBundle\\Tests\\Unit\\Fixtures\\Taggable', 'source' => ['query' => ['select' => ['t.id'], 'from' => [['table' => 'Oro\\Bundle\\TagBundle\\Tests\\Unit\\Fixtures\\Taggable', 'alias' => 't']]]], 'columns' => ['id' => ['label' => 'id']], 'filters' => ['columns' => ['id' => ['type' => 'string']]]]);
     $datagrid = $this->getMockBuilder('Oro\\Bundle\\DataGridBundle\\Datagrid\\Datagrid')->disableOriginalConstructor()->getMock();
     $event = new BuildBefore($datagrid, $config);
     $listener->onBuildBefore($event);
     $this->assertEquals(['type' => 'tag', 'label' => 'oro.tag.entity_plural_label', 'data_name' => 'tag.id', 'enabled' => false, 'options' => ['field_options' => ['entity_class' => 'Oro\\Bundle\\TagBundle\\Tests\\Unit\\Fixtures\\Taggable']]], $config->offsetGetByPath('[filters][columns][tagname]'));
 }
开发者ID:antrampa,项目名称:platform,代码行数:11,代码来源:TagsGridListenerTest.php

示例15: testEventCreation

 public function testEventCreation()
 {
     $grid = $this->getMockForAbstractClass('Oro\\Bundle\\DataGridBundle\\Datagrid\\DatagridInterface');
     $config = DatagridConfiguration::create([]);
     $event = new BuildBefore($grid, $config);
     $this->assertSame($grid, $event->getDatagrid());
     $this->assertSame($config, $event->getConfig());
     // test config passed as link
     $event->getConfig()->offsetSet(self::TEST_STRING, self::TEST_STRING . 'value');
     $this->assertEquals(self::TEST_STRING . 'value', $config->offsetGet(self::TEST_STRING));
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:BuildBeforeTest.php


注:本文中的Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。