Unverified Commit 408c540c authored by alexpott's avatar alexpott
Browse files

Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz,...

Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz, jonathan1055: Deprecate all EntityManager methods with E_USER_DEPRECATED
parent d397f60c
......@@ -55,7 +55,7 @@ public function testBlockLinks() {
$this->assertText($block->label(), 'Feed block is displayed on the page.');
// Confirm items appear as links.
$items = $this->container->get('entity.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
$items = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
$links = $this->xpath('//a[@href = :href]', [':href' => reset($items)->getLink()]);
$this->assert(isset($links[0]), 'Item link found.');
......
......@@ -34,7 +34,7 @@ public function testDeleteFeed() {
// Delete feed.
$this->deleteFeed($feed1);
$this->assertText($feed2->label());
$block_storage = $this->container->get('entity.manager')->getStorage('block');
$block_storage = $this->container->get('entity_type.manager')->getStorage('block');
$this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.');
$this->assertEqual($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.');
......
......@@ -55,8 +55,8 @@ protected function setUp($import_test_views = TRUE) {
ViewTestData::createTestViews(get_class($this), ['aggregator_test_views']);
$this->itemStorage = $this->container->get('entity.manager')->getStorage('aggregator_item');
$this->feedStorage = $this->container->get('entity.manager')->getStorage('aggregator_feed');
$this->itemStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_item');
$this->feedStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_feed');
}
/**
......
......@@ -110,7 +110,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Exe
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('plugin.manager.condition'),
$container->get('context.repository'),
$container->get('language_manager'),
......
......@@ -98,8 +98,8 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_id,
$plugin_definition,
$container->get('block.repository'),
$container->get('entity.manager')->getViewBuilder('block'),
$container->get('entity.manager')->getDefinition('block')->getListCacheTags()
$container->get('entity_type.manager')->getViewBuilder('block'),
$container->get('entity_type.manager')->getDefinition('block')->getListCacheTags()
);
}
......
......@@ -46,7 +46,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
$migration_configuration = [
'migration' => [
'd6_custom_block',
......@@ -57,7 +57,7 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration,
$plugin_id,
$plugin_definition,
$entity_manager->getDefinition('block_content') ? $entity_manager->getStorage('block_content') : NULL,
$entity_type_manager->getDefinition('block_content') ? $entity_type_manager->getStorage('block_content') : NULL,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration)
);
}
......
......@@ -44,11 +44,11 @@ class BlockFormTest extends UnitTestCase {
protected $themeHandler;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The mocked context repository.
......@@ -74,10 +74,10 @@ protected function setUp() {
$this->language = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->contextRepository = $this->getMock('Drupal\Core\Plugin\Context\ContextRepositoryInterface');
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->storage = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
$this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
$this->entityManager->expects($this->any())
$this->entityTypeManager->expects($this->any())
->method('getStorage')
->will($this->returnValue($this->storage));
......@@ -136,7 +136,7 @@ public function testGetUniqueMachineName() {
->method('getQuery')
->will($this->returnValue($query));
$block_form_controller = new BlockForm($this->entityManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal());
$block_form_controller = new BlockForm($this->entityTypeManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal());
// Ensure that the block with just one other instance gets the next available
// name suggestion.
......
......@@ -37,10 +37,10 @@ class BlockContentController extends ControllerBase {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('block_content'),
$entity_manager->getStorage('block_content_type'),
$entity_type_manager->getStorage('block_content'),
$entity_type_manager->getStorage('block_content_type'),
$container->get('theme_handler')
);
}
......
......@@ -33,9 +33,9 @@ public function __construct(EntityStorageInterface $block_content_storage) {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('block_content')
$entity_type_manager->getStorage('block_content')
);
}
......
......@@ -71,7 +71,7 @@ protected function getAdditionalCacheTagsForEntity(EntityInterface $entity) {
*/
public function testBlock() {
$block = $this->drupalPlaceBlock('block_content:' . $this->entity->uuid());
$build = $this->container->get('entity.manager')->getViewBuilder('block')->view($block, 'block');
$build = $this->container->get('entity_type.manager')->getViewBuilder('block')->view($block, 'block');
// Render the block.
// @todo The request stack manipulation won't be necessary once
......
......@@ -72,7 +72,7 @@ public function testListing() {
// Edit the entity using the operations link.
$blocks = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content')
->loadByProperties(['info' => $label]);
$block = reset($blocks);
......
......@@ -79,7 +79,7 @@ public function testListing() {
// Edit the entity using the operations link.
$blocks = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content')
->loadByProperties(['info' => $label]);
$block = reset($blocks);
......
......@@ -187,7 +187,7 @@ public function testsBlockContentAddTypes() {
// Get the custom block storage.
$storage = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content');
// Install all themes.
......
......@@ -51,9 +51,9 @@ public function __construct(EntityStorageInterface $node_storage, BookManagerInt
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('node'),
$entity_type_manager->getStorage('node'),
$container->get('book.manager')
);
}
......
......@@ -78,7 +78,7 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_definition,
$container->get('request_stack'),
$container->get('book.manager'),
$container->get('entity.manager')->getStorage('node')
$container->get('entity_type.manager')->getStorage('node')
);
}
......
......@@ -52,7 +52,7 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_id,
$plugin_definition,
$container->get('current_route_match'),
$container->get('entity.manager')->getStorage('node')
$container->get('entity_type.manager')->getStorage('node')
);
}
......
......@@ -340,7 +340,7 @@ public function testNavigationBlockOnAccessModuleInstalled() {
* Tests the access for deleting top-level book nodes.
*/
public function testBookDelete() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$nodes = $this->createBook();
$this->drupalLogin($this->adminUser);
$edit = [];
......
......@@ -13,11 +13,11 @@
class BookManagerTest extends UnitTestCase {
/**
* The mocked entity manager.
* The mocked entity type manager.
*
* @var \Drupal\Core\Entity\EntityManager|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The mocked config factory.
......@@ -58,12 +58,12 @@ class BookManagerTest extends UnitTestCase {
* {@inheritdoc}
*/
protected function setUp() {
$this->entityManager = $this->createMock(EntityTypeManagerInterface::class);
$this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
$this->translation = $this->getStringTranslationStub();
$this->configFactory = $this->getConfigFactoryStub([]);
$this->bookOutlineStorage = $this->getMock('Drupal\book\BookOutlineStorageInterface');
$this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
$this->bookManager = new BookManager($this->entityManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer);
$this->bookManager = new BookManager($this->entityTypeManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer);
}
/**
......
......@@ -52,7 +52,7 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_definition,
$migration,
$container->get('state'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('theme_handler')
);
}
......
......@@ -65,7 +65,7 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity.manager')->getViewBuilder('comment'),
$container->get('entity_type.manager')->getViewBuilder('comment'),
$container->get('renderer')
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment