You are here

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

Test for the userPropertiesIgnore method.

File

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

Class

OpenIDConnectTest
Provides tests for the OpenID Connect module.

Namespace

Drupal\Tests\openid_connect\Unit

Code

public function testUserPropertiesIgnore() : void {
  $defaultPropertiesIgnore = [
    'uid',
    'uuid',
    'langcode',
    'preferred_langcode',
    'preferred_admin_langcode',
    'name',
    'pass',
    'mail',
    'status',
    'created',
    'changed',
    'access',
    'login',
    'init',
    'roles',
    'default_langcode',
  ];
  $expectedResults = array_combine($defaultPropertiesIgnore, $defaultPropertiesIgnore);
  $this->moduleHandler
    ->expects($this
    ->once())
    ->method('alter')
    ->with('openid_connect_user_properties_ignore', $defaultPropertiesIgnore, []);
  $this->moduleHandler
    ->expects($this
    ->once())
    ->method('alterDeprecated')
    ->with('hook_openid_connect_user_properties_to_skip_alter() is deprecated and will be removed in 8.x-2.0.', 'openid_connect_user_properties_to_skip', $defaultPropertiesIgnore);
  $actualPropertiesIgnored = $this->openIdConnect
    ->userPropertiesIgnore([]);
  $this
    ->assertArrayEquals($expectedResults, $actualPropertiesIgnored);
}