['#markup' => 'foo'],
'foo',
];
+ // Basic #markup based renderable array with value '0'.
+ $data[] = [
+ ['#markup' => '0'],
+ '0',
+ ];
+ // Basic #markup based renderable array with value 0.
+ $data[] = [
+ ['#markup' => 0],
+ '0',
+ ];
+ // Basic #markup based renderable array with value ''.
+ $data[] = [
+ ['#markup' => ''],
+ '',
+ ];
+ // Basic #markup based renderable array with value NULL.
+ $data[] = [
+ ['#markup' => NULL],
+ '',
+ ];
// Basic #plain_text based renderable array.
$data[] = [
['#plain_text' => 'foo'],
['#plain_text' => Markup::create('<em>foo</em>')],
'<em>foo</em>',
];
+ // #plain_text based renderable array with value '0'.
+ $data[] = [
+ ['#plain_text' => '0'],
+ '0',
+ ];
+ // #plain_text based renderable array with value 0.
+ $data[] = [
+ ['#plain_text' => 0],
+ '0',
+ ];
+ // #plain_text based renderable array with value ''.
+ $data[] = [
+ ['#plain_text' => ''],
+ '',
+ ];
+ // #plain_text based renderable array with value NULL.
+ $data[] = [
+ ['#plain_text' => NULL],
+ '',
+ ];
// Renderable child element.
$data[] = [
['child' => ['#markup' => 'bar']],
'#pre_render' => [function ($elements) {
$elements['#markup'] .= '<script>alert("bar");</script>';
return $elements;
- }
+ },
],
],
'fooalert("bar");',
'#pre_render' => [function ($elements) {
$elements['#markup'] .= '<script>alert("bar");</script>';
return $elements;
- }
+ },
],
],
'foo<script>alert("bar");</script>',
'#pre_render' => [function ($elements) {
$elements['#plain_text'] .= '<script>alert("bar");</script>';
return $elements;
- }
+ },
],
],
'foo<script>alert("bar");</script>',
$build = [
'#access_callback' => function () use ($access) {
return $access;
- }
+ },
];
$this->assertAccess($build, $access);
'#access' => $access,
'#access_callback' => function () {
return TRUE;
- }
+ },
];
$this->assertAccess($build, $access);
[
'#markup' => 'kittens',
'#cache' => [
- 'tags' => ['kittens-147']
+ 'tags' => ['kittens-147'],
],
],
],
'contexts' => ['theme'],
'tags' => ['bar'],
'max-age' => 600,
- ]
+ ],
],
new TestCacheableDependency(['user.roles'], ['foo'], Cache::PERMANENT),
[
'contexts' => ['theme'],
'tags' => ['bar'],
'max-age' => 600,
- ]
+ ],
],
new \stdClass(),
[