function ElementTest::dataProviderIsRenderArray
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Render/ElementTest.php \Drupal\Tests\Core\Render\ElementTest::dataProviderIsRenderArray()
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ ElementTest.php, line 239
Class
- ElementTest
- @coversDefaultClass \Drupal\Core\Render\Element @group Render
Namespace
Drupal\Tests\Core\RenderCode
public static function dataProviderIsRenderArray() {
return [
'valid markup render array' => [
[
'#markup' => 'hello world',
],
TRUE,
],
'invalid "foo" string' => [
[
'foo',
'#markup' => 'hello world',
],
FALSE,
],
'null is not an array' => [
NULL,
FALSE,
],
'an empty array is not a render array' => [
[],
FALSE,
],
'funny enough a key with # is valid' => [
[
'#' => TRUE,
],
TRUE,
],
'nested arrays can be valid too' => [
[
'one' => [
2 => [
'#three' => 'charm!',
],
],
],
TRUE,
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.