Exemple #1
0
 /**
  * @dataProvider renderProvider
  */
 public function testRenderColumnSorting($gridTemplate = null, $rendererTemplate = null)
 {
     $template = 'column_sorting';
     if ($rendererTemplate !== null) {
         $this->renderer = new Renderer($this->twig, $this->actionRenderer, $this->columnRenderer, $this->sorterRenderer, [$template => $rendererTemplate]);
     }
     $view = $this->createGridViewMock();
     $view->expects($this->once())->method('getDefinition')->will($this->returnValue($grid = $this->createGridMock()));
     $grid->expects($this->once())->method('hasOption')->with($this->identicalTo($option = $template . '_template'))->will($this->returnValue($gridTemplate !== null));
     $grid->expects($gridTemplate !== null ? $this->once() : $this->never())->method('getOption')->with($this->identicalTo($option))->will($this->returnValue($gridTemplate));
     $this->sorterRenderer->expects($this->once())->method('render')->with($this->identicalTo($view), $this->identicalTo($column = $this->createColumnMock()), $this->identicalTo($sorting = SorterInterface::ASC))->will($this->returnValue($value = 'value'));
     $this->twig->expects($this->once())->method('render')->with($this->identicalTo($gridTemplate ?: ($rendererTemplate ?: '@LugGrid/' . $template . '.html.twig')), $this->identicalTo(['column' => $column, 'sorting' => $sorting, 'label' => 'lug.sorting.' . strtolower($sorting), 'value' => $value, 'grid' => $view]))->will($this->returnValue($result = 'result'));
     $this->assertSame($result, $this->renderer->renderColumnSorting($view, $column, $sorting));
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function renderColumnSorting(GridViewInterface $grid, ColumnInterface $column, $sorting)
 {
     return $this->doRender($grid, 'column_sorting', ['column' => $column, 'sorting' => $sorting, 'label' => 'lug.sorting.' . strtolower($sorting), 'value' => $this->sorterRenderer->render($grid, $column, $sorting)]);
 }