/** * @test */ public function keys_exists_assertion_succeeds_if_all_required_keys_are_present_() { $requiredKeys = array('a', 'b', 'c'); $match = array('c' => 1, 'a' => 2, 'b' => 'foo'); $superfluous = array('d' => 1, 'a' => 2, 'c' => 3, 'b' => 4); $exceptionCaught = false; try { Assertion::keysExist($match, $requiredKeys); Assertion::keysExist($superfluous, $requiredKeys); } catch (InvalidArgumentException $exception) { $exceptionCaught = true; } $this->assertFalse($exceptionCaught, 'When all required keys are present, no exception should be thrown'); }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('endpoint', 'index', 'is_default')); return new self(Endpoint::deserialize($data['endpoint']), $data['index'], $data['is_default']); }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('name', 'language')); return new self($data['name'], $data['language']); }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('is_regexp', 'scope')); return new self($data['scope'], $data['is_regexp']); }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('organization_names', 'organization_display_names', 'organization_urls')); return new self(OrganizationNameList::deserialize($data['organization_names']), OrganizationDisplayNameList::deserialize($data['organization_display_names']), OrganizationUrlList::deserialize($data['organization_urls'])); }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('binding', 'location', 'response_location')); return new self(Binding::deserialize($data['binding']), $data['location'], $data['response_location']); }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('contact_type', 'email_address_list', 'telephone_number_list', 'given_name', 'surname', 'company')); $contact = new self(ContactType::deserialize($data['contact_type']), EmailAddressList::deserialize($data['email_address_list']), TelephoneNumberList::deserialize($data['telephone_number_list'])); if ($data['given_name']) { $contact->givenName = GivenName::deserialize($data['given_name']); } if ($data['surname']) { $contact->surname = Surname::deserialize($data['surname']); } if ($data['company']) { $contact->company = Company::deserialize($data['company']); } return $contact; }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('entity_id', 'entity_type')); return new self(EntityId::deserialize($data['entity_id']), EntityType::deserialize($data['entity_type'])); }