public function setUp() { $admin = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface'); $builder = $this->getMock('Sonata\\AdminBundle\\Builder\\BuilderInterface'); $this->baseGroupedMapper = $this->getMockForAbstractClass('Sonata\\AdminBundle\\Mapper\\BaseGroupedMapper', array($builder, $admin)); $this->baseGroupedMapper->expects($this->any())->method('getTabs')->will($this->returnValue(array())); }
public function setUp() { $admin = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface'); $builder = $this->getMock('Sonata\\AdminBundle\\Builder\\BuilderInterface'); $this->baseGroupedMapper = $this->getMockForAbstractClass('Sonata\\AdminBundle\\Mapper\\BaseGroupedMapper', array($builder, $admin)); // php 5.3 BC $object = $this; $this->tabs = array(); $this->groups = array(); $this->baseGroupedMapper->expects($this->any())->method('getTabs')->will($this->returnCallback(function () use($object) { return $object->getTabs(); })); $this->baseGroupedMapper->expects($this->any())->method('setTabs')->will($this->returnCallback(function (array $tabs) use($object) { $object->setTabs($tabs); })); $this->baseGroupedMapper->expects($this->any())->method('getGroups')->will($this->returnCallback(function () use($object) { return $object->getTestGroups(); })); $this->baseGroupedMapper->expects($this->any())->method('setGroups')->will($this->returnCallback(function (array $groups) use($object) { $object->setTestGroups($groups); })); }