public function testReorderListWithBatchField() { $collection = new FieldDescriptionCollection(); $fieldDescription = $this->getMock('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface'); $fieldDescription->expects($this->once())->method('getName')->will($this->returnValue('title')); $collection->add($fieldDescription); $fieldDescription = $this->getMock('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface'); $fieldDescription->expects($this->once())->method('getName')->will($this->returnValue('position')); $collection->add($fieldDescription); $fieldDescription = $this->getMock('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface'); $fieldDescription->expects($this->once())->method('getName')->will($this->returnValue('batch')); $collection->add($fieldDescription); $newOrder = array('position', 'title'); $collection->reorder($newOrder); array_unshift($newOrder, 'batch'); $actualElements = array_keys($collection->getElements()); $this->assertSame($newOrder, $actualElements, 'the order is wrong'); }
/** * {@inheritdoc} */ public function reorder(array $keys) { $this->list->reorder($keys); return $this; }