You are here

public function EntityCollectorTest::testCollectForClient in Simple OAuth (OAuth2) & OpenID Connect 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/EntityCollectorTest.php \Drupal\Tests\simple_oauth\Unit\EntityCollectorTest::testCollectForClient()
  2. 8.2 tests/src/Unit/EntityCollectorTest.php \Drupal\Tests\simple_oauth\Unit\EntityCollectorTest::testCollectForClient()
  3. 5.x tests/src/Unit/EntityCollectorTest.php \Drupal\Tests\simple_oauth\Unit\EntityCollectorTest::testCollectForClient()

@covers ::collectForClient

File

tests/src/Unit/EntityCollectorTest.php, line 35

Class

EntityCollectorTest
@coversDefaultClass \Drupal\simple_oauth\ExpiredCollector @group simple_oauth

Namespace

Drupal\Tests\simple_oauth\Unit

Code

public function testCollectForClient() {
  list($expired_collector, $query, ) = $this
    ->buildProphecies();
  $client = $this
    ->prophesize(Consumer::class);
  $client
    ->id()
    ->willReturn(35);
  $query
    ->condition('client', 35)
    ->shouldBeCalledTimes(1);
  $tokens = $expired_collector
    ->collectForClient($client
    ->reveal());
  $this
    ->assertArrayEquals([
    1,
    52,
  ], array_map(function ($entity) {
    return $entity
      ->id();
  }, $tokens));
}