You are here

public function SimplesamlphpAuthManagerTest::testAllowUserByAttribute in simpleSAMLphp Authentication 8.3

Tests allowUserByAttribute() method.

@covers ::__construct @covers ::allowUserByAttribute

File

tests/src/Unit/Service/SimplesamlphpAuthManagerTest.php, line 295

Class

SimplesamlphpAuthManagerTest
SimplesamlphpAuthManager unit tests.

Namespace

Drupal\Tests\simplesamlphp_auth\Unit\Service

Code

public function testAllowUserByAttribute() {
  $data = [
    'uid' => [
      'ext_user_123',
    ],
    'name' => [
      'External User',
    ],
    'mail' => [
      'ext_user_123@example.com',
    ],
    'roles' => [
      [
        'employee',
        'webmaster',
      ],
    ],
  ];

  // Set expectations for instance.
  $this->instance
    ->expects($this
    ->any())
    ->method('getAttributes')
    ->will($this
    ->returnValue($data));

  // Test allowUserByAttribute method.
  $simplesaml = $this
    ->getManagerInContext();
  $this
    ->assertTrue($simplesaml
    ->allowUserByAttribute());
}