You are here

public function SimplesamlphpAuthManagerTest::testAttributesException in simpleSAMLphp Authentication 8.3

Tests attribute assignment logic throwing exceptions.

@covers ::__construct @covers ::getAttribute

File

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

Class

SimplesamlphpAuthManagerTest
SimplesamlphpAuthManager unit tests.

Namespace

Drupal\Tests\simplesamlphp_auth\Unit\Service

Code

public function testAttributesException() {
  $this
    ->expectException(SimplesamlphpAttributeException::class);
  $this
    ->expectExceptionMessage('Error in simplesamlphp_auth.module: no valid "name" attribute set.');

  // Set expectations for instance.
  $this->instance
    ->expects($this
    ->any())
    ->method('getAttributes')
    ->will($this
    ->returnValue([
    'uid' => [
      'ext_user_123',
    ],
  ]));
  $simplesaml = $this
    ->getManagerInContext();
  $simplesaml
    ->getAttribute('name');
}