Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
40
core/modules/simpletest/src/AssertHelperTrait.php
Normal file
40
core/modules/simpletest/src/AssertHelperTrait.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\simpletest\AssertHelperTrait.
|
||||
*/
|
||||
|
||||
namespace Drupal\simpletest;
|
||||
|
||||
use Drupal\Component\Render\MarkupInterface;
|
||||
|
||||
/**
|
||||
* Provides helper methods for assertions.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue