Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
 public function testWhenISetupTranslationIGetTranslatedActionLabels()
 {
     $collection = new Collection(ArrayDataProvider::getBeatlesData());
     $schema = ArrayDataProvider::getBeatlesSchema();
     $actions = Actions::enable()->addGlobalUrl('create', '/beatles/create')->addEntityUrl('read', '/beatles/read/{slug}')->addEntityUrl('update', '/beatles/update/{slug}')->addEntityUrl('delete', '/beatles/delete/{slug}');
     $grid = $this->getFactory()->createGrid($collection, array('schema' => $schema, 'actions' => $actions, 'name' => 'beatles', 'actions_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);
 }