You are here

public function LTIToolProviderTest::appliesProvider in LTI Tool Provider 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/LTIToolProviderTest.php \Drupal\Tests\lti_tool_provider\Unit\LTIToolProviderTest::appliesProvider()

Request Provider.

File

tests/src/Unit/LTIToolProviderTest.php, line 126

Class

LTIToolProviderTest
LTIToolProvider unit tests.

Namespace

Drupal\Tests\lti_tool_provider\Unit

Code

public function appliesProvider() : array {
  return [
    'empty request' => [
      false,
      Request::create('/lti', 'POST', []),
    ],
    'get request' => [
      false,
      Request::create('/lti', 'GET', [
        'oauth_consumer_key' => 'oauth_consumer_key',
        'lti_message_type' => 'basic-lti-launch-request',
        'lti_version' => 'LTI-1p0',
        'resource_link_id' => 'resource_link_id',
      ]),
    ],
    'LTI-1p0 request' => [
      true,
      Request::create('/lti', 'POST', [
        'oauth_consumer_key' => 'oauth_consumer_key',
        'lti_message_type' => 'basic-lti-launch-request',
        'lti_version' => 'LTI-1p0',
        'resource_link_id' => 'resource_link_id',
      ]),
    ],
    'LTI-1p2 request' => [
      true,
      Request::create('/lti', 'POST', [
        'oauth_consumer_key' => 'oauth_consumer_key',
        'lti_message_type' => 'basic-lti-launch-request',
        'lti_version' => 'LTI-1p2',
        'resource_link_id' => 'resource_link_id',
      ]),
    ],
    'missing resource link request' => [
      false,
      Request::create('/lti', 'POST', [
        'oauth_consumer_key' => 'oauth_consumer_key',
        'lti_message_type' => 'basic-lti-launch-request',
        'lti_version' => 'LTI-1p0',
      ]),
    ],
    'empty resource link request' => [
      false,
      Request::create('/lti', 'POST', [
        'oauth_consumer_key' => 'oauth_consumer_key',
        'lti_message_type' => 'basic-lti-launch-request',
        'lti_version' => 'LTI-1p0',
        'resource_link_id' => '',
      ]),
    ],
    'missing oauth consumer key request' => [
      false,
      Request::create('/lti', 'POST', [
        'lti_message_type' => 'basic-lti-launch-request',
        'lti_version' => 'LTI-1p0',
        'resource_link_id' => 'resource_link_id',
      ]),
    ],
    'empty oauth_consumer_key request' => [
      false,
      Request::create('/lti', 'POST', [
        'oauth_consumer_key' => '',
        'lti_message_type' => 'basic-lti-launch-request',
        'lti_version' => 'LTI-1p0',
        'resource_link_id' => 'resource_link_id',
      ]),
    ],
  ];
}