You are here

public function OpenIDConnectTest::dataProviderForConnectCurrentUser 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::dataProviderForConnectCurrentUser()

Data provider for the testConnectCurrentUser method.

Return value

array|array[] Array of parameters to pass to testConnectCurrentUser().

File

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

Class

OpenIDConnectTest
Provides tests for the OpenID Connect module.

Namespace

Drupal\Tests\openid_connect\Unit

Code

public function dataProviderForConnectCurrentUser() : array {
  return [
    [
      FALSE,
      [],
      [],
      [],
      FALSE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [],
      [],
      FALSE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [],
      [
        'email' => FALSE,
      ],
      FALSE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'invalid',
      ],
      [
        'email' => 'valid@email.com',
      ],
      FALSE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'different_account',
      ],
      [
        'email' => 'valid@email.com',
      ],
      FALSE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => FALSE,
      ],
      [
        'email' => 'valid@email.com',
      ],
      TRUE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => TRUE,
      ],
      [
        'email' => 'valid@email.com',
        'name' => $this
          ->randomMachineName(),
      ],
      TRUE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => TRUE,
      ],
      [
        'name' => $this
          ->randomMachineName(),
        'field_string' => 'This is a string',
        'email' => 'valid@email.com',
      ],
      TRUE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => TRUE,
      ],
      [
        'field_string_long' => 'This is long text.',
        'email' => 'valid@email.com',
        'name' => $this
          ->randomMachineName(),
      ],
      TRUE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => TRUE,
      ],
      [
        'field_datetime' => '2020-05-20',
        'email' => 'valid@email.com',
        'name' => $this
          ->randomMachineName(),
      ],
      TRUE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => TRUE,
      ],
      [
        'name' => $this
          ->randomMachineName(),
        'field_image' => realpath(__DIR__) . '/image.png',
        'email' => 'valid@email.com',
      ],
      TRUE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => TRUE,
      ],
      [
        'name' => $this
          ->randomMachineName(),
        'field_invalid' => 'does_not_exist',
        'email' => 'valid@email.com',
      ],
      TRUE,
    ],
    [
      TRUE,
      [
        'id_token' => $this
          ->randomMachineName(),
        'access_token' => $this
          ->randomMachineName(),
      ],
      [
        'sub' => 'no_account',
        'always_save' => TRUE,
      ],
      [
        'name' => $this
          ->randomMachineName(),
        'field_image_exception' => new \stdClass(),
        'email' => 'valid@email.com',
      ],
      TRUE,
    ],
  ];
}