コード例 #1
0
ファイル: AdminTest.php プロジェクト: drmjo/SonataAdminBundle
 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));
 }