當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。