3 namespace Drupal\simpletest;
5 use Drupal\Component\Render\MarkupInterface;
8 * Provides helper methods for assertions.
10 trait AssertHelperTrait {
13 * Casts MarkupInterface objects into strings.
15 * @param string|array $value
16 * The value to act on.
19 * The input value, with MarkupInterface objects casted to string.
21 protected static function castSafeStrings($value) {
22 if ($value instanceof MarkupInterface) {
23 $value = (string) $value;
25 if (is_array($value)) {
26 array_walk_recursive($value, function (&$item) {
27 if ($item instanceof MarkupInterface) {
28 $item = (string) $item;