public function EntityShareCronServiceTest::testSynchronizationCreateOnly 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::testSynchronizationCreateOnly()
Tests synchronization when only entity creation is allowed.
File
- tests/
src/ Unit/ EntityShareCronServiceTest.php, line 157
Class
- EntityShareCronServiceTest
- @coversDefaultClass \Drupal\entity_share_cron\EntityShareCronService @group entity_share_cron
Namespace
Drupal\Tests\entity_share_cron\UnitCode
public function testSynchronizationCreateOnly() {
// Enables only entity creation.
$this->remotesConfig[self::REMOTE_ID]['channels'][self::CHANNEL_ID]['operations'] = [
'create' => TRUE,
'update' => FALSE,
];
// Creates some nodes.
$this->nodes[] = $this
->createEntity('node1');
$this->nodes[] = $this
->createEntity('node3');
$info = [
'url' => self::CHANNEL_URL,
];
$imported = $this->service
->sync(self::REMOTE_ID, self::CHANNEL_ID, $info);
$this
->assertCount(2, $imported);
$this
->assertContains($this->responseData[1][0], $imported);
$this
->assertContains($this->responseData[2][1], $imported);
}