X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FUnitTestCase.php;h=37012c5ed48759e8d1f73808faa83048bfa837ec;hp=f96b5109e83ec38151f47b2bf25e31dfe133a1c1;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/tests/Drupal/Tests/UnitTestCase.php b/web/core/tests/Drupal/Tests/UnitTestCase.php index f96b5109e..37012c5ed 100644 --- a/web/core/tests/Drupal/Tests/UnitTestCase.php +++ b/web/core/tests/Drupal/Tests/UnitTestCase.php @@ -8,14 +8,16 @@ use Drupal\Core\Cache\CacheTagsInvalidatorInterface; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; - +use PHPUnit\Framework\TestCase; /** * Provides a base class and helpers for Drupal unit tests. * * @ingroup testing */ -abstract class UnitTestCase extends \PHPUnit_Framework_TestCase { +abstract class UnitTestCase extends TestCase { + + use PhpunitCompatibilityTrait; /** * The random generator. @@ -135,7 +137,7 @@ abstract class UnitTestCase extends \PHPUnit_Framework_TestCase { } // 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 @@ abstract class UnitTestCase extends \PHPUnit_Framework_TestCase { * 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 @@ abstract class UnitTestCase extends \PHPUnit_Framework_TestCase { * 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 @@ abstract class UnitTestCase extends \PHPUnit_Framework_TestCase { * 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 @@ abstract class UnitTestCase extends \PHPUnit_Framework_TestCase { * 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) {