diff --git a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php index cbe6ade..6117796 100644 --- a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\views\Unit\Plugin\Block; use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Tests\UnitTestCase; use Drupal\views\Plugin\Block\ViewsBlock; @@ -48,6 +49,13 @@ class ViewsBlockTest extends UnitTestCase { protected $account; /** + * The module handler used to check whether menu_ui is installed. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $moduleHandler; + + /** * The mocked display handler. * * @var \Drupal\views\Plugin\views\display\Block|\PHPUnit_Framework_MockObject_MockObject @@ -127,6 +135,7 @@ protected function setUp() { ->with('test_view') ->will($this->returnValue($this->view)); $this->account = $this->getMock('Drupal\Core\Session\AccountInterface'); + $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class); } /** @@ -147,7 +156,7 @@ public function testBuild() { $definition = []; $definition['provider'] = 'views'; - $plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account); + $plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account, $this->moduleHandler); $this->assertEquals($build, $plugin->build()); } @@ -169,7 +178,7 @@ public function testBuildEmpty() { $definition = []; $definition['provider'] = 'views'; - $plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account); + $plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account, $this->moduleHandler); $this->assertEquals(array_intersect_key($build, ['#cache' => TRUE]), $plugin->build()); } @@ -191,7 +200,7 @@ public function testBuildFailed() { $definition = []; $definition['provider'] = 'views'; - $plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account); + $plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account, $this->moduleHandler); $this->assertEquals([], $plugin->build()); }