public function CrmCoreUserSyncRelationTest::testRulesOverride in CRM Core 8
Same name and namespace in other branches
- 8.3 modules/crm_core_user_sync/tests/src/Kernel/CrmCoreUserSyncRelationTest.php \Drupal\Tests\crm_core_user_sync\Kernel\CrmCoreUserSyncRelationTest::testRulesOverride()
Tests that configured rules could be programmatically overridden.
See also
\Drupal\crm_core_user_sync\CrmCoreUserSyncRelation::relate()
File
- modules/
crm_core_user_sync/ tests/ src/ Kernel/ CrmCoreUserSyncRelationTest.php, line 161
Class
- CrmCoreUserSyncRelationTest
- Test description.
Namespace
Drupal\Tests\crm_core_user_sync\KernelCode
public function testRulesOverride() {
$account_authenticated = User::create([
'name' => 'authenticated',
'crm_core_no_auto_sync' => TRUE,
]);
$account_authenticated
->save();
$authenticated_relation_id = $this->relationService
->getUserRelationId($account_authenticated
->id());
$this
->assertEmpty($authenticated_relation_id, 'Relation was not created');
$individual_customer = Individual::create([
'type' => 'customer',
]);
$individual_customer
->save();
$this->relationService
->relate($account_authenticated, $individual_customer);
$authenticated_relation_id = $this->relationService
->getUserRelationId($account_authenticated
->id());
$this
->assertEmpty($authenticated_relation_id, 'Relation was not created');
$individual_individual = Individual::create([
'type' => 'individual',
]);
$individual_individual
->save();
$this->relationService
->relate($account_authenticated, $individual_individual);
$authenticated_relation_id = $this->relationService
->getUserRelationId($account_authenticated
->id());
$this
->assertNotEmpty($authenticated_relation_id, 'Relation was created');
}