trait AssertHelperTrait in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/AssertHelperTrait.php \Drupal\simpletest\AssertHelperTrait
Provides helper methods for assertions.
Hierarchy
- trait \Drupal\simpletest\AssertHelperTrait
7 files declare their use of AssertHelperTrait
- AssertHelperTraitTest.php in core/
modules/ simpletest/ tests/ src/ Unit/ AssertHelperTraitTest.php - Contains \Drupal\Tests\simpletest\Unit\AssertHelperTraitTest.
- BookUninstallValidatorTest.php in core/
modules/ book/ tests/ src/ Unit/ BookUninstallValidatorTest.php - Contains \Drupal\Tests\book\Unit\BookUninstallValidatorTest.
- FieldUninstallValidatorTest.php in core/
modules/ field/ tests/ src/ Unit/ FieldUninstallValidatorTest.php - Contains \Drupal\Tests\field\Unit\FieldUninstallValidatorTest.
- FilterUninstallValidatorTest.php in core/
modules/ filter/ tests/ src/ Unit/ FilterUninstallValidatorTest.php - Contains \Drupal\Tests\filter\Unit\FilterUninstallValidatorTest.
- ForumUninstallValidatorTest.php in core/
modules/ forum/ tests/ src/ Unit/ ForumUninstallValidatorTest.php - Contains \Drupal\Tests\forum\Unit\ForumUninstallValidatorTest.
File
- core/
modules/ simpletest/ src/ AssertHelperTrait.php, line 15 - Contains \Drupal\simpletest\AssertHelperTrait.
Namespace
Drupal\simpletestView source
trait AssertHelperTrait {
/**
* Casts MarkupInterface objects into strings.
*
* @param string|array $value
* The value to act on.
*
* @return mixed
* The input value, with MarkupInterface objects casted to string.
*/
protected function castSafeStrings($value) {
if ($value instanceof MarkupInterface) {
$value = (string) $value;
}
if (is_array($value)) {
array_walk_recursive($value, function (&$item) {
if ($item instanceof MarkupInterface) {
$item = (string) $item;
}
});
}
return $value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssertHelperTrait:: |
protected | function | Casts MarkupInterface objects into strings. |