Security update for Core, with self-updated composer
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Render / RendererPlaceholdersTest.php
index 00426c252d726bf48651fc31b5e9675769527c90..253a3580dc350336f31823fdbc68a59207a04329 100644 (file)
@@ -65,7 +65,7 @@ class RendererPlaceholdersTest extends RendererTestBase {
   public function providerPlaceholders() {
     $args = [$this->randomContextValue()];
 
-    $generate_placeholder_markup = function($cache_keys = NULL) use ($args) {
+    $generate_placeholder_markup = function ($cache_keys = NULL) use ($args) {
       $token_render_array = [
         '#lazy_builder' => ['Drupal\Tests\Core\Render\PlaceholdersTest::callback', $args],
       ];
@@ -547,12 +547,11 @@ class RendererPlaceholdersTest extends RendererTestBase {
 
   /**
    * @param false|array $cid_parts
-   * @param array $expected_data
-   *   FALSE if no render cache item is expected, a render array with the
-   *   expected values if a render cache item is expected.
    * @param string[] $bubbled_cache_contexts
    *   Additional cache contexts that were bubbled when the placeholder was
    *   rendered.
+   * @param array $expected_data
+   *   A render array with the expected values.
    */
   protected function assertPlaceholderRenderCache($cid_parts, array $bubbled_cache_contexts, array $expected_data) {
     if ($cid_parts !== FALSE) {
@@ -876,13 +875,16 @@ class RendererPlaceholdersTest extends RendererTestBase {
    */
   public function testScalarLazybuilderCallbackContext() {
     $element = [];
-    $element['#lazy_builder'] = ['\Drupal\Tests\Core\Render\PlaceholdersTest::callback', [
-      'string' => 'foo',
-      'bool' => TRUE,
-      'int' => 1337,
-      'float' => 3.14,
-      'null' => NULL,
-    ]];
+    $element['#lazy_builder'] = [
+      '\Drupal\Tests\Core\Render\PlaceholdersTest::callback',
+      [
+        'string' => 'foo',
+        'bool' => TRUE,
+        'int' => 1337,
+        'float' => 3.14,
+        'null' => NULL,
+      ],
+    ];
 
     $result = $this->renderer->renderRoot($element);
     $this->assertInstanceOf('\Drupal\Core\Render\Markup', $result);
@@ -895,15 +897,18 @@ class RendererPlaceholdersTest extends RendererTestBase {
    */
   public function testNonScalarLazybuilderCallbackContext() {
     $element = [];
-    $element['#lazy_builder'] = ['\Drupal\Tests\Core\Render\PlaceholdersTest::callback', [
-      'string' => 'foo',
-      'bool' => TRUE,
-      'int' => 1337,
-      'float' => 3.14,
-      'null' => NULL,
-      // array is not one of the scalar types.
-      'array' => ['hi!'],
-    ]];
+    $element['#lazy_builder'] = [
+      '\Drupal\Tests\Core\Render\PlaceholdersTest::callback',
+      [
+        'string' => 'foo',
+        'bool' => TRUE,
+        'int' => 1337,
+        'float' => 3.14,
+        'null' => NULL,
+        // array is not one of the scalar types.
+        'array' => ['hi!'],
+      ],
+    ];
 
     $this->setExpectedException(\DomainException::class, "A #lazy_builder callback's context may only contain scalar values or NULL.");
     $this->renderer->renderRoot($element);
@@ -996,7 +1001,7 @@ HTML;
     $this->assertSame($element['#attached']['drupalSettings'], $expected_js_settings, '#attached is modified; both the original JavaScript setting and the ones added by each placeholder #lazy_builder callback exist.');
 
     // GET request: validate cached data.
-    $cached_element = $this->memoryCache->get('simpletest:drupal_render:children_placeholders')->data;
+    $cached_element = $this->memoryCache->get('simpletest:renderer:children_placeholders')->data;
     $expected_element = [
       '#attached' => [
         'drupalSettings' => [
@@ -1066,7 +1071,7 @@ HTML;
     $test_element = [
       '#type' => 'details',
       '#cache' => [
-        'keys' => ['simpletest', 'drupal_render', 'children_placeholders'],
+        'keys' => ['simpletest', 'renderer', 'children_placeholders'],
       ],
       '#title' => 'Parent',
       '#attached' => [
@@ -1075,7 +1080,7 @@ HTML;
         ],
         'placeholders' => [
           'parent-x-parent' => [
-            '#lazy_builder' => [ __NAMESPACE__ . '\\PlaceholdersTest::callback', $args_1],
+            '#lazy_builder' => [__NAMESPACE__ . '\\PlaceholdersTest::callback', $args_1],
           ],
         ],
       ],