/** * @dataProvider aceTypesProvider */ public function testGetAces($type, $field) { if ($field === null) { $this->acl->expects($this->once())->method('get' . $type . 'Aces')->will($this->returnValue([])); } else { $this->acl->expects($this->once())->method('get' . $type . 'FieldAces')->with($this->equalTo($field))->will($this->returnValue([])); } $this->assertEquals([], $this->manipulator->getAces($this->acl, $type, $field)); }
/** * Gets all ACEs associated with given ACL and the given security identity * * @param SID $sid * @param OID $oid * @param string $type The ACE type. Can be one of self::*_ACE constants * @param string|null $field The name of a field. * Set to null for class-based or object-based ACE * Set to not null class-field-based or object-field-based ACE * @return EntryInterface[] */ protected function doGetAces(SID $sid, OID $oid, $type, $field) { $acl = $this->getAcl($oid); if (!$acl) { return array(); } return array_filter($this->aceProvider->getAces($acl, $type, $field), function ($ace) use(&$sid) { /** @var EntryInterface $ace */ return $sid->equals($ace->getSecurityIdentity()); }); }