public function PageVariantPageEntityTest::testPageGetsCached in Page Manager 8.4
Same name and namespace in other branches
- 8 tests/src/Kernel/PageVariantPageEntityTest.php \Drupal\Tests\page_manager\Kernel\PageVariantPageEntityTest::testPageGetsCached()
Tests that a page gets cached on the page variant.
File
- tests/
src/ Kernel/ PageVariantPageEntityTest.php, line 24
Class
- PageVariantPageEntityTest
- Tests storing an page entity on a page variant.
Namespace
Drupal\Tests\page_manager\KernelCode
public function testPageGetsCached() {
/* @var \Drupal\page_manager\PageInterface $page */
$page = Page::create([
'id' => 'test_page',
]);
$page
->save();
/* @var \Drupal\page_manager\PageVariantInterface $page_variant */
$page_variant = PageVariant::create([
'id' => 'test_page_variant',
'page' => 'test_page',
]);
// Get the page from the variant.
$page_first = $page_variant
->getPage();
$this
->assertNotEmpty($page_first);
$page_second = $page_variant
->getPage();
$this
->assertEquals(spl_object_hash($page_first), spl_object_hash($page_second));
}