Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -12,6 +12,9 @@ use Drupal\Component\Utility\Random;
|
|||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
|
||||
|
||||
|
||||
/**
|
||||
* Provides a base class and helpers for Drupal unit tests.
|
||||
|
@ -48,12 +51,6 @@ abstract class UnitTestCase extends \PHPUnit_Framework_TestCase {
|
|||
FileCacheFactory::setConfiguration(['default' => ['class' => '\Drupal\Component\FileCache\NullFileCache']]);
|
||||
|
||||
$this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
|
||||
|
||||
// Reset the static list of SafeStrings to prevent bleeding between tests.
|
||||
$reflected_class = new \ReflectionClass('\Drupal\Component\Utility\SafeMarkup');
|
||||
$reflected_property = $reflected_class->getProperty('safeStrings');
|
||||
$reflected_property->setAccessible(true);
|
||||
$reflected_property->setValue([]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,11 +211,19 @@ abstract class UnitTestCase extends \PHPUnit_Framework_TestCase {
|
|||
$translation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
|
||||
$translation->expects($this->any())
|
||||
->method('translate')
|
||||
->will($this->returnCallback('Drupal\Component\Utility\SafeMarkup::format'));
|
||||
->willReturnCallback(function ($string, array $args = array(), array $options = array()) use ($translation) {
|
||||
return new TranslatableMarkup($string, $args, $options, $translation);
|
||||
});
|
||||
$translation->expects($this->any())
|
||||
->method('translateString')
|
||||
->willReturnCallback(function (TranslatableMarkup $wrapper) {
|
||||
return $wrapper->getUntranslatedString();
|
||||
});
|
||||
$translation->expects($this->any())
|
||||
->method('formatPlural')
|
||||
->willReturnCallback(function ($count, $singular, $plural, array $args = [], array $options = []) {
|
||||
return $count === 1 ? SafeMarkup::format($singular, $args) : SafeMarkup::format($plural, $args + ['@count' => $count]);
|
||||
->willReturnCallback(function ($count, $singular, $plural, array $args = [], array $options = []) use ($translation) {
|
||||
$wrapper = new PluralTranslatableMarkup($count, $singular, $plural, $args, $options, $translation);
|
||||
return $wrapper;
|
||||
});
|
||||
return $translation;
|
||||
}
|
||||
|
|
Reference in a new issue