/**
  * @covers ::calculateDependencies
  *
  * @dataProvider providerCalculateDependenciesWithPluginBags
  */
 public function testCalculateDependenciesWithPluginBags($definition, $expected_dependencies)
 {
     $values = array();
     $this->entity = $this->getMockBuilder('\\Drupal\\Tests\\Core\\Config\\Entity\\Fixtures\\ConfigEntityBaseWithPluginBags')->setConstructorArgs(array($values, $this->entityTypeId))->setMethods(array('getPluginBags'))->getMock();
     // Create a configurable plugin that would add a dependency.
     $instance_id = $this->randomMachineName();
     $instance = new TestConfigurablePlugin(array(), $instance_id, $definition);
     // Create a plugin bag to contain the instance.
     $pluginBag = $this->getMockBuilder('\\Drupal\\Core\\Plugin\\DefaultPluginBag')->disableOriginalConstructor()->setMethods(array('get'))->getMock();
     $pluginBag->expects($this->atLeastOnce())->method('get')->with($instance_id)->will($this->returnValue($instance));
     $pluginBag->addInstanceId($instance_id);
     // Return the mocked plugin bag.
     $this->entity->expects($this->once())->method('getPluginBags')->will($this->returnValue(array($pluginBag)));
     $this->assertEquals($expected_dependencies, $this->entity->calculateDependencies());
 }