$plugin_manager =
$this->
prophesize(PluginManagerInterface::
class);
$plugin_manager->
createInstance($instance_id,
['id' =>
$instance_id])->
willReturn($instance);
// Also set up a container with the plugin manager so that we can assert
// that the plugin manager itself is also not serialized.
$container = TestKernel::
setContainerWithKernel();
$container->
set('plugin.manager.foo',
$plugin_manager->
reveal());
$entity_values =
['the_plugin_collection_config' =>
[$instance_id =>
['foo' => 'original_value'
]]];
$entity =
new TestConfigEntityWithPluginCollections($entity_values,
$this->entityTypeId
);
$entity->
setPluginManager($plugin_manager->
reveal());
// After creating the entity, change the plugin configuration.
$instance->
setConfiguration(['foo' => 'new_value'
]);
// After changing the plugin configuration, the entity still has the
// original value.
$expected_plugin_config =
[$instance_id =>
['foo' => 'original_value'
]];
$this->
assertSame($expected_plugin_config,
$entity->
get('the_plugin_collection_config'
));
// Ensure the plugin collection and manager is not stored.
$vars =
$entity->
__sleep();