예제 #1
0
 public function test_calls_validator()
 {
     $action = new TimeValidatorAction($loggerMock = TestHelper::getLoggerMock($this), $validatorMock = TestHelper::getAssertionTimeValidatorMock($this), $timeProviderMock = TestHelper::getTimeProviderMock($this), $allowedSkew = 120);
     $context = TestHelper::getAssertionContext($assertion = new Assertion());
     $timeProviderMock->expects($this->once())->method('getTimestamp')->willReturn($timestamp = 123123123);
     $validatorMock->expects($this->once())->method('validateTimeRestrictions')->with($assertion, $timestamp, $allowedSkew);
     $action->execute($context);
 }
 public function test_sets_outbounding_message_issue_instant_to_value_from_time_provider()
 {
     $action = new MessageIssueInstantAction(TestHelper::getLoggerMock($this), $timeProviderMock = TestHelper::getTimeProviderMock($this));
     $timeProviderMock->expects($this->any())->method('getTimestamp')->willReturn(1412399250);
     $context = TestHelper::getProfileContext();
     $context->getOutboundContext()->setMessage($message = new AuthnRequest());
     $action->execute($context);
     $this->assertEquals('2014-10-04T05:07:30Z', $message->getIssueInstantString());
 }