public function AssetRefreshManagerTest::testNoMatchingMediaEntityIds in Media: Acquia DAM 8
Tests a "no matching media entity ids are found" scenario.
@dataProvider providerTestInterruptedFetch
Parameters
array $request_query_options: The list of request query options.
array $response: The stub of Notifications API response.
array $expected_asset_ids: The list of expected asset ids.
File
- tests/
src/ Unit/ AssetRefreshManagerTest.php, line 135
Class
- AssetRefreshManagerTest
- AssetRefreshManager Service test.
Namespace
Drupal\Tests\media_acquiadam\UnitCode
public function testNoMatchingMediaEntityIds(array $request_query_options, array $response, array $expected_asset_ids) {
$this->state
->method('get')
->willReturnMap([
[
'media_acquiadam.notifications_next_page',
NULL,
NULL,
],
[
'media_acquiadam.notifications_starttime',
NULL,
self::LAST_READ_TIMESTAMP,
],
[
'media_acquiadam.notifications_endtime',
self::REQUEST_TIME,
self::REQUEST_TIME,
],
]);
$this
->setupApiResponseStub($request_query_options, $response);
$this->entityQuery
->expects($this
->any())
->method('orConditionGroup')
->will($this
->returnSelf());
$this->entityQuery
->expects($this
->any())
->method('condition')
->withConsecutive([
$this
->equalTo('bundle'),
$this
->equalTo('test_bundle'),
], [
$this
->equalTo('field_1'),
$this
->equalTo($expected_asset_ids),
])
->will($this
->returnSelf());
$this->entityQuery
->expects($this
->any())
->method('execute')
->willReturn([]);
$this->queue
->expects($this
->never())
->method($this
->anything());
$actual = $this->assetRefreshManager
->updateQueue($this
->getAssetIdFieldsStub());
$this
->assertEquals(0, $actual);
}