You are here

public function EntityShareCronServiceTest::testSynchronizationUpdateOnly in Entity Share Cron 8.2

Same name and namespace in other branches
  1. 8 tests/src/Unit/EntityShareCronServiceTest.php \Drupal\Tests\entity_share_cron\Unit\EntityShareCronServiceTest::testSynchronizationUpdateOnly()

Tests synchronization when only entity update is allowed.

File

tests/src/Unit/EntityShareCronServiceTest.php, line 181

Class

EntityShareCronServiceTest
@coversDefaultClass \Drupal\entity_share_cron\EntityShareCronService @group entity_share_cron

Namespace

Drupal\Tests\entity_share_cron\Unit

Code

public function testSynchronizationUpdateOnly() {

  // Enables only entity update.
  $this->remotesConfig[self::REMOTE_ID]['channels'][self::CHANNEL_ID]['operations'] = [
    'create' => FALSE,
    'update' => TRUE,
  ];

  // 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[0][0], $imported);
  $this
    ->assertContains($this->responseData[2][0], $imported);
}