public function testRemoveByIds() { $object1 = new Dummy(); $object1->setField1('test1'); $object2 = new Dummy(); $object2->setField1('test2'); $ids = array(1, 2); $manager = $this->getMockBuilder('Lyra\\AdminBundle\\Model\\ORM\\ModelManager')->setConstructorArgs(array($this->em, $this->configuration))->setMethods(array('findByIds'))->getMock(); $manager->expects($this->once())->method('findByIds')->with($ids)->will($this->returnValue(array($object1, $object2))); $this->em->expects($this->at(0))->method('remove')->with($object1); $this->em->expects($this->at(1))->method('remove')->with($object2); $manager->removeByIds($ids); }
public function testGetValueWithFormat() { $column = new Column('test'); $column->setMethods(array('getField1')); $column->setType('date'); $column->setFormat('F d Y'); $object = new Dummy(); $object->setField1(new \DateTime('21-12-2012')); $this->assertEquals('December 21 2012', $column->getValue($object)); $column->setType('float'); $column->setFormat('%.2f'); $object = new Dummy(); $object->setField1(1.227); $this->assertEquals(1.23, $column->getValue($object)); }