You are here

protected function LTIAuthTest::setUp in LTI Tool Provider 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/LTIAuthTest.php \Drupal\Tests\lti_tool_provider\Functional\LTIAuthTest::setUp()

Throws

EntityStorageException

Overrides BrowserTestBase::setUp

File

tests/src/Functional/LTIAuthTest.php, line 61

Class

LTIAuthTest
Functional tests for LTI authentication.

Namespace

Drupal\Tests\lti_tool_provider\Functional

Code

protected function setUp() : void {
  parent::setUp();
  if (!class_exists('\\Oauth')) {
    $this
      ->markTestSkipped('Missing OAuth PECL extension, skipping test.');
  }
  $this->userStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('user');
  $this->consumerStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('lti_tool_provider_consumer');
  $this->nonceStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('lti_tool_provider_nonce');
  $this->consumer = $this->consumerStorage
    ->create([
    'consumer' => 'consumer',
    'consumer_key' => 'consumer_key',
    'consumer_secret' => 'consumer_secret',
    'name' => 'lis_person_contact_email_primary',
    'mail' => 'lis_person_contact_email_primary',
  ]);
  $this->consumer
    ->save();
}