public function testGenerate()
 {
     $data = 'string';
     $tags = ['string_tag'];
     $this->service->expects($this->once())->method('generate')->with($this->equalTo($data), $this->equalTo(false))->will($this->returnValue($tags));
     $this->assertSame($tags, $this->extension->generate($data), 'Should return exact value from service');
 }
 public function testBuildAfter()
 {
     $config = DatagridConfiguration::createNamed(self::TEST_GRID_NAME, []);
     $acceptor = new Acceptor();
     $acceptor->setConfig($config);
     $parameters = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datagrid\\ParameterBag');
     $grid = new Datagrid(self::TEST_GRID_NAME, $config, $parameters);
     $grid->setAcceptor($acceptor);
     $qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->getMock();
     $qb->expects($this->once())->method('getDQLPart')->with($this->equalTo('from'))->will($this->returnValue([new From(self::TEST_ENTITY_NAME, 'alias')]));
     $datasourceMock = $this->getMockBuilder('Oro\\Bundle\\DataGridBundle\\Datasource\\Orm\\OrmDatasource')->disableOriginalConstructor()->getMock();
     $datasourceMock->expects($this->any())->method('getQueryBuilder')->will($this->returnValue($qb));
     $this->generator->expects($this->once())->method('generate')->with(self::TEST_ENTITY_NAME)->will($this->returnValue([]));
     $grid->setDatasource($datasourceMock);
     $event = new BuildAfter($grid);
     $this->listener->buildAfter($event);
     $this->assertContains('oronavigation/js/content/grid-builder', $config->offsetGetByPath(sprintf('%s[%s]', ToolbarExtension::OPTIONS_PATH, MetadataObject::REQUIRED_MODULES_KEY)), 'Should add require js module');
 }