Commit d185342b authored by catch's avatar catch
Browse files

Issue #3114239 by andypost, Hardik_Patel_12, alexpott, Berdir: Properly...

Issue #3114239 by andypost, Hardik_Patel_12, alexpott, Berdir: Properly deprecate \Drupal\Core\StringTranslation\TranslationWrapper
parent 262b7fcc
......@@ -5,7 +5,19 @@
/**
* Provides translatable string class.
*
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
* @deprecated in drupal:8.0.0 and is removed from drupal:10.0.0.
* Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead.
*
* @see https://www.drupal.org/node/2571255
*/
class TranslationWrapper extends TranslatableMarkup {}
class TranslationWrapper extends TranslatableMarkup {
/**
* {@inheritdoc}
*/
public function __construct($string, array $arguments = [], array $options = [], TranslationInterface $string_translation = NULL) {
@trigger_error(__CLASS__ . ' is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead. See https://www.drupal.org/node/2571255', E_USER_DEPRECATED);
parent::__construct($string, $arguments, $options, $string_translation);
}
}
......@@ -46,7 +46,7 @@ public function testComparison() {
$this->assertEquals($a, $b);
// The two objects are not the same object.
$this->assertNotSame($a, $b);
// TranslationWrappers which have different settings are not equal.
// TranslatableMarkup which have different settings are not equal.
$this->assertNotEquals($a, $c);
$this->assertNotEquals($a, $d);
}
......
<?php
namespace Drupal\Tests\Core\StringTranslation;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\StringTranslation\TranslationWrapper;
use Drupal\Tests\UnitTestCase;
/**
* Tests the TranslationWrapper class.
*
* @coversDefaultClass \Drupal\Core\StringTranslation\TranslationWrapper
* @group StringTranslation
*/
class TranslationWrapperTest extends UnitTestCase {
/**
* @covers ::__construct
* @group legacy
* @expectedDeprecation Drupal\Core\StringTranslation\TranslationWrapper is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead. See https://www.drupal.org/node/2571255
*/
public function testTranslationWrapper() {
$object = new TranslationWrapper('Deprecated');
$this->assertTrue($object instanceof TranslatableMarkup);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment