Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Plugin / PluginDependencyTraitTest.php
index 844c8152d366d0c1183f7f72d29950c5c70ddab4..f76fc672fe53649d0e12e40a3ad862e89d8b9958 100644 (file)
@@ -16,10 +16,25 @@ use Prophecy\Prophecy\ProphecyInterface;
  */
 class PluginDependencyTraitTest extends UnitTestCase {
 
+  /**
+   * @covers ::getPluginDependencies
+   *
+   * @dataProvider providerTestPluginDependencies
+   */
+  public function testGetPluginDependencies(ProphecyInterface $plugin, $definition, array $expected) {
+    $test_class = new TestPluginDependency();
+
+    $plugin->getPluginDefinition()->willReturn($definition);
+
+    $actual = $test_class->getPluginDependencies($plugin->reveal());
+    $this->assertEquals($expected, $actual);
+    $this->assertEmpty($test_class->getDependencies());
+  }
+
   /**
    * @covers ::calculatePluginDependencies
    *
-   * @dataProvider providerTestCalculatePluginDependencies
+   * @dataProvider providerTestPluginDependencies
    *
    * @param \Prophecy\Prophecy\ProphecyInterface $plugin
    *   A prophecy of a plugin instance.
@@ -38,9 +53,9 @@ class PluginDependencyTraitTest extends UnitTestCase {
   }
 
   /**
-   * Provides test data for ::testCalculatePluginDependencies().
+   * Provides test data for plugin dependencies.
    */
-  public function providerTestCalculatePluginDependencies() {
+  public function providerTestPluginDependencies() {
     $data = [];
 
     $plugin = $this->prophesize(PluginInspectionInterface::class);
@@ -111,6 +126,7 @@ class TestPluginDependency {
 
   use PluginDependencyTrait {
     calculatePluginDependencies as public;
+    getPluginDependencies as public;
   }
 
   /**