public function EntityShareCronServiceTest::testSynchronizationWithPageLimit in Entity Share Cron 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/EntityShareCronServiceTest.php \Drupal\Tests\entity_share_cron\Unit\EntityShareCronServiceTest::testSynchronizationWithPageLimit()
Tests the sync() method with page limit.
File
- tests/
src/ Unit/ EntityShareCronServiceTest.php, line 131
Class
- EntityShareCronServiceTest
- @coversDefaultClass \Drupal\entity_share_cron\EntityShareCronService @group entity_share_cron
Namespace
Drupal\Tests\entity_share_cron\UnitCode
public function testSynchronizationWithPageLimit() {
$this->responsePages = 3;
// Sets expectation to get third page enqueued.
$expected_item = [
'remote_id' => self::REMOTE_ID,
'channel_id' => self::CHANNEL_ID,
'channel_info' => [
'url' => 'page_2',
],
];
$this->queue
->expects($this
->once())
->method('createItem')
->with($this
->equalTo($expected_item));
$info = [
'url' => self::CHANNEL_URL,
];
$imported = $this->service
->sync(self::REMOTE_ID, self::CHANNEL_ID, $info, 2);
$this
->assertCount(2, $imported);
$this
->assertContains($this->responseData[0][0], $imported);
$this
->assertContains($this->responseData[1][0], $imported);
}