You are here

protected function CrmCoreUserSyncRelationRulesTest::setUp in CRM Core 8.3

Same name and namespace in other branches
  1. 8 modules/crm_core_user_sync/tests/src/Unit/CrmCoreUserSyncRelationRulesTest.php \Drupal\Tests\crm_core_user_sync\Unit\CrmCoreUserSyncRelationRulesTest::setUp()

Overrides UnitTestCase::setUp

File

modules/crm_core_user_sync/tests/src/Unit/CrmCoreUserSyncRelationRulesTest.php, line 24

Class

CrmCoreUserSyncRelationRulesTest
Test CrmCoreUserSyncRelationRules service.

Namespace

Drupal\Tests\crm_core_user_sync\Unit

Code

protected function setUp() {
  parent::setUp();
  $rules = [];
  $rules[] = [
    'role' => 'customer',
    'contact_type' => 'customer',
    'enabled' => TRUE,
    'weight' => 1,
  ];
  $rules[] = [
    'role' => 'authenticated',
    'contact_type' => 'individual',
    'enabled' => TRUE,
    'weight' => 10,
  ];
  $config = $this
    ->getMockBuilder(ImmutableConfig::class)
    ->disableOriginalConstructor()
    ->getMock();
  $config
    ->expects($this
    ->once())
    ->method('get')
    ->with('rules')
    ->willReturn($rules);
  $config_name = 'crm_core_user_sync.settings';
  $configFactory = $this
    ->createMock(ConfigFactoryInterface::class);
  $configFactory
    ->expects($this
    ->once())
    ->method('get')
    ->with($config_name)
    ->willReturn($config);
  $this->rulesService = new CrmCoreUserSyncRelationRules($configFactory, $config_name);
}