Ejemplo n.º 1
0
 function it_should_override_default_sorts_with_requested_sorts(AbstractQuery $query, IndexDefinitionInterface $indexDefinition, Request $request, TemplateDefinitionInterface $templateDefinition, ColumnInterface $sortColumn, SlidingPagination $pagination)
 {
     $request->get('direction', Argument::any())->willReturn('asc');
     $request->get('sort', Argument::any())->willReturn('another_field');
     $request->get('page', Argument::any())->willReturn(1);
     $indexDefinition->getDefaultSortColumn()->willReturn($sortColumn);
     $indexDefinition->getDefaultSortDirection()->willReturn(IndexDefinitionInterface::SORT_ASC);
     $sortColumn->getField()->willReturn('sortable_field');
     $indexDefinition->hasColumnWithField('another_field')->willReturn(true);
     $templateDefinition->getPagination()->shouldBeCalled();
     $templateDefinition->getSortable()->shouldBeCalled();
     $pagination->setParam('sort', Argument::any())->shouldBeCalledTimes(2);
     $pagination->setParam('direction', Argument::any())->shouldBeCalledTimes(2);
     $this->getGrid($query, $indexDefinition, $request)->shouldReturnAnInstanceOf('Knp\\Component\\Pager\\Pagination\\PaginationInterface');
 }