public function testActionLinksWithDefaultConfig()
 {
     $field = new FieldDescription();
     $field->setName('_action');
     $field->setOption('actions', array('show' => array(), 'edit' => array()));
     $builder = new ListBuilder($this->typeGuesser);
     $builder->addField($this->list, 'actions', $field, $this->admin);
     $this->assertSame('SonataAdminBundle:CRUD:list__action.html.twig', $field->getTemplate());
     $this->assertSame('Action', $field->getOption('name'));
     $this->assertSame('Action', $field->getOption('code'));
     $this->assertSame(array('show' => array('template' => 'SonataAdminBundle:CRUD:list__action_show.html.twig'), 'edit' => array('template' => 'SonataAdminBundle:CRUD:list__action_edit.html.twig')), $field->getOption('actions'));
 }
 public function testGetValue()
 {
     $mockedObject = $this->getMock('MockedTestObject', array('myMethod'));
     $mockedObject->expects($this->once())->method('myMethod')->will($this->returnValue('myMethodValue'));
     $field = new FieldDescription();
     $field->setOption('code', 'myMethod');
     $this->assertEquals($field->getValue($mockedObject), 'myMethodValue');
 }
 public function testGetSortParametersProvider()
 {
     $field = new FieldDescription();
     $field->setName('slug');
     $slugSortField = new FieldDescription();
     $slugSortField->setName('slug');
     $slugSortFieldWithSortable = new FieldDescription();
     $slugSortFieldWithSortable->setName('SuperSlug');
     $slugSortFieldWithSortable->setOption('sortable', 'slug');
     $titleSortField = new FieldDescription();
     $titleSortField->setName('title');
     return array(array($field, array('_sort_by' => $slugSortField, '_sort_order' => 'ASC'), array('_sort_by' => 'slug', '_sort_order' => 'DESC')), array($field, array('_sort_by' => $slugSortField, '_sort_order' => 'DESC'), array('_sort_by' => 'slug', '_sort_order' => 'ASC')), array($field, array('_sort_by' => $titleSortField, '_sort_order' => 'ASC'), array('_sort_by' => 'slug', '_sort_order' => 'ASC')), array($field, array('_sort_by' => $slugSortFieldWithSortable, '_sort_order' => 'DESC'), array('_sort_by' => 'slug', '_sort_order' => 'ASC')));
 }