protected function EntityCollectorTest::buildProphecies in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 8.2 tests/src/Unit/EntityCollectorTest.php \Drupal\Tests\simple_oauth\Unit\EntityCollectorTest::buildProphecies()
- 8.3 tests/src/Unit/EntityCollectorTest.php \Drupal\Tests\simple_oauth\Unit\EntityCollectorTest::buildProphecies()
- 5.x tests/src/Unit/EntityCollectorTest.php \Drupal\Tests\simple_oauth\Unit\EntityCollectorTest::buildProphecies()
Builds prophecies for the tests.
Return value
\Prophecy\Prophecy\ProphecyInterface[] The prophecies.
4 calls to EntityCollectorTest::buildProphecies()
- EntityCollectorTest::testCollect in tests/
src/ Unit/ EntityCollectorTest.php - @covers ::collect
- EntityCollectorTest::testCollectForAccount in tests/
src/ Unit/ EntityCollectorTest.php - @covers ::collectForAccount
- EntityCollectorTest::testCollectForClient in tests/
src/ Unit/ EntityCollectorTest.php - @covers ::collectForClient
- EntityCollectorTest::testDeleteMultipleTokens in tests/
src/ Unit/ EntityCollectorTest.php - @covers ::collect
File
- tests/
src/ Unit/ EntityCollectorTest.php, line 80
Class
- EntityCollectorTest
- @coversDefaultClass \Drupal\simple_oauth\ExpiredCollector @group simple_oauth
Namespace
Drupal\Tests\simple_oauth\UnitCode
protected function buildProphecies() {
$entity_type_manager = $this
->prophesize(EntityTypeManagerInterface::class);
$token_storage = $this
->prophesize(EntityStorageInterface::class);
$token_query = $this
->prophesize(QueryInterface::class);
$token_query
->execute()
->willReturn([
1 => '1',
52 => '52',
]);
$token_storage
->getQuery()
->willReturn($token_query
->reveal());
$token1 = $this
->prophesize(Oauth2Token::class);
$token1
->id()
->willReturn(1);
$token52 = $this
->prophesize(Oauth2Token::class);
$token52
->id()
->willReturn(52);
$token_storage
->loadMultiple([
'1',
'52',
])
->willReturn([
1 => $token1
->reveal(),
52 => $token52
->reveal(),
]);
$client_storage = $this
->prophesize(EntityStorageInterface::class);
$client_query = $this
->prophesize(QueryInterface::class);
$client_query
->execute()
->willReturn([
6 => '6',
]);
$client_storage
->getQuery()
->willReturn($client_query
->reveal());
$client6 = $this
->prophesize(Consumer::class);
$client6
->id()
->willReturn(6);
$client_storage
->loadByProperties([
'user_id' => 22,
])
->willReturn([
6 => $client6
->reveal(),
]);
$entity_type_manager
->getStorage('oauth2_token')
->willReturn($token_storage
->reveal());
$entity_type_manager
->getStorage('consumer')
->willReturn($client_storage
->reveal());
$date_time = $this
->prophesize(TimeInterface::class);
$date_time
->getRequestTime()
->willReturn(42);
$expired_collector = new ExpiredCollector($entity_type_manager
->reveal(), $date_time
->reveal());
return [
$expired_collector,
$token_query,
$token_storage,
$client_query,
$client_storage,
];
}