$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();
$this->
assertNotContains('pluginCollection',
$vars);
$this->
assertNotContains('pluginManager',
$vars);
$this->
assertSame(['pluginManager' => 'plugin.manager.foo'
],
$entity->
get('_serviceIds'
));
$expected_plugin_config =
[$instance_id =>
['foo' => 'new_value'
]];
// Ensure the updated values are stored in the entity.
$this->
assertSame($expected_plugin_config,
$entity->
get('the_plugin_collection_config'
));
} /**
* @covers ::setOriginalId
* @covers ::getOriginalId
*/