protected function setUp()
 {
     $this->doctrine = $this->getDoctrine([self::TEST_ENTITY => []], [self::TEST_ENTITY => [self::TEST_IDENTIFIER_NAME]]);
     $this->configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $builder = new SegmentDatagridConfigurationBuilder($this->getFunctionProvider(), $this->getVirtualFieldProvider(), $this->doctrine, new DatagridGuesserMock());
     $builder->setConfigManager($this->configManager);
     $this->provider = new ConfigurationProvider($builder, $this->doctrine);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function getConfiguration($gridName)
 {
     if (empty($this->configuration[$gridName])) {
         $id = intval(substr($gridName, strlen(Segment::GRID_PREFIX)));
         $segmentRepository = $this->doctrine->getRepository('OroSegmentBundle:Segment');
         $segment = $segmentRepository->find($id);
         $this->builder->setGridName($gridName);
         $this->builder->setSource($segment);
         $this->configuration[$gridName] = $this->builder->getConfiguration();
     }
     return $this->configuration[$gridName];
 }
 /**
  * Test grid definition when no route exists for entity in config
  * no grid actions should be added
  */
 public function testNoRouteConfiguration()
 {
     $segment = $this->getSegment();
     $doctrine = $this->getDoctrine([self::TEST_ENTITY => ['userName' => 'string']], [self::TEST_ENTITY => [self::TEST_IDENTIFIER_NAME]]);
     $configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $builder = new SegmentDatagridConfigurationBuilder($this->getFunctionProvider(), $this->getVirtualFieldProvider(), $doctrine, new DatagridGuesserMock());
     $builder->setConfigManager($configManager);
     $builder->setGridName(self::TEST_GRID_NAME);
     $builder->setSource($segment);
     $result = $builder->getConfiguration()->toArray();
     $expected = $this->getExpectedDefinition();
     $this->assertEquals($expected, $result);
 }