/** * Set the owner of the ACP policy * * @param Grantee $owner ACP policy owner * * @return $this * * @throws InvalidArgumentException if the grantee does not have an ID set */ public function setOwner(Grantee $owner) { if (!$owner->isCanonicalUser()) { throw new InvalidArgumentException('The owner must have an ID set.'); } $this->owner = $owner; return $this; }
public function testCanConvertToArray() { $grantee = new Grantee('*****@*****.**'); $this->assertEquals(array('Type' => 'AmazonCustomerByEmail', 'EmailAddress' => '*****@*****.**'), $grantee->toArray()); $grantee = new Grantee('12345'); $this->assertEquals(array('Type' => 'CanonicalUser', 'ID' => '12345', 'DisplayName' => '12345'), $grantee->toArray()); $grantee = new Grantee(Group::ALL_USERS); $this->assertEquals(array('Type' => 'Group', 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers'), $grantee->toArray()); }