diff --git a/core/modules/comment/src/CommentLinkBuilder.php b/core/modules/comment/src/CommentLinkBuilder.php
index c7cbc18d376b..60be27082ab3 100644
--- a/core/modules/comment/src/CommentLinkBuilder.php
+++ b/core/modules/comment/src/CommentLinkBuilder.php
@@ -107,7 +107,7 @@ class CommentLinkBuilder implements CommentLinkBuilderInterface {
'title' => $this->formatPlural($entity->get($field_name)->comment_count, '1 comment', '@count comments'),
'attributes' => ['title' => $this->t('Jump to the first comment.')],
'fragment' => 'comments',
- 'url' => $entity->urlInfo(),
+ 'url' => $entity->toUrl(),
];
if ($this->moduleHandler->moduleExists('history')) {
$links['comment-new-comments'] = [
@@ -141,7 +141,7 @@ class CommentLinkBuilder implements CommentLinkBuilderInterface {
]);
}
else {
- $links['comment-add'] += ['url' => $entity->urlInfo()];
+ $links['comment-add'] += ['url' => $entity->toUrl()];
}
}
elseif ($this->currentUser->isAnonymous()) {
@@ -174,7 +174,7 @@ class CommentLinkBuilder implements CommentLinkBuilderInterface {
]);
}
else {
- $links['comment-add']['url'] = $entity->urlInfo();
+ $links['comment-add']['url'] = $entity->toUrl();
}
}
}
diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
index 662f5f332e25..e2ddf8ab0eee 100644
--- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
@@ -310,7 +310,7 @@ class CommentLinkBuilderTest extends UnitTestCase {
$url = Url::fromRoute('node.view');
$node->expects($this->any())
- ->method('urlInfo')
+ ->method('toUrl')
->willReturn($url);
$node->expects($this->any())
->method('url')
diff --git a/core/modules/contact/src/MailHandler.php b/core/modules/contact/src/MailHandler.php
index b57864c0596a..aae2793755c8 100644
--- a/core/modules/contact/src/MailHandler.php
+++ b/core/modules/contact/src/MailHandler.php
@@ -134,16 +134,16 @@ class MailHandler implements MailHandlerInterface {
if (!$message->isPersonal()) {
$this->logger->notice('%sender-name (@sender-from) sent an email regarding %contact_form.', [
- '%sender-name' => $sender_cloned->getUsername(),
+ '%sender-name' => $sender_cloned->getAccountName(),
'@sender-from' => $sender_cloned->getEmail(),
'%contact_form' => $contact_form->label(),
]);
}
else {
$this->logger->notice('%sender-name (@sender-from) sent %recipient-name an email.', [
- '%sender-name' => $sender_cloned->getUsername(),
+ '%sender-name' => $sender_cloned->getAccountName(),
'@sender-from' => $sender_cloned->getEmail(),
- '%recipient-name' => $message->getPersonalRecipient()->getUsername(),
+ '%recipient-name' => $message->getPersonalRecipient()->getAccountName(),
]);
}
}
diff --git a/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php b/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
index 63d2d86e706f..04ce07ab3a7b 100644
--- a/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
+++ b/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
@@ -42,6 +42,13 @@ abstract class ForumBreadcrumbBuilderBase implements BreadcrumbBuilderInterface
*/
protected $forumManager;
+ /**
+ * The taxonomy term storage.
+ *
+ * @var \Drupal\taxonomy\TermStorageInterface
+ */
+ protected $termStorage;
+
/**
* Constructs a forum breadcrumb builder object.
*
@@ -59,6 +66,7 @@ abstract class ForumBreadcrumbBuilderBase implements BreadcrumbBuilderInterface
$this->config = $config_factory->get('forum.settings');
$this->forumManager = $forum_manager;
$this->setStringTranslation($string_translation);
+ $this->termStorage = $entity_manager->getStorage('taxonomy_term');
}
/**
diff --git a/core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php b/core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php
index 93e5dd595f97..91ea1a01c36c 100644
--- a/core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php
+++ b/core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php
@@ -30,7 +30,7 @@ class ForumListingBreadcrumbBuilder extends ForumBreadcrumbBuilderBase {
$term_id = $term->id();
$breadcrumb->addCacheableDependency($term);
- $parents = $this->forumManager->getParents($term_id);
+ $parents = $this->termStorage->loadAllParents($term_id);
if ($parents) {
foreach (array_reverse($parents) as $parent) {
if ($parent->id() != $term_id) {
diff --git a/core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php b/core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php
index 1a359010a85b..007fb9a63c73 100644
--- a/core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php
+++ b/core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php
@@ -26,7 +26,7 @@ class ForumNodeBreadcrumbBuilder extends ForumBreadcrumbBuilderBase {
$breadcrumb = parent::build($route_match);
$breadcrumb->addCacheContexts(['route']);
- $parents = $this->forumManager->getParents($route_match->getParameter('node')->forum_tid);
+ $parents = $this->termStorage->loadAllParents($route_match->getParameter('node')->forum_tid);
if ($parents) {
$parents = array_reverse($parents);
foreach ($parents as $parent) {
diff --git a/core/modules/forum/src/ForumUninstallValidator.php b/core/modules/forum/src/ForumUninstallValidator.php
index 24ae880264a7..face3cbf459c 100644
--- a/core/modules/forum/src/ForumUninstallValidator.php
+++ b/core/modules/forum/src/ForumUninstallValidator.php
@@ -62,7 +62,7 @@ class ForumUninstallValidator implements ModuleUninstallValidatorInterface {
if ($vocabulary->access('view')) {
$reasons[] = $this->t('To uninstall Forum, first delete all %vocabulary terms', [
'%vocabulary' => $vocabulary->label(),
- ':url' => $vocabulary->url('overview-form'),
+ ':url' => $vocabulary->toUrl('overview-form')->toString(),
]);
}
else {
diff --git a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php
index 45566f2afe6d..47a0113d1f88 100644
--- a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php
+++ b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php
@@ -4,6 +4,7 @@ namespace Drupal\Tests\forum\Unit\Breadcrumb;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Link;
+use Drupal\taxonomy\TermStorageInterface;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\Container;
@@ -138,12 +139,12 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
$prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
$term2 = $prophecy->reveal();
- $forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
- $forum_manager->expects($this->at(0))
- ->method('getParents')
+ $term_storage = $this->getMockBuilder(TermStorageInterface::class)->getMock();
+ $term_storage->expects($this->at(0))
+ ->method('loadAllParents')
->will($this->returnValue([$term1]));
- $forum_manager->expects($this->at(1))
- ->method('getParents')
+ $term_storage->expects($this->at(1))
+ ->method('loadAllParents')
->will($this->returnValue([$term1, $term2]));
// The root forum.
@@ -167,6 +168,7 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
->method('getStorage')
->will($this->returnValueMap([
['taxonomy_vocabulary', $vocab_storage],
+ ['taxonomy_term', $term_storage],
]));
$config_factory = $this->getConfigFactoryStub(
@@ -177,6 +179,8 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
]
);
+ $forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
+
// Build a breadcrumb builder to test.
$breadcrumb_builder = $this->getMock(
'Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder', NULL, [
diff --git a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php
index f4d3797155d0..33acddff3c08 100644
--- a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php
+++ b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php
@@ -4,6 +4,7 @@ namespace Drupal\Tests\forum\Unit\Breadcrumb;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Link;
+use Drupal\taxonomy\TermStorageInterface;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\Container;
@@ -149,11 +150,12 @@ class ForumNodeBreadcrumbBuilderTest extends UnitTestCase {
$forum_manager = $this->getMockBuilder('Drupal\forum\ForumManagerInterface')
->disableOriginalConstructor()
->getMock();
- $forum_manager->expects($this->at(0))
- ->method('getParents')
+ $term_storage = $this->getMockBuilder(TermStorageInterface::class)->getMock();
+ $term_storage->expects($this->at(0))
+ ->method('loadAllParents')
->will($this->returnValue([$term1]));
- $forum_manager->expects($this->at(1))
- ->method('getParents')
+ $term_storage->expects($this->at(1))
+ ->method('loadAllParents')
->will($this->returnValue([$term1, $term2]));
$prophecy = $this->prophesize('Drupal\taxonomy\VocabularyInterface');
@@ -176,6 +178,7 @@ class ForumNodeBreadcrumbBuilderTest extends UnitTestCase {
->method('getStorage')
->will($this->returnValueMap([
['taxonomy_vocabulary', $vocab_storage],
+ ['taxonomy_term', $term_storage],
]));
$config_factory = $this->getConfigFactoryStub(
diff --git a/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php b/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php
index fa1b0c1ec76a..4969ad7dd34e 100644
--- a/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php
+++ b/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\forum\Unit;
+use Drupal\Core\Url;
use Drupal\simpletest\AssertHelperTrait;
use Drupal\Tests\UnitTestCase;
@@ -103,13 +104,16 @@ class ForumUninstallValidatorTest extends UnitTestCase {
->method('hasForumNodes')
->willReturn(TRUE);
+ $url = $this->prophesize(Url::class);
+ $url->toString()->willReturn('/path/to/vocabulary/overview');
+
$vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
$vocabulary->expects($this->once())
->method('label')
->willReturn('Vocabulary label');
$vocabulary->expects($this->once())
- ->method('url')
- ->willReturn('/path/to/vocabulary/overview');
+ ->method('toUrl')
+ ->willReturn($url->reveal());
$vocabulary->expects($this->once())
->method('access')
->willReturn(TRUE);
@@ -143,7 +147,7 @@ class ForumUninstallValidatorTest extends UnitTestCase {
->method('label')
->willReturn('Vocabulary label');
$vocabulary->expects($this->never())
- ->method('url');
+ ->method('toUrl');
$vocabulary->expects($this->once())
->method('access')
->willReturn(FALSE);
@@ -172,10 +176,13 @@ class ForumUninstallValidatorTest extends UnitTestCase {
->method('hasForumNodes')
->willReturn(FALSE);
+ $url = $this->prophesize(Url::class);
+ $url->toString()->willReturn('/path/to/vocabulary/overview');
+
$vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
$vocabulary->expects($this->once())
- ->method('url')
- ->willReturn('/path/to/vocabulary/overview');
+ ->method('toUrl')
+ ->willReturn($url->reveal());
$vocabulary->expects($this->once())
->method('label')
->willReturn('Vocabulary label');
@@ -211,7 +218,7 @@ class ForumUninstallValidatorTest extends UnitTestCase {
->method('label')
->willReturn('Vocabulary label');
$vocabulary->expects($this->never())
- ->method('url');
+ ->method('toUrl');
$vocabulary->expects($this->once())
->method('access')
->willReturn(FALSE);
diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php
index d5b9d1ac2660..15abe8b729f5 100644
--- a/core/modules/migrate/src/MigrateExecutable.php
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -221,7 +221,9 @@ class MigrateExecutable implements MigrateExecutableInterface {
if ($save) {
try {
$this->getEventDispatcher()->dispatch(MigrateEvents::PRE_ROW_SAVE, new MigratePreRowSaveEvent($this->migration, $this->message, $row));
- $destination_id_values = $destination->import($row, $id_map->lookupDestinationId($this->sourceIdValues));
+ $destination_ids = $id_map->lookupDestinationIds($this->sourceIdValues);
+ $destination_id_values = $destination_ids ? reset($destination_ids) : [];
+ $destination_id_values = $destination->import($row, $destination_id_values);
$this->getEventDispatcher()->dispatch(MigrateEvents::POST_ROW_SAVE, new MigratePostRowSaveEvent($this->migration, $this->message, $row, $destination_id_values));
if ($destination_id_values) {
// We do not save an idMap entry for config.
diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
index 8f33ba6db150..957da811c86b 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
@@ -95,9 +95,9 @@ class MigrateExecutableTest extends MigrateTestCase {
->will($this->returnValue(['id' => 'test']));
$this->idMap->expects($this->once())
- ->method('lookupDestinationId')
+ ->method('lookupDestinationIds')
->with(['id' => 'test'])
- ->will($this->returnValue(['test']));
+ ->will($this->returnValue([['test']]));
$source->expects($this->once())
->method('current')
@@ -137,9 +137,9 @@ class MigrateExecutableTest extends MigrateTestCase {
->will($this->returnValue(['id' => 'test']));
$this->idMap->expects($this->once())
- ->method('lookupDestinationId')
+ ->method('lookupDestinationIds')
->with(['id' => 'test'])
- ->will($this->returnValue(['test']));
+ ->will($this->returnValue([['test']]));
$source->expects($this->once())
->method('current')
@@ -213,9 +213,9 @@ class MigrateExecutableTest extends MigrateTestCase {
->method('saveMessage');
$this->idMap->expects($this->once())
- ->method('lookupDestinationId')
+ ->method('lookupDestinationIds')
->with(['id' => 'test'])
- ->will($this->returnValue(['test']));
+ ->will($this->returnValue([['test']]));
$this->message->expects($this->once())
->method('display')
@@ -269,9 +269,9 @@ class MigrateExecutableTest extends MigrateTestCase {
->method('saveMessage');
$this->idMap->expects($this->once())
- ->method('lookupDestinationId')
+ ->method('lookupDestinationIds')
->with(['id' => 'test'])
- ->will($this->returnValue(['test']));
+ ->will($this->returnValue([['test']]));
$this->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable->import());
}
@@ -319,7 +319,7 @@ class MigrateExecutableTest extends MigrateTestCase {
->method('saveMessage');
$this->idMap->expects($this->never())
- ->method('lookupDestinationId');
+ ->method('lookupDestinationIds');
$this->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable->import());
}
@@ -367,9 +367,9 @@ class MigrateExecutableTest extends MigrateTestCase {
->method('saveMessage');
$this->idMap->expects($this->once())
- ->method('lookupDestinationId')
+ ->method('lookupDestinationIds')
->with(['id' => 'test'])
- ->will($this->returnValue(['test']));
+ ->will($this->returnValue([['test']]));
$this->message->expects($this->once())
->method('display')
diff --git a/core/modules/serialization/serialization.services.yml b/core/modules/serialization/serialization.services.yml
index dca609478708..942ee05c6d61 100644
--- a/core/modules/serialization/serialization.services.yml
+++ b/core/modules/serialization/serialization.services.yml
@@ -85,7 +85,7 @@ services:
class: Drupal\serialization\EntityResolver\UuidResolver
tags:
- { name: entity_resolver}
- arguments: ['@entity.manager']
+ arguments: ['@entity.repository']
serialization.entity_resolver.target_id:
class: Drupal\serialization\EntityResolver\TargetIdResolver
tags:
diff --git a/core/modules/serialization/src/EntityResolver/UuidResolver.php b/core/modules/serialization/src/EntityResolver/UuidResolver.php
index 4a3b0a20591d..561b4f7fdbd8 100644
--- a/core/modules/serialization/src/EntityResolver/UuidResolver.php
+++ b/core/modules/serialization/src/EntityResolver/UuidResolver.php
@@ -2,7 +2,7 @@
namespace Drupal\serialization\EntityResolver;
-use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityRepositoryInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
@@ -11,20 +11,20 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class UuidResolver implements EntityResolverInterface {
/**
- * The entity manager.
+ * The entity repository.
*
- * @var \Drupal\Core\Entity\EntityManagerInterface
+ * @var \Drupal\Core\Entity\EntityRepositoryInterface
*/
- protected $entityManager;
+ protected $entityRepository;
/**
* Constructs a UuidResolver object.
*
- * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
- * The entity manager.
+ * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
+ * The entity repository.
*/
- public function __construct(EntityManagerInterface $entity_manager) {
- $this->entityManager = $entity_manager;
+ public function __construct(EntityRepositoryInterface $entity_repository) {
+ $this->entityRepository = $entity_repository;
}
/**
@@ -35,7 +35,7 @@ class UuidResolver implements EntityResolverInterface {
// deserialized. If it can return a UUID from that data, and if there's an
// entity with that UUID, then return its ID.
if (($normalizer instanceof UuidReferenceInterface) && ($uuid = $normalizer->getUuid($data))) {
- if ($entity = $this->entityManager->loadEntityByUuid($entity_type, $uuid)) {
+ if ($entity = $this->entityRepository->loadEntityByUuid($entity_type, $uuid)) {
return $entity->id();
}
}
diff --git a/core/modules/serialization/src/Normalizer/EntityNormalizer.php b/core/modules/serialization/src/Normalizer/EntityNormalizer.php
index 4103d1dd7a50..ef746a589987 100644
--- a/core/modules/serialization/src/Normalizer/EntityNormalizer.php
+++ b/core/modules/serialization/src/Normalizer/EntityNormalizer.php
@@ -40,7 +40,7 @@ class EntityNormalizer extends ComplexDataNormalizer implements DenormalizerInte
// The bundle property will be required to denormalize a bundleable
// fieldable entity.
- if ($entity_type_definition->isSubclassOf(FieldableEntityInterface::class)) {
+ if ($entity_type_definition->entityClassImplements(FieldableEntityInterface::class)) {
// Extract bundle data to pass into entity creation if the entity type uses
// bundles.
if ($entity_type_definition->hasKey('bundle')) {
diff --git a/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php b/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php
index 812392568a6f..4abd9ff384b7 100644
--- a/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php
+++ b/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\serialization\Unit\EntityResolver;
+use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\serialization\EntityResolver\UuidResolver;
@@ -29,7 +30,7 @@ class UuidResolverTest extends UnitTestCase {
* {@inheritdoc}
*/
protected function setUp() {
- $this->entityManager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
+ $this->entityManager = $this->getMockBuilder(EntityRepositoryInterface::class)
->disableOriginalConstructor()
->getMock();
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
index 689d654bd9e9..a5b0000b4f06 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
@@ -119,7 +119,7 @@ class EntityNormalizerTest extends UnitTestCase {
->with('bundle')
->will($this->returnValue('test_type'));
$entity_type->expects($this->once())
- ->method('isSubClassOf')
+ ->method('entityClassImplements')
->with(FieldableEntityInterface::class)
->willReturn(TRUE);
@@ -240,7 +240,7 @@ class EntityNormalizerTest extends UnitTestCase {
->with('bundle')
->will($this->returnValue('test_type'));
$entity_type->expects($this->once())
- ->method('isSubClassOf')
+ ->method('entityClassImplements')
->with(FieldableEntityInterface::class)
->willReturn(TRUE);
@@ -303,7 +303,7 @@ class EntityNormalizerTest extends UnitTestCase {
$entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
$entity_type->expects($this->once())
- ->method('isSubClassOf')
+ ->method('entityClassImplements')
->with(FieldableEntityInterface::class)
->willReturn(TRUE);
$entity_type->expects($this->once())
@@ -376,7 +376,7 @@ class EntityNormalizerTest extends UnitTestCase {
$entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
$entity_type->expects($this->once())
- ->method('isSubClassOf')
+ ->method('entityClassImplements')
->with(FieldableEntityInterface::class)
->willReturn(FALSE);
diff --git a/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php b/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php
index efcead4fbaa3..e61901166a13 100644
--- a/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php
+++ b/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php
@@ -19,6 +19,13 @@ class RolesRidTest extends UnitTestCase {
* Tests the titleQuery method.
*
* @covers ::titleQuery
+ *
+ * @group legacy
+ *
+ * Note this is only a legacy test because it triggers a call to
+ * \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback() which is mocked
+ * and triggers a deprecation error. Remove when ::getLabelCallback() is
+ * removed.
*/
public function testTitleQuery() {
$role1 = new Role([
diff --git a/core/modules/views/src/ViewsData.php b/core/modules/views/src/ViewsData.php
index e5281abf3645..09522b984f5a 100644
--- a/core/modules/views/src/ViewsData.php
+++ b/core/modules/views/src/ViewsData.php
@@ -133,10 +133,8 @@ class ViewsData {
*
* @param string|null $key
* The key of the cache entry to retrieve. Defaults to NULL, this will
- * return all table data.
- *
- * @deprecated NULL $key deprecated in Drupal 8.2.x and will be removed in
- * 9.0.0. Use getAll() instead.
+ * return all table data. NULL $key deprecated in Drupal 8.2.x and will be
+ * removed in 9.0.0. Use getAll() instead.
*
* @see https://www.drupal.org/node/2723553
*
diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist
index 4c56583f36d8..7819f99f297a 100644
--- a/core/phpunit.xml.dist
+++ b/core/phpunit.xml.dist
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 3462fcfc7ce3..5dc391e6d5ce 100644
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -310,7 +310,12 @@ All arguments are long options.
--suppress-deprecations
- Stops tests from failing if deprecation errors are triggered.
+ Stops tests from failing if deprecation errors are triggered. If
+ this is not set the value specified in the
+ SYMFONY_DEPRECATIONS_HELPER environment variable, or the value
+ specified in core/phpunit.xml (if it exists), or the default value
+ will be used. The default is that any unexpected silenced
+ deprecation error will fail tests.
[,[, ...]]
@@ -825,13 +830,6 @@ function simpletest_script_run_one_test($test_id, $test_class) {
if ($args['suppress-deprecations']) {
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
}
- else {
- // Prevent deprecations caused by vendor code calling deprecated code.
- // This also prevents mock objects in PHPUnit 6 triggering silenced
- // deprecations from breaking the test suite. We should consider changing
- // this to 'strict' once PHPUnit 4 is no longer used.
- putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
- }
if (is_subclass_of($test_class, TestCase::class)) {
$status = simpletest_script_run_phpunit($test_id, $test_class);
}
diff --git a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
index 99ba0a5ef9c4..05aff5e93c01 100644
--- a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
@@ -114,6 +114,12 @@ class AssetResolverTest extends UnitTestCase {
/**
* @covers ::getCssAssets
* @dataProvider providerAttachedAssets
+ * @group legacy
+ *
+ * Note the legacy group is used here because
+ * ActiveTheme::getStyleSheetsRemove() is called and is deprecated. As this
+ * code path will still be triggered until Drupal 9 we have to add the group.
+ * We do not trigger a silenced deprecation.
*/
public function testGetCssAssets(AttachedAssetsInterface $assets_a, AttachedAssetsInterface $assets_b, $expected_cache_item_count) {
$this->assetResolver->getCssAssets($assets_a, FALSE);
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index 0d56516dd231..52cdd7621fc4 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -483,6 +483,8 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
/**
* @covers ::label
+ *
+ * @group legacy
*/
public function testLabel() {
// Make a mock with one method that we use as the entity's label callback.
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
index 38e9502e99a3..c606cb0d1b38 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
@@ -58,6 +58,13 @@ class EntityLinkTest extends UnitTestCase {
* @covers ::link
*
* @dataProvider providerTestLink
+ *
+ * @group legacy
+ *
+ * Note this is only a legacy test because it triggers a call to
+ * \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback() which is mocked
+ * and triggers a deprecation error. Remove when ::getLabelCallback() is
+ * removed.
*/
public function testLink($entity_label, $link_text, $expected_text, $link_rel = 'canonical', array $link_options = []) {
$language = new Language(['id' => 'es']);
@@ -120,6 +127,13 @@ class EntityLinkTest extends UnitTestCase {
* @covers ::toLink
*
* @dataProvider providerTestLink
+ *
+ * @group legacy
+ *
+ * Note this is only a legacy test because it triggers a call to
+ * \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback() which is mocked
+ * and triggers a deprecation error. Remove when ::getLabelCallback() is
+ * removed.
*/
public function testToLink($entity_label, $link_text, $expected_text, $link_rel = 'canonical', array $link_options = []) {
$language = new Language(['id' => 'es']);
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
index 8cb36eb89ebe..141668def575 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
@@ -168,6 +168,7 @@ class EntityUnitTest extends UnitTestCase {
/**
* @covers ::label
+ * @group legacy
*/
public function testLabel() {
// Make a mock with one method that we use as the entity's uri_callback. We
diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php
index f901117e50f5..57358cde16c2 100644
--- a/core/tests/Drupal/Tests/WebAssert.php
+++ b/core/tests/Drupal/Tests/WebAssert.php
@@ -155,7 +155,7 @@ class WebAssert extends MinkWebAssert {
$option_field = $select_field->find('named', ['option', $option]);
if ($option_field === NULL) {
- throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $option);
+ throw new ElementNotFoundException($this->session->getDriver(), 'select', 'id|name|label|value', $option);
}
return $option_field;