You are here

public function OpenIDConnectTest::dataProviderForCompleteAuthorization in OpenID Connect / OAuth client 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/OpenIDConnectTest.php \Drupal\Tests\openid_connect\Unit\OpenIDConnectTest::dataProviderForCompleteAuthorization()

Data provider for the testCompleteAuthorization() method.

Return value

array|array[] Test parameters to pass to testCompleteAuthorization().

File

tests/src/Unit/OpenIDConnectTest.php, line 914

Class

OpenIDConnectTest
Provides tests for the OpenID Connect module.

Namespace

Drupal\Tests\openid_connect\Unit

Code

public function dataProviderForCompleteAuthorization() : array {
  $tokens = [
    "id_token" => $this
      ->randomMachineName(),
    "access_token" => $this
      ->randomMachineName(),
  ];
  return [
    [
      TRUE,
      '',
      [],
      [],
      [],
      FALSE,
      TRUE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [],
      FALSE,
      TRUE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => '',
      ],
      FALSE,
      TRUE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'test@test.com',
        'sub' => $this
          ->randomMachineName(),
      ],
      FALSE,
      TRUE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'test@test.com',
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      TRUE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'invalid',
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'duplicate@valid.com',
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'connect@valid.com',
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'connect@valid.com',
        'blocked' => TRUE,
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'connect@valid.com',
        'blocked' => TRUE,
        'sub' => 'TESTING',
      ],
      TRUE,
      TRUE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'connect@valid.com',
        'newAccount' => TRUE,
        'register' => 'admin_only',
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'connect@valid.com',
        'newAccount' => TRUE,
        'register' => 'visitors',
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'connect@valid.com',
        'newAccount' => TRUE,
        'register' => 'visitors_admin_approval',
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
    [
      FALSE,
      '',
      $tokens,
      [],
      [
        'email' => 'connect@valid.com',
        'newAccount' => TRUE,
        'register' => 'admin_only',
        'registerOverride' => TRUE,
        'sub' => $this
          ->randomMachineName(),
      ],
      TRUE,
      FALSE,
    ],
  ];
}