public function findAllFor($userId)
 {
     Assert::string($userId, 'User ID "%s" expected to be string, type %s given.');
     Assert::notEmpty($userId, 'User ID "%s" is empty, but non empty value was expected.');
     $consentListJson = $this->apiClient->read('consent/%s', [$userId]);
     return ConsentListFactory::createListFromMetadata($consentListJson);
 }
 /**
  * @test
  * @group Consent
  */
 public function it_can_create_a_consent_list()
 {
     $firstEntityId = 'http://profile.vm.openconext.invalid/authentication/metadata';
     $secondEntityId = 'https://serviceregistry.vm.openconext.invalid/simplesaml/module.php/saml/sp/metadata.php/default-sp';
     $firstEula = 'https://domain.invalid';
     $secondSupportEmail = '*****@*****.**';
     $givenFirstConsentTypeValue = 'explicit';
     $expectedFirstConsentType = ConsentType::explicit();
     $givenSecondConsentTypeValue = 'implicit';
     $expectedSecondConsentType = ConsentType::implicit();
     $given = [['service_provider' => ['entity_id' => $firstEntityId, 'display_name' => ['en' => '', 'nl' => ''], 'eula_url' => $firstEula, 'support_email' => null], 'consent_given_on' => '2015-11-05T08:43:01+01:00', 'last_used_on' => '2015-11-05T08:43:01+01:00', 'consent_type' => $givenFirstConsentTypeValue], ['service_provider' => ['entity_id' => $secondEntityId, 'display_name' => ['en' => 'OpenConext ServiceRegistry', 'nl' => 'OpenConext ServiceRegistry'], 'eula_url' => null, 'support_email' => $secondSupportEmail], 'consent_given_on' => '2015-11-05T08:17:04+01:00', 'last_used_on' => '2015-11-05T08:17:04+01:00', 'consent_type' => $givenSecondConsentTypeValue]];
     $expectedConsentList = new ConsentList([new Consent(new ServiceProvider(new Entity(new EntityId($firstEntityId), EntityType::SP()), new DisplayName(['nl' => '', 'en' => '']), new Url($firstEula), null), new DateTimeImmutable('2015-11-05T08:43:01+01:00'), new DateTimeImmutable('2015-11-05T08:43:01+01:00'), $expectedFirstConsentType), new Consent(new ServiceProvider(new Entity(new EntityId($secondEntityId), EntityType::SP()), new DisplayName(['nl' => 'OpenConext ServiceRegistry', 'en' => 'OpenConext ServiceRegistry']), null, new ContactEmailAddress($secondSupportEmail)), new DateTimeImmutable('2015-11-05T08:17:04+01:00'), new DateTimeImmutable('2015-11-05T08:17:04+01:00'), $expectedSecondConsentType)]);
     $this->assertEquals($expectedConsentList, ConsentListFactory::createListFromMetadata($given));
 }