function MenuTreeParametersTest::testSerialize
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php \Drupal\Tests\Core\Menu\MenuTreeParametersTest::testSerialize()
- 8.9.x core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php \Drupal\Tests\Core\Menu\MenuTreeParametersTest::testSerialize()
- 11.x core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php \Drupal\Tests\Core\Menu\MenuTreeParametersTest::testSerialize()
@covers ::serialize @covers ::unserialize
File
-
core/
tests/ Drupal/ Tests/ Core/ Menu/ MenuTreeParametersTest.php, line 151
Class
- MenuTreeParametersTest
- Tests the menu link tree parameters value object.
Namespace
Drupal\Tests\Core\MenuCode
public function testSerialize() : void {
$parameters = new MenuTreeParameters();
$parameters->setRoot(1);
$parameters->setMinDepth('2');
$parameters->setMaxDepth('9');
$parameters->addExpandedParents([
'',
'foo',
]);
$parameters->setActiveTrail([
'',
'bar',
]);
$after_serialize = unserialize(serialize($parameters));
$this->assertSame('1', $after_serialize->root);
$this->assertSame(2, $after_serialize->minDepth);
$this->assertSame(9, $after_serialize->maxDepth);
$this->assertSame([
'',
'foo',
], $after_serialize->expandedParents);
$this->assertSame([
'bar',
], $after_serialize->activeTrail);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.