You are here

protected function CustomFormattersTestBase::setCustomFormatter in Custom Formatters 8.3

Set a Custom Formatter to be used by a specified field/bundle/view mode.

Parameters

string $formatter_name: A Custom Formatter name.

string $field_name: A Field name.

string $bundle_name: A Node content type.

string $view_mode: A Node view mode.

4 calls to CustomFormattersTestBase::setCustomFormatter()
CustomFormattersGeneralTest::testCustomFormatterTypeHtmlToken in src/Tests/CustomFormattersGeneralTest.php
Test the HTML + Token engine.
CustomFormattersGeneralTest::testCustomFormatterTypePhp in src/Tests/CustomFormattersGeneralTest.php
Test the PHP Engine.
CustomFormattersGeneralTest::testCustomFormatterTypeTwig in src/Tests/CustomFormattersGeneralTest.php
Test the Twig engine.
CustomFormattersGeneralTest::testFormatterTypeFormatterPreset in src/Tests/CustomFormattersGeneralTest.php
Test the Formatter preset Engine.

File

src/Tests/CustomFormattersTestBase.php, line 152

Class

CustomFormattersTestBase
Class CustomFormattersTestBase.

Namespace

Drupal\custom_formatters\Tests

Code

protected function setCustomFormatter($formatter_name, $field_name, $bundle_name, $view_mode = 'default') {
  $this
    ->drupalPostForm("admin/structure/types/manage/{$bundle_name}/display/{$view_mode}", [
    "fields[{$field_name}][type]" => "custom_formatters:{$formatter_name}",
  ], t('Save'));
  $this
    ->assertText(t('Your settings have been saved.'));
}