public function FieldMatcherTest::testFieldsConfiguration in CRM Core 8.2
Same name and namespace in other branches
- 8.3 modules/crm_core_match/tests/src/Kernel/FieldMatcherTest.php \Drupal\Tests\crm_core_match\Kernel\FieldMatcherTest::testFieldsConfiguration()
- 8 modules/crm_core_match/tests/src/Kernel/FieldMatcherTest.php \Drupal\Tests\crm_core_match\Kernel\FieldMatcherTest::testFieldsConfiguration()
Tests fields and rules configuration.
File
- modules/
crm_core_match/ tests/ src/ Kernel/ FieldMatcherTest.php, line 66
Class
- FieldMatcherTest
- Tests the field matchers of the default matching engine.
Namespace
Drupal\Tests\crm_core_match\KernelCode
public function testFieldsConfiguration() {
// Load an existing matcher.
$individual_matcher = Matcher::load('individual');
$default_engine = $individual_matcher
->getPlugin();
$configuration = $default_engine
->getConfiguration();
// Add a sample fields configuration.
$configuration['rules']['name']['title']['status'] = FALSE;
$configuration['rules']['name']['given']['status'] = TRUE;
$configuration['rules']['name']['family']['status'] = FALSE;
$configuration['rules']['type']['value']['status'] = TRUE;
$configuration['rules']['individual_id']['value']['status'] = FALSE;
$default_engine
->setConfiguration($configuration);
$individual_matcher
->set('plugin', $default_engine);
// Rules should contain enabled "type" and "name" fields. Name field is
// enabled because it has (at least) one enabled property.
$this
->assertEquals([
'name',
'type',
], array_keys($default_engine
->getRules()));
}