diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php index c8339e3..1c2693c 100644 --- a/core/modules/block/src/BlockListBuilder.php +++ b/core/modules/block/src/BlockListBuilder.php @@ -17,7 +17,6 @@ use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Form\FormInterface; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\Context\ContextRepositoryInterface; use Drupal\Core\Theme\ThemeManagerInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -59,13 +58,6 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface protected $formBuilder; /** - * The context repository. - * - * @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface - */ - protected $contextRepository; - - /** * {@inheritdoc} */ protected $limit = FALSE; @@ -81,15 +73,12 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface * The theme manager. * @param \Drupal\Core\Form\FormBuilderInterface $form_builder * The form builder. - * @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $context_repository - * The context repository */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ThemeManagerInterface $theme_manager, FormBuilderInterface $form_builder, ContextRepositoryInterface $context_repository) { + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ThemeManagerInterface $theme_manager, FormBuilderInterface $form_builder) { parent::__construct($entity_type, $storage); $this->themeManager = $theme_manager; $this->formBuilder = $form_builder; - $this->contextRepository = $context_repository; } /** diff --git a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php index 98ef219..3fbf0db 100644 --- a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php +++ b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php @@ -10,6 +10,7 @@ use Drupal\block\BlockRepository; use Drupal\Core\Access\AccessResult; use Drupal\Core\Block\BlockPluginInterface; +use Drupal\Core\Plugin\Context\LazyContextRepository; use Drupal\Core\Plugin\ContextAwarePluginInterface; use Drupal\Tests\UnitTestCase; @@ -40,7 +41,7 @@ class BlockRepositoryTest extends UnitTestCase { protected $contextHandler; /** - * @var \Drupal\Core\Plugin\Context\LazyContextRepository|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Plugin\Context\LazyContextRepository|\Prophecy\Prophecy\ProphecyInterface */ protected $contextRepository; @@ -70,16 +71,14 @@ protected function setUp() { ->will($this->returnValue($active_theme)); $this->contextHandler = $this->getMock('Drupal\Core\Plugin\Context\ContextHandlerInterface'); - $this->contextRepository = $this->getMockBuilder('Drupal\Core\Plugin\Context\LazyContextRepository') - ->disableOriginalConstructor() - ->getMock(); + $this->contextRepository = $this->prophesize(LazyContextRepository::class); $this->blockStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface'); $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); $entity_manager->expects($this->any()) ->method('getStorage') ->willReturn($this->blockStorage); - $this->blockRepository = new BlockRepository($entity_manager, $theme_manager, $this->contextHandler, $this->contextRepository); + $this->blockRepository = new BlockRepository($entity_manager, $theme_manager, $this->contextHandler, $this->contextRepository->reveal()); } /**