public function AudienceFieldFormatterTest::testFieldFormatterInfoAlter in Organic groups 8
Testing og_field_formatter_info_alter().
File
- tests/
src/ Kernel/ Field/ AudienceFieldFormatterTest.php, line 25
Class
- AudienceFieldFormatterTest
- Test that formatters for entity reference can be applied to audience fields.
Namespace
Drupal\Tests\og\Kernel\FieldCode
public function testFieldFormatterInfoAlter() {
/** @var \Drupal\Core\Field\FormatterPluginManager $formatter_manager */
$formatter_manager = \Drupal::getContainer()
->get('plugin.manager.field.formatter');
$expected = [
'entity_reference_entity_id',
'entity_reference_entity_view',
'entity_reference_label',
];
$actual = array_keys($formatter_manager
->getOptions(OgGroupAudienceHelperInterface::GROUP_REFERENCE));
sort($actual);
$this
->assertEquals($expected, $actual);
}