You are here

public function CrmCoreUserSyncRelationTest::testRelationCreated in CRM Core 8

Same name and namespace in other branches
  1. 8.3 modules/crm_core_user_sync/tests/src/Kernel/CrmCoreUserSyncRelationTest.php \Drupal\Tests\crm_core_user_sync\Kernel\CrmCoreUserSyncRelationTest::testRelationCreated()

Tests that relation and related individual was created.

File

modules/crm_core_user_sync/tests/src/Kernel/CrmCoreUserSyncRelationTest.php, line 93

Class

CrmCoreUserSyncRelationTest
Test description.

Namespace

Drupal\Tests\crm_core_user_sync\Kernel

Code

public function testRelationCreated() {
  $account_authenticated = User::create([
    'name' => 'authenticated',
  ]);
  $account_authenticated
    ->save();
  $authenticated_relation_id = $this->relationService
    ->getUserRelationId($account_authenticated
    ->id());
  $this
    ->assertNotEmpty($authenticated_relation_id, 'Relation was created');
  $authenticated_individual_id = $this->relationService
    ->getUserIndividualId($account_authenticated
    ->id());
  $this
    ->assertNotEmpty($authenticated_individual_id, 'Related contact was created');
  $related_account_id = $this->relationService
    ->getIndividualUserId($authenticated_individual_id);
  $this
    ->assertEquals($related_account_id, $account_authenticated
    ->id(), 'Related ');
}