public function testSetTraverserWithInterface() { $traverser = new ResourceGraphTraverserDispatcher(); $resource = $this->getMockForAbstractClass('MyCLabs\\ACL\\Model\\ResourceInterface'); $subTraverser = $this->getMockForAbstractClass('\\MyCLabs\\ACL\\ResourceGraph\\ResourceGraphTraverser'); // Set the traverser by passing the interface (and not the concrete class) $traverser->setResourceGraphTraverser('MyCLabs\\ACL\\Model\\ResourceInterface', $subTraverser); // Check that the $subTraverser is indeed called $subTraverser->expects($this->once())->method('getAllParentResources')->with($resource); $traverser->getAllParentResources($resource); }
/** * @param string $entityClass * @param ResourceGraphTraverser $resourceGraphTraverser */ public function setResourceGraphTraverser($entityClass, $resourceGraphTraverser) { $this->resourceGraphTraverser->setResourceGraphTraverser($entityClass, $resourceGraphTraverser); }