public function PageVariantPageEntityTest::testChangePageId in Page Manager 8
Same name and namespace in other branches
- 8.4 tests/src/Kernel/PageVariantPageEntityTest.php \Drupal\Tests\page_manager\Kernel\PageVariantPageEntityTest::testChangePageId()
Tests that a page gets cached on the page variant.
File
- tests/
src/ Kernel/ PageVariantPageEntityTest.php, line 69 - Contains \Drupal\Tests\page_manager\Kernel\PageVariantPageEntityTest.
Class
- PageVariantPageEntityTest
- Tests storing an page entity on a page variant.
Namespace
Drupal\Tests\page_manager\KernelCode
public function testChangePageId() {
/* @var \Drupal\page_manager\PageVariantInterface $page_variant */
$page_variant = PageVariant::create([
'id' => 'test_page_variant',
]);
// Check the page gets set correctly.
/* @var \Drupal\page_manager\PageInterface $page */
$page1 = Page::create([
'id' => 'test_page_1',
]);
$page_variant
->setPageEntity($page1);
$this
->assertEquals('test_page_1', $page_variant
->get('page'));
// Check the page gets changed correctly.
/* @var \Drupal\page_manager\PageInterface $page */
$page2 = Page::create([
'id' => 'test_page_2',
]);
$page_variant
->setPageEntity($page2);
$this
->assertEquals('test_page_2', $page_variant
->get('page'));
}