public function DateRecurBasicFormatterTest::testFormatterSettingsSummaryNotPerItem in Recurring Dates Field 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/DateRecurBasicFormatterTest.php \Drupal\Tests\date_recur\Kernel\DateRecurBasicFormatterTest::testFormatterSettingsSummaryNotPerItem()
- 3.x tests/src/Kernel/DateRecurBasicFormatterTest.php \Drupal\Tests\date_recur\Kernel\DateRecurBasicFormatterTest::testFormatterSettingsSummaryNotPerItem()
- 3.1.x tests/src/Kernel/DateRecurBasicFormatterTest.php \Drupal\Tests\date_recur\Kernel\DateRecurBasicFormatterTest::testFormatterSettingsSummaryNotPerItem()
Tests setting summary where count is shared across items.
File
- tests/
src/ Kernel/ DateRecurBasicFormatterTest.php, line 239
Class
- DateRecurBasicFormatterTest
- Tests date recur formatter.
Namespace
Drupal\Tests\date_recur\KernelCode
public function testFormatterSettingsSummaryNotPerItem() {
/** @var \Drupal\Core\Entity\EntityFieldManagerInterface $efm */
$efm = $this->container
->get('entity_field.manager');
$definitions = $efm
->getBaseFieldDefinitions('dr_entity_test');
$dateFormatId = $this->dateFormat
->id();
$options = [
'configuration' => [
'label' => 'above',
'type' => 'date_recur_basic_formatter',
'settings' => [
'format_type' => $dateFormatId,
'occurrence_format_type' => $dateFormatId,
'same_end_date_format_type' => $dateFormatId,
'interpreter' => $this->interpreter
->id(),
'count_per_item' => FALSE,
'separator' => '-',
'show_next' => 10,
],
],
'field_definition' => $definitions['dr'],
'prepare' => TRUE,
'view_mode' => 'full',
];
/** @var \Drupal\Core\Field\FormatterPluginManager $fieldFormatterManager */
$fieldFormatterManager = $this->container
->get('plugin.manager.field.formatter');
$instance = $fieldFormatterManager
->getInstance($options);
$summary = $instance
->settingsSummary();
$this
->assertEquals('Show maximum of 10 occurrences across all field items', $summary[2]);
}