public function testHistoryAction() { $this->request->query->set('id', 123); $this->admin->expects($this->once())->method('isGranted')->with($this->equalTo('EDIT'))->will($this->returnValue(true)); $object = new \stdClass(); $this->admin->expects($this->once())->method('getObject')->will($this->returnValue($object)); $this->admin->expects($this->any())->method('getClass')->will($this->returnValue('Foo')); $this->auditManager->expects($this->once())->method('hasReader')->with($this->equalTo('Foo'))->will($this->returnValue(true)); $reader = $this->getMock('Sonata\\AdminBundle\\Model\\AuditReaderInterface'); $this->auditManager->expects($this->once())->method('getReader')->with($this->equalTo('Foo'))->will($this->returnValue($reader)); $reader->expects($this->once())->method('findRevisions')->with($this->equalTo('Foo'), $this->equalTo(123))->will($this->returnValue(array())); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $this->controller->historyAction()); $this->assertSame($this->admin, $this->parameters['admin']); $this->assertSame('SonataAdminBundle::standard_layout.html.twig', $this->parameters['base_template']); $this->assertSame($this->pool, $this->parameters['admin_pool']); $this->assertSame('history', $this->parameters['action']); $this->assertSame(array(), $this->parameters['revisions']); $this->assertSame($object, $this->parameters['object']); $this->assertSame(array(), $this->session->getFlashBag()->all()); $this->assertSame('SonataAdminBundle:CRUD:history.html.twig', $this->template); }