protected static function AssertHelperTrait::castSafeStrings in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/AssertHelperTrait.php \Drupal\Tests\AssertHelperTrait::castSafeStrings()
Casts MarkupInterface objects into strings.
Parameters
string|array $value: The value to act on.
Return value
mixed The input value, with MarkupInterface objects casted to string.
35 calls to AssertHelperTrait::castSafeStrings()
- AssertHelperTestClass::testMethod in core/
tests/ Drupal/ Tests/ AssertHelperTraitTest.php - BlockInterfaceTest::testBlockInterface in core/
modules/ block/ tests/ src/ Kernel/ BlockInterfaceTest.php - Test configuration and subsequent form() and build() method calls.
- BookUninstallValidatorTest::testValidateEntityQueryWithoutResults in core/
modules/ book/ tests/ src/ Unit/ BookUninstallValidatorTest.php - @covers ::validate
- BookUninstallValidatorTest::testValidateEntityQueryWithResults in core/
modules/ book/ tests/ src/ Unit/ BookUninstallValidatorTest.php - @covers ::validate
- BookUninstallValidatorTest::testValidateNotBook in core/
modules/ book/ tests/ src/ Unit/ BookUninstallValidatorTest.php - @covers ::validate
File
- core/
tests/ Drupal/ Tests/ AssertHelperTrait.php, line 21
Class
- AssertHelperTrait
- Provides helper methods for assertions.
Namespace
Drupal\TestsCode
protected static 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;
}