diff core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 1fec387a4317
children
line wrap: on
line diff
--- a/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php	Thu Feb 28 13:21:36 2019 +0000
+++ b/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php	Thu May 09 15:33:08 2019 +0100
@@ -4,6 +4,8 @@
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Tests\Core\Plugin\Fixtures\TestConfigurablePlugin;
 use Drupal\Tests\UnitTestCase;
 
@@ -42,6 +44,20 @@
   protected $uuid;
 
   /**
+   * The module handler.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface|\Prophecy\Prophecy\ProphecyInterface
+   */
+  protected $moduleHandler;
+
+  /**
+   * The theme handler.
+   *
+   * @var \Drupal\Core\Extension\ThemeHandlerInterface|\Prophecy\Prophecy\ProphecyInterface
+   */
+  protected $themeHandler;
+
+  /**
    * {@inheritdoc}
    */
   protected function setUp() {
@@ -60,8 +76,13 @@
 
     $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
 
+    $this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
+    $this->themeHandler = $this->prophesize(ThemeHandlerInterface::class);
+
     $container = new ContainerBuilder();
     $container->set('entity_type.manager', $this->entityTypeManager);
+    $container->set('module_handler', $this->moduleHandler->reveal());
+    $container->set('theme_handler', $this->themeHandler->reveal());
     $container->set('uuid', $this->uuid);
     \Drupal::setContainer($container);
   }
@@ -70,6 +91,7 @@
    * @covers ::calculateDependencies
    */
   public function testCalculateDependencies() {
+    $this->themeHandler->themeExists('stark')->willReturn(TRUE);
     $values = ['theme' => 'stark'];
     // Mock the entity under test so that we can mock getPluginCollections().
     $entity = $this->getMockBuilder('\Drupal\block\Entity\Block')
@@ -78,6 +100,7 @@
       ->getMock();
     // Create a configurable plugin that would add a dependency.
     $instance_id = $this->randomMachineName();
+    $this->moduleHandler->moduleExists('test')->willReturn(TRUE);
     $instance = new TestConfigurablePlugin([], $instance_id, ['provider' => 'test']);
 
     // Create a plugin collection to contain the instance.