Commit 91fe1d2f authored by alexpott's avatar alexpott

Issue #2929133 by voleger, alexpott, Lendude: Replace all usages of getMock()

parent 2bb3bba5
......@@ -83,11 +83,10 @@ public function testSettingsForm() {
'aggregator_allowed_html_tags' => '',
]);
$test_processor = $this->getMock(
'Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor',
['buildConfigurationForm', 'validateConfigurationForm', 'submitConfigurationForm'],
[[], 'aggregator_test', ['description' => ''], $this->configFactory]
);
$test_processor = $this->getMockBuilder('Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor')
->setMethods(['buildConfigurationForm', 'validateConfigurationForm', 'submitConfigurationForm'])
->setConstructorArgs([[], 'aggregator_test', ['description' => ''], $this->configFactory])
->getMock();
$test_processor->expects($this->at(0))
->method('buildConfigurationForm')
->with($this->anything(), $form_state)
......
......@@ -41,8 +41,8 @@ class BanMiddlewareTest extends UnitTestCase {
protected function setUp() {
parent::setUp();
$this->kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
$this->banManager = $this->getMock('Drupal\ban\BanIpManagerInterface');
$this->kernel = $this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface');
$this->banManager = $this->createMock('Drupal\ban\BanIpManagerInterface');
$this->banMiddleware = new BanMiddleware($this->kernel, $this->banManager);
}
......
......@@ -63,18 +63,18 @@ class BlockConfigEntityUnitTest extends UnitTestCase {
protected function setUp() {
$this->entityTypeId = $this->randomMachineName();
$this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
$this->entityType = $this->createMock('\Drupal\Core\Entity\EntityTypeInterface');
$this->entityType->expects($this->any())
->method('getProvider')
->will($this->returnValue('block'));
$this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
$this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
$this->entityTypeManager->expects($this->any())
->method('getDefinition')
->with($this->entityTypeId)
->will($this->returnValue($this->entityType));
$this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
$this->uuid = $this->createMock('\Drupal\Component\Uuid\UuidInterface');
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
$this->themeHandler = $this->prophesize(ThemeHandlerInterface::class);
......
......@@ -70,13 +70,13 @@ class BlockFormTest extends UnitTestCase {
protected function setUp() {
parent::setUp();
$this->conditionManager = $this->getMock('Drupal\Core\Executable\ExecutableManagerInterface');
$this->language = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->contextRepository = $this->getMock('Drupal\Core\Plugin\Context\ContextRepositoryInterface');
$this->conditionManager = $this->createMock('Drupal\Core\Executable\ExecutableManagerInterface');
$this->language = $this->createMock('Drupal\Core\Language\LanguageManagerInterface');
$this->contextRepository = $this->createMock('Drupal\Core\Plugin\Context\ContextRepositoryInterface');
$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->entityTypeManager = $this->createMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->storage = $this->createMock('Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
$this->themeHandler = $this->createMock('Drupal\Core\Extension\ThemeHandlerInterface');
$this->entityTypeManager->expects($this->any())
->method('getStorage')
->will($this->returnValue($this->storage));
......@@ -123,7 +123,7 @@ public function testGetUniqueMachineName() {
$blocks['other_test_1'] = $this->getBlockMockWithMachineName('other_test');
$blocks['other_test_2'] = $this->getBlockMockWithMachineName('other_test');
$query = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
$query = $this->createMock('Drupal\Core\Entity\Query\QueryInterface');
$query->expects($this->exactly(5))
->method('condition')
->will($this->returnValue($query));
......
......@@ -60,13 +60,13 @@ protected function setUp() {
'bottom',
]);
$theme_manager = $this->getMock('Drupal\Core\Theme\ThemeManagerInterface');
$theme_manager = $this->createMock('Drupal\Core\Theme\ThemeManagerInterface');
$theme_manager->expects($this->atLeastOnce())
->method('getActiveTheme')
->will($this->returnValue($active_theme));
$this->contextHandler = $this->getMock('Drupal\Core\Plugin\Context\ContextHandlerInterface');
$this->blockStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
$this->contextHandler = $this->createMock('Drupal\Core\Plugin\Context\ContextHandlerInterface');
$this->blockStorage = $this->createMock('Drupal\Core\Entity\EntityStorageInterface');
/** @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject $entity_type_manager */
$entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
$entity_type_manager->expects($this->any())
......@@ -86,7 +86,7 @@ protected function setUp() {
public function testGetVisibleBlocksPerRegion(array $blocks_config, array $expected_blocks) {
$blocks = [];
foreach ($blocks_config as $block_id => $block_config) {
$block = $this->getMock('Drupal\block\BlockInterface');
$block = $this->createMock('Drupal\block\BlockInterface');
$block->expects($this->once())
->method('access')
->will($this->returnValue($block_config[0]));
......@@ -155,7 +155,7 @@ public function providerBlocksConfig() {
* @covers ::getVisibleBlocksPerRegion
*/
public function testGetVisibleBlocksPerRegionWithContext() {
$block = $this->getMock('Drupal\block\BlockInterface');
$block = $this->createMock('Drupal\block\BlockInterface');
$block->expects($this->once())
->method('access')
->willReturn(AccessResult::allowed()->addCacheTags(['config:block.block.block_id']));
......
......@@ -21,7 +21,7 @@ class CategoryAutocompleteTest extends UnitTestCase {
protected $autocompleteController;
protected function setUp() {
$block_manager = $this->getMock('Drupal\Core\Block\BlockManagerInterface');
$block_manager = $this->createMock('Drupal\Core\Block\BlockManagerInterface');
$block_manager->expects($this->any())
->method('getCategories')
->will($this->returnValue(['Comment', 'Node', 'None & Such', 'User']));
......
......@@ -40,7 +40,7 @@ protected function setUp() {
'name' => 'test_c',
],
];
$theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
$theme_handler = $this->createMock('Drupal\Core\Extension\ThemeHandlerInterface');
$theme_handler->expects($this->any())
->method('listInfo')
->will($this->returnValue($themes));
......
......@@ -57,8 +57,8 @@ public function setUpDisplayVariant($configuration = [], $definition = []) {
->willReturn(TRUE);
\Drupal::setContainer($container);
$this->blockRepository = $this->getMock('Drupal\block\BlockRepositoryInterface');
$this->blockViewBuilder = $this->getMock('Drupal\Core\Entity\EntityViewBuilderInterface');
$this->blockRepository = $this->createMock('Drupal\block\BlockRepositoryInterface');
$this->blockViewBuilder = $this->createMock('Drupal\Core\Entity\EntityViewBuilderInterface');
return $this->getMockBuilder('Drupal\block\Plugin\DisplayVariant\BlockPageVariant')
->setConstructorArgs([$configuration, 'test', $definition, $this->blockRepository, $this->blockViewBuilder, ['config:block_list']])
......@@ -206,12 +206,12 @@ public function testBuild(array $blocks_config, $visible_block_count, array $exp
$display_variant->setMainContent(['#markup' => 'Hello kittens!']);
$blocks = ['top' => [], 'center' => [], 'bottom' => []];
$block_plugin = $this->getMock('Drupal\Core\Block\BlockPluginInterface');
$main_content_block_plugin = $this->getMock('Drupal\Core\Block\MainContentBlockPluginInterface');
$messages_block_plugin = $this->getMock('Drupal\Core\Block\MessagesBlockPluginInterface');
$title_block_plugin = $this->getMock('Drupal\Core\Block\TitleBlockPluginInterface');
$block_plugin = $this->createMock('Drupal\Core\Block\BlockPluginInterface');
$main_content_block_plugin = $this->createMock('Drupal\Core\Block\MainContentBlockPluginInterface');
$messages_block_plugin = $this->createMock('Drupal\Core\Block\MessagesBlockPluginInterface');
$title_block_plugin = $this->createMock('Drupal\Core\Block\TitleBlockPluginInterface');
foreach ($blocks_config as $block_id => $block_config) {
$block = $this->getMock('Drupal\block\BlockInterface');
$block = $this->createMock('Drupal\block\BlockInterface');
$block->expects($this->atLeastOnce())
->method('getPlugin')
->willReturn($block_config[1] ? $main_content_block_plugin : ($block_config[2] ? $messages_block_plugin : ($block_config[3] ? $title_block_plugin : $block_plugin)));
......
......@@ -39,7 +39,7 @@ protected function setUp() {
'name' => 'test_c',
],
];
$theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
$theme_handler = $this->createMock('Drupal\Core\Extension\ThemeHandlerInterface');
$theme_handler->expects($this->any())
->method('listInfo')
->will($this->returnValue($themes));
......
......@@ -61,8 +61,8 @@ protected function setUp() {
$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->bookOutlineStorage = $this->createMock('Drupal\book\BookOutlineStorageInterface');
$this->renderer = $this->createMock('\Drupal\Core\Render\RendererInterface');
$this->bookManager = new BookManager($this->entityTypeManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer);
}
......
......@@ -45,7 +45,7 @@ class BreakpointTest extends UnitTestCase {
protected function setUp() {
parent::setUp();
$this->stringTranslation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
$this->stringTranslation = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface');
}
/**
......
......@@ -69,11 +69,11 @@ class CommentLinkBuilderTest extends UnitTestCase {
* Prepares mocks for the test.
*/
protected function setUp() {
$this->commentManager = $this->getMock('\Drupal\comment\CommentManagerInterface');
$this->commentManager = $this->createMock('\Drupal\comment\CommentManagerInterface');
$this->stringTranslation = $this->getStringTranslationStub();
$this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
$this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
$this->currentUser = $this->getMock('\Drupal\Core\Session\AccountProxyInterface');
$this->moduleHandler = $this->createMock('\Drupal\Core\Extension\ModuleHandlerInterface');
$this->currentUser = $this->createMock('\Drupal\Core\Session\AccountProxyInterface');
$this->commentLinkBuilder = new CommentLinkBuilder($this->currentUser, $this->commentManager, $this->moduleHandler, $this->stringTranslation, $this->entityTypeManager);
$this->commentManager->expects($this->any())
->method('getFields')
......@@ -269,7 +269,7 @@ public function getLinkCombinations() {
* Mock node for testing.
*/
protected function getMockNode($has_field, $comment_status, $form_location, $comment_count) {
$node = $this->getMock('\Drupal\node\NodeInterface');
$node = $this->createMock('\Drupal\node\NodeInterface');
$node->expects($this->any())
->method('hasField')
->willReturn($has_field);
......@@ -287,7 +287,7 @@ protected function getMockNode($has_field, $comment_status, $form_location, $com
->with('comment')
->willReturn($field_item);
$field_definition = $this->getMock('\Drupal\Core\Field\FieldDefinitionInterface');
$field_definition = $this->createMock('\Drupal\Core\Field\FieldDefinitionInterface');
$field_definition->expects($this->any())
->method('getSetting')
->with('form_location')
......
......@@ -23,7 +23,7 @@ class CommentManagerTest extends UnitTestCase {
*/
public function testGetFields() {
// Set up a content entity type.
$entity_type = $this->getMock('Drupal\Core\Entity\ContentEntityTypeInterface');
$entity_type = $this->createMock('Drupal\Core\Entity\ContentEntityTypeInterface');
$entity_type->expects($this->any())
->method('getClass')
->will($this->returnValue('Node'));
......@@ -51,9 +51,9 @@ public function testGetFields() {
$comment_manager = new CommentManager(
$entity_type_manager,
$this->getMock('Drupal\Core\Config\ConfigFactoryInterface'),
$this->getMock('Drupal\Core\StringTranslation\TranslationInterface'),
$this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'),
$this->createMock('Drupal\Core\Config\ConfigFactoryInterface'),
$this->createMock('Drupal\Core\StringTranslation\TranslationInterface'),
$this->createMock('Drupal\Core\Extension\ModuleHandlerInterface'),
$this->createMock(AccountInterface::class),
$entity_field_manager,
$this->prophesize(EntityDisplayRepositoryInterface::class)->reveal()
......
......@@ -83,7 +83,7 @@ protected function setUp() {
->method('select')
->will($this->returnValue($this->select));
$this->commentStatistics = new CommentStatistics($this->database, $this->getMock('Drupal\Core\Session\AccountInterface'), $this->createMock(EntityTypeManagerInterface::class), $this->getMock('Drupal\Core\State\StateInterface'), $this->database);
$this->commentStatistics = new CommentStatistics($this->database, $this->createMock('Drupal\Core\Session\AccountInterface'), $this->createMock(EntityTypeManagerInterface::class), $this->createMock('Drupal\Core\State\StateInterface'), $this->database);
}
/**
......
......@@ -19,15 +19,15 @@ class CommentLockTest extends UnitTestCase {
*/
public function testLocks() {
$container = new ContainerBuilder();
$container->set('module_handler', $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'));
$container->set('current_user', $this->getMock('Drupal\Core\Session\AccountInterface'));
$container->set('cache.test', $this->getMock('Drupal\Core\Cache\CacheBackendInterface'));
$container->set('comment.statistics', $this->getMock('Drupal\comment\CommentStatisticsInterface'));
$container->set('module_handler', $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface'));
$container->set('current_user', $this->createMock('Drupal\Core\Session\AccountInterface'));
$container->set('cache.test', $this->createMock('Drupal\Core\Cache\CacheBackendInterface'));
$container->set('comment.statistics', $this->createMock('Drupal\comment\CommentStatisticsInterface'));
$request_stack = new RequestStack();
$request_stack->push(Request::create('/'));
$container->set('request_stack', $request_stack);
$container->setParameter('cache_bins', ['cache.test' => 'test']);
$lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
$lock = $this->createMock('Drupal\Core\Lock\LockBackendInterface');
$cid = 2;
$lock_name = "comment:$cid:.00/";
$lock->expects($this->at(0))
......@@ -41,7 +41,7 @@ public function testLocks() {
->method($this->anything());
$container->set('lock', $lock);
$cache_tag_invalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidator');
$cache_tag_invalidator = $this->createMock('Drupal\Core\Cache\CacheTagsInvalidator');
$container->set('cache_tags.invalidator', $cache_tag_invalidator);
\Drupal::setContainer($container);
......@@ -69,7 +69,7 @@ public function testLocks() {
->method('getThread')
->will($this->returnValue(''));
$anon_user = $this->getMock('Drupal\Core\Session\AccountInterface');
$anon_user = $this->createMock('Drupal\Core\Session\AccountInterface');
$anon_user->expects($this->any())
->method('isAnonymous')
->will($this->returnValue(TRUE));
......@@ -77,7 +77,7 @@ public function testLocks() {
->method('getOwner')
->will($this->returnValue($anon_user));
$parent_entity = $this->getMock('\Drupal\Core\Entity\ContentEntityInterface');
$parent_entity = $this->createMock('\Drupal\Core\Entity\ContentEntityInterface');
$parent_entity->expects($this->atLeastOnce())
->method('getCacheTagsToInvalidate')
->willReturn(['node:1']);
......@@ -85,11 +85,11 @@ public function testLocks() {
->method('getCommentedEntity')
->willReturn($parent_entity);
$entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
$entity_type = $this->createMock('\Drupal\Core\Entity\EntityTypeInterface');
$comment->expects($this->any())
->method('getEntityType')
->will($this->returnValue($entity_type));
$storage = $this->getMock('Drupal\comment\CommentStorageInterface');
$storage = $this->createMock('Drupal\comment\CommentStorageInterface');
// preSave() should acquire the lock. (This is what's really being tested.)
$comment->preSave($storage);
......
......@@ -30,20 +30,20 @@ public function testConstructor() {
$actions = [];
for ($i = 1; $i <= 2; $i++) {
$action = $this->getMock('\Drupal\system\ActionConfigEntityInterface');
$action = $this->createMock('\Drupal\system\ActionConfigEntityInterface');
$action->expects($this->any())
->method('getType')
->will($this->returnValue('comment'));
$actions[$i] = $action;
}
$action = $this->getMock('\Drupal\system\ActionConfigEntityInterface');
$action = $this->createMock('\Drupal\system\ActionConfigEntityInterface');
$action->expects($this->any())
->method('getType')
->will($this->returnValue('user'));
$actions[] = $action;
$entity_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
$entity_storage = $this->createMock('Drupal\Core\Entity\EntityStorageInterface');
$entity_storage->expects($this->any())
->method('loadMultiple')
->will($this->returnValue($actions));
......@@ -56,9 +56,9 @@ public function testConstructor() {
$entity_repository = $this->createMock(EntityRepositoryInterface::class);
$language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$language_manager = $this->createMock('Drupal\Core\Language\LanguageManagerInterface');
$messenger = $this->getMock('Drupal\Core\Messenger\MessengerInterface');
$messenger = $this->createMock('Drupal\Core\Messenger\MessengerInterface');
$views_data = $this->getMockBuilder('Drupal\views\ViewsData')
->disableOriginalConstructor()
......@@ -72,7 +72,7 @@ public function testConstructor() {
$container->set('string_translation', $this->getStringTranslationStub());
\Drupal::setContainer($container);
$storage = $this->getMock('Drupal\views\ViewEntityInterface');
$storage = $this->createMock('Drupal\views\ViewEntityInterface');
$storage->expects($this->any())
->method('get')
->with('base_table')
......
......@@ -57,11 +57,11 @@ class ConfigEntityMapperTest extends UnitTestCase {
protected $eventDispatcher;
protected function setUp() {
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entityTypeManager = $this->createMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
$this->entity = $this->createMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
$this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
$this->routeProvider = $this->createMock('Drupal\Core\Routing\RouteProviderInterface');
$this->routeProvider
->expects($this->any())
......@@ -78,15 +78,15 @@ protected function setUp() {
'route_name' => 'config_translation.item.overview.entity.configurable_language.edit_form',
];
$typed_config_manager = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
$typed_config_manager = $this->createMock('Drupal\Core\Config\TypedConfigManagerInterface');
$locale_config_manager = $this->getMockBuilder('Drupal\locale\LocaleConfigManager')
->disableOriginalConstructor()
->getMock();
$this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->languageManager = $this->createMock('Drupal\Core\Language\LanguageManagerInterface');
$this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->eventDispatcher = $this->createMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->configEntityMapper = new ConfigEntityMapper(
'configurable_language',
......@@ -94,7 +94,7 @@ protected function setUp() {
$this->getConfigFactoryStub(),
$typed_config_manager,
$locale_config_manager,
$this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->createMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->routeProvider,
$this->getStringTranslationStub(),
$this->entityTypeManager,
......@@ -113,7 +113,7 @@ public function testEntityGetterAndSetter() {
->with()
->will($this->returnValue('entity_id'));
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type = $this->createMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type
->expects($this->any())
->method('getConfigPrefix')
......@@ -146,7 +146,7 @@ public function testEntityGetterAndSetter() {
* Tests ConfigEntityMapper::getOverviewRouteParameters().
*/
public function testGetOverviewRouteParameters() {
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type = $this->createMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
......@@ -177,7 +177,7 @@ public function testGetType() {
* Tests ConfigEntityMapper::getTypeName().
*/
public function testGetTypeName() {
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type = $this->createMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type->expects($this->once())
->method('getLabel')
->will($this->returnValue('test'));
......@@ -195,7 +195,7 @@ public function testGetTypeName() {
* Tests ConfigEntityMapper::getTypeLabel().
*/
public function testGetTypeLabel() {
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type = $this->createMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type->expects($this->once())
->method('getLabel')
->will($this->returnValue('test'));
......
......@@ -46,8 +46,8 @@ class ConfigFieldMapperTest extends UnitTestCase {
* {@inheritdoc}
*/
protected function setUp() {
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entity = $this->getMock('Drupal\field\FieldConfigInterface');
$this->entityTypeManager = $this->createMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entity = $this->createMock('Drupal\field\FieldConfigInterface');
$definition = [
'class' => '\Drupal\config_translation\ConfigFieldMapper',
......@@ -61,19 +61,19 @@ protected function setUp() {
->disableOriginalConstructor()
->getMock();
$this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->eventDispatcher = $this->createMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->configFieldMapper = new ConfigFieldMapper(
'node_fields',
$definition,
$this->getConfigFactoryStub(),
$this->getMock('Drupal\Core\Config\TypedConfigManagerInterface'),
$this->createMock('Drupal\Core\Config\TypedConfigManagerInterface'),
$locale_config_manager,
$this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->getMock('Drupal\Core\Routing\RouteProviderInterface'),
$this->createMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->createMock('Drupal\Core\Routing\RouteProviderInterface'),
$this->getStringTranslationStub(),
$this->entityTypeManager,
$this->getMock('Drupal\Core\Language\LanguageManagerInterface'),
$this->createMock('Drupal\Core\Language\LanguageManagerInterface'),
$this->eventDispatcher
);
}
......@@ -84,7 +84,7 @@ protected function setUp() {
* @covers ::setEntity
*/
public function testSetEntity() {
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type = $this->createMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type
->expects($this->any())
->method('getConfigPrefix')
......@@ -95,7 +95,7 @@ public function testSetEntity() {
->method('getDefinition')
->will($this->returnValue($entity_type));
$field_storage = $this->getMock('Drupal\field\FieldStorageConfigInterface');
$field_storage = $this->createMock('Drupal\field\FieldStorageConfigInterface');
$field_storage
->expects($this->any())
->method('id')
......
......@@ -32,7 +32,7 @@ class ConfigMapperManagerTest extends UnitTestCase {
protected function setUp() {
$language = new Language(['id' => 'en']);
$language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$language_manager = $this->createMock('Drupal\Core\Language\LanguageManagerInterface');
$language_manager->expects($this->once())
->method('getCurrentLanguage')
->with(LanguageInterface::TYPE_INTERFACE)
......@@ -41,11 +41,11 @@ protected function setUp() {
$this->typedConfigManager = $this->getMockBuilder('Drupal\Core\Config\TypedConfigManagerInterface')
->getMock();
$module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
$theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
$module_handler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface');
$theme_handler = $this->createMock('Drupal\Core\Extension\ThemeHandlerInterface');
$this->configMapperManager = new ConfigMapperManager(
$this->getMock('Drupal\Core\Cache\CacheBackendInterface'),
$this->createMock('Drupal\Core\Cache\CacheBackendInterface'),
$language_manager,
$module_handler,
$this->typedConfigManager,
......@@ -148,7 +148,7 @@ public function providerTestHasTranslatable() {
*/
protected function getElement(array $definition) {
$data_definition = new DataDefinition($definition);
$element = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
$element = $this->createMock('Drupal\Core\TypedData\TypedDataInterface');
$element->expects($this->any())
->method('getDataDefinition')
->will($this->returnValue($data_definition));
......
......@@ -96,7 +96,7 @@ class ConfigNamesMapperTest extends UnitTestCase {
protected $eventDispatcher;
protected function setUp() {
$this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
$this->routeProvider = $this->createMock('Drupal\Core\Routing\RouteProviderInterface');
$this->pluginDefinition = [
'class' => '\Drupal\config_translation\ConfigNamesMapper',
......@@ -106,15 +106,15 @@ protected function setUp() {
'weight' => 42,
];
$this->typedConfigManager = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
$this->typedConfigManager = $this->createMock(