public function CustomFormattersTestBase::assertCustomFormatterExists in Custom Formatters 8.3
Pass if the Custom Formatter is found.
Parameters
string $name: The name of the formatter to check.
string $message: Message to display.
string $group: The group this message belong to, default to 'Other'.
Return value
bool TRUE on pass, FALSE on fail.
1 call to CustomFormattersTestBase::assertCustomFormatterExists()
- CustomFormattersGeneralTest::testCustomFormattersUi in src/
Tests/ CustomFormattersGeneralTest.php - Test General UI related functionality.
File
- src/
Tests/ CustomFormattersTestBase.php, line 99
Class
- CustomFormattersTestBase
- Class CustomFormattersTestBase.
Namespace
Drupal\custom_formatters\TestsCode
public function assertCustomFormatterExists($name, $message = '', $group = 'Other') {
$formatter = \Drupal::entityTypeManager()
->getStorage('formatter')
->load($name);
$message = !empty($message) ? $message : t('Custom Formatter %name found.', [
'%name' => $name,
]);
return $this
->assert(!is_null($formatter), $message, $group);
}