public function testAddExpanded() { $parameters =
new MenuTreeParameters();
// Verify default value.
$this->
assertEquals([],
$parameters->expandedParents
);
// Add actual menu link plugin IDs to be expanded.
$parameters->
addExpandedParents(['foo', 'bar', 'baz'
]);
$this->
assertEquals(['foo', 'bar', 'baz'
],
$parameters->expandedParents
);
// Add additional menu link plugin IDs; they should be merged, not replacing
// the old ones.
$parameters->
addExpandedParents(['qux', 'quux'
]);
$this->
assertEquals(['foo', 'bar', 'baz', 'qux', 'quux'
],
$parameters->expandedParents
);
// Add pre-existing menu link plugin IDs; they should not be added again;
// this is a set.
$parameters->
addExpandedParents(['bar', 'quux'
]);
$this->
assertEquals(['foo', 'bar', 'baz', 'qux', 'quux'
],
$parameters->expandedParents
);
}