onBuildRender example

$expected_build_with_expected_cache = $expected_build + [
      '#cache' => [
        'contexts' => [],
        'tags' => [
          'build-tag',
          'test',
        ],
        'max-age' => -1,
      ],
    ];

    $subscriber->onBuildRender($event);
    $result = $event->getBuild();
    $this->assertEquals($expected_build$result);
    $event->getCacheableMetadata()->applyTo($result);
    $this->assertEqualsCanonicalizing($expected_build_with_expected_cache['#cache']$result['#cache']);
  }

  /** * @covers ::onBuildRender * * @dataProvider providerBlockTypes */
  
Home | Imprint | This part of the site doesn't use cookies.