示例#1
0
 public function testWhenIRenderMixedDataCollectionIGetAnHtmlTableWithFormattedData()
 {
     $collection = new Collection(ArrayDataProvider::getBeatlesData());
     $schema = ArrayDataProvider::getBeatlesSchema();
     $grid = $this->getFactory()->createGrid($collection, array('schema' => $schema));
     $html = $this->getTwig()->render('{{ datagrid(grid) }}', array('grid' => $grid));
     $this->assertFixtureEquals(__DIR__ . '/beatles.html', $html);
 }
示例#2
0
 public function testWhenISetupTranslationIGetTranslatedLabels()
 {
     $collection = new Collection(ArrayDataProvider::getBeatlesData());
     $schema = ArrayDataProvider::getBeatlesSchema();
     $grid = $this->getFactory()->createGrid($collection, array('schema' => $schema, 'name' => 'beatles', 'label_trans' => Trans::enable()));
     $html = $this->getTwig('trans.html.twig', array(new TranslationExtension($this->getTranslator(__DIR__))))->render('{{ datagrid(grid) }}', array('grid' => $grid));
     $this->assertFixtureEquals(__DIR__ . '/beatles.html', $html);
 }
示例#3
0
 public function testWhenISetupRouteActionsIGetRouteLinksInTable()
 {
     $collection = new Collection(ArrayDataProvider::getQuarksData());
     $schema = ArrayDataProvider::getQuarksSchema();
     $actions = Actions::enable()->addGlobalRoute('create', 'quarks_create')->addEntityRoute('read', 'quarks_read', array('id' => 'id'))->addEntityRoute('update', 'quarks_update', array('id' => 'id'))->addEntityRoute('delete', 'quarks_delete', array('id' => 'id'));
     $grid = $this->getFactory()->createGrid($collection, array('schema' => $schema, 'actions' => $actions));
     $html = $this->getTwig('router.html.twig', array(new RoutingExtension($this->getRouter(__DIR__, 'routing.yml'))))->render('{{ datagrid(grid) }}', array('grid' => $grid));
     $this->assertFixtureEquals(__DIR__ . '/quarks.html', $html);
 }