diff core/tests/Drupal/Tests/UnitTestCase.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 1fec387a4317
line wrap: on
line diff
--- a/core/tests/Drupal/Tests/UnitTestCase.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/core/tests/Drupal/Tests/UnitTestCase.php	Fri Feb 23 15:52:07 2018 +0000
@@ -17,6 +17,8 @@
  */
 abstract class UnitTestCase extends TestCase {
 
+  use PhpunitCompatibilityTrait;
+
   /**
    * The random generator.
    *
@@ -135,7 +137,7 @@
     }
     // Construct a config factory with the array of configuration object stubs
     // as its return map.
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $config_factory = $this->createMock('Drupal\Core\Config\ConfigFactoryInterface');
     $config_factory->expects($this->any())
       ->method('get')
       ->will($this->returnValueMap($config_get_map));
@@ -157,7 +159,7 @@
    *   A mocked config storage.
    */
   public function getConfigStorageStub(array $configs) {
-    $config_storage = $this->getMock('Drupal\Core\Config\NullStorage');
+    $config_storage = $this->createMock('Drupal\Core\Config\NullStorage');
     $config_storage->expects($this->any())
       ->method('listAll')
       ->will($this->returnValue(array_keys($configs)));
@@ -204,7 +206,7 @@
    *   A mock translation object.
    */
   public function getStringTranslationStub() {
-    $translation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
+    $translation = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface');
     $translation->expects($this->any())
       ->method('translate')
       ->willReturnCallback(function ($string, array $args = [], array $options = []) use ($translation) {
@@ -234,7 +236,7 @@
    *   The container with the cache tags invalidator service.
    */
   protected function getContainerWithCacheTagsInvalidator(CacheTagsInvalidatorInterface $cache_tags_validator) {
-    $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+    $container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
     $container->expects($this->any())
       ->method('get')
       ->with('cache_tags.invalidator')
@@ -251,7 +253,7 @@
    *   The class resolver stub.
    */
   protected function getClassResolverStub() {
-    $class_resolver = $this->getMock('Drupal\Core\DependencyInjection\ClassResolverInterface');
+    $class_resolver = $this->createMock('Drupal\Core\DependencyInjection\ClassResolverInterface');
     $class_resolver->expects($this->any())
       ->method('getInstanceFromDefinition')
       ->will($this->returnCallback(function ($class) {