public function testGetFilterParameters() { $authorId = uniqid(); $postAdmin = new PostAdmin('sonata.post.admin.post', 'Application\\Sonata\\NewsBundle\\Entity\\Post', 'SonataNewsBundle:PostAdmin'); $commentAdmin = new CommentAdmin('sonata.post.admin.comment', 'Application\\Sonata\\NewsBundle\\Entity\\Comment', 'SonataNewsBundle:CommentAdmin'); $commentAdmin->setParentAssociationMapping('post.author'); $commentAdmin->setParent($postAdmin); $request = $this->getMock('Symfony\\Component\\HttpFoundation\\Request', array('get')); $request->expects($this->any())->method('get')->will($this->returnValue($authorId)); $commentAdmin->setRequest($request); $modelManager = $this->getMock('Sonata\\AdminBundle\\Model\\ModelManagerInterface'); $modelManager->expects($this->any())->method('getDefaultSortValues')->will($this->returnValue(array())); $commentAdmin->setModelManager($modelManager); $parameters = $commentAdmin->getFilterParameters(); $this->assertTrue(isset($parameters['post__author'])); $this->assertSame(array('value' => $authorId), $parameters['post__author']); }