You are here

public function AuthmapTest::testGetAll in External Authentication 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/AuthmapTest.php \Drupal\Tests\externalauth\Unit\AuthmapTest::testGetAll()

Test getAll() method.

@covers ::getAll @covers ::__construct

File

tests/src/Unit/AuthmapTest.php, line 183

Class

AuthmapTest
Authmap unit tests.

Namespace

Drupal\Tests\externalauth\Unit

Code

public function testGetAll() {
  $actual_data = [
    'test_provider' => (object) [
      "authname" => "test_authname",
      "provider" => "test_provider",
    ],
    'test_provider2' => (object) [
      "authname" => "test_authname2",
      "provider" => "test_provider2",
    ],
  ];
  $this->statement
    ->expects($this
    ->any())
    ->method('fetchAllAssoc')
    ->will($this
    ->returnValue($actual_data));
  $authmap = new Authmap($this->connection);
  $result = $authmap
    ->getAll(2);
  $expected_data = [
    "test_provider" => "test_authname",
    "test_provider2" => "test_authname2",
  ];
  $this
    ->assertEquals($expected_data, $result);
}