public function LTIToolProviderTest::testTimestampNonceHandlerTooNew in LTI Tool Provider 2.x
Same name and namespace in other branches
- 8 tests/src/Unit/LTIToolProviderTest.php \Drupal\Tests\lti_tool_provider\Unit\LTIToolProviderTest::testTimestampNonceHandlerTooNew()
Tests a nonce timestamp that is too new.
@covers ::timestampNonceHandler @covers ::__construct
File
- tests/
src/ Unit/ LTIToolProviderTest.php, line 348
Class
- LTIToolProviderTest
- LTIToolProvider unit tests.
Namespace
Drupal\Tests\lti_tool_provider\UnitCode
public function testTimestampNonceHandlerTooNew() {
$provider = new LTIToolProvider($this->configFactory, $this->entityTypeManager, $this->loggerFactory, $this->eventDispatcher);
$this->provider->consumer_key = '';
$this->provider->nonce = uniqid();
$this->provider->timestamp = time() + LTI_TOOL_PROVIDER_NONCE_INTERVAL + 10;
$expected = OAUTH_BAD_TIMESTAMP;
$actual = $provider
->timestampNonceHandler($this->provider);
$this
->assertEquals($expected, $actual);
}