public function testGetUrlsafeIdentifier() { $admin = new PostAdmin('sonata.post.admin.post', 'Acme\\NewsBundle\\Entity\\Post', 'SonataNewsBundle:PostAdmin'); $entity = new \stdClass(); $modelManager = $this->getMock('Sonata\\AdminBundle\\Model\\ModelManagerInterface'); $modelManager->expects($this->once())->method('getUrlsafeIdentifier')->with($this->equalTo($entity))->will($this->returnValue('foo')); $admin->setModelManager($modelManager); $this->assertSame('foo', $admin->getUrlsafeIdentifier($entity)); }