public function test_get_first_proxy_restriction() { $conditions = new Conditions(); $conditions->addItem(new AudienceRestriction()); $conditions->addItem($expected = new ProxyRestriction()); $conditions->addItem(new OneTimeUse()); $conditions->addItem(new ProxyRestriction()); $conditions->addItem(new AudienceRestriction()); $actual = $conditions->getFirstProxyRestriction(); $this->assertSame($expected, $actual); }
/** * @param AssertionContext $context * * @return void */ protected function doExecute(AssertionContext $context) { $partyEntityDescriptor = $context->getProfileContext()->getPartyEntityDescriptor(); $conditions = new Conditions(); $conditions->setNotBefore($this->timeProvider->getTimestamp()); $conditions->setNotOnOrAfter($conditions->getNotBeforeTimestamp() + $this->expirationSeconds); $audienceRestriction = new AudienceRestriction(array($partyEntityDescriptor->getEntityID())); $conditions->addItem($audienceRestriction); $context->getAssertion()->setConditions($conditions); }