diff --git a/core/modules/migrate/src/Source.php b/core/modules/migrate/src/Source.php index 63a5051..473f46f 100644 --- a/core/modules/migrate/src/Source.php +++ b/core/modules/migrate/src/Source.php @@ -167,7 +167,7 @@ public function __construct(MigrationInterface $migration, MigrateExecutable $mi // Don't allow the use of both highwater and track changes together. if ($this->highWaterProperty && $this->trackChanges) { - throw new MigrateException($this->t('You should either use a highwater mark or track changes not both. They are both designed to solve the same problem')); + throw new MigrateException('You should either use a highwater mark or track changes not both. They are both designed to solve the same problem'); } } @@ -428,27 +428,4 @@ protected function prepareRow(Row $row) { return $result; } - /** - * Translate the string. - * - * @param string $string - * A string containing the English string to translate. - * @param array $args - * (optional) An associative array of replacements to make after translation. Based - * on the first character of the key, the value is escaped and/or themed. - * See format_string() for details. - * @param array $options - * (optional) An associative array of additional options, with the following elements: - * - 'langcode' (defaults to the current language): The language code to - * translate to a language other than what is used to display the page. - * - 'context' (defaults to the empty context): The context the source string - * belongs to. - * - * @return string - * The translated string. - */ - protected function t($string, array $args = array(), array $options = array()) { - return \Drupal::translation()->translate($string, $args, $options); - } - } diff --git a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php index 91e8057..2158a35 100644 --- a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php +++ b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php @@ -7,9 +7,10 @@ namespace Drupal\Tests\migrate\Unit; +use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\migrate\MigrateExecutable; use Drupal\migrate\Plugin\MigrateIdMapInterface; -use Drupal\migrate\TestSource; +use Drupal\migrate\Source; /** * @coversDefaultClass \Drupal\migrate\Source @@ -70,14 +71,14 @@ public function setUp() { public function testHighwaterTrackChangesIncompatible() { $this->migration->set('source', ['track_changes' => TRUE]); $this->migration->set('highWaterProperty', ['name' => 'something']); - new TestSource($this->migration, $this->executable); + new Source($this->migration, $this->executable); } /** * Test that $row->needsUpdate() works as expected. */ public function testNextNeedsUpdate() { - $source = new TestSource($this->migration, $this->executable); + $source = new Source($this->migration, $this->executable); // $row->needsUpdate() === TRUE so we get a row. $source->rewind(); @@ -98,7 +99,7 @@ public function testOutdatedHighwater() { // been imported. This allows us to use the highwater mark to decide on the // outcome of whether we choose to import the row. $this->changeDefaultRowStatus(MigrateIdMapInterface::STATUS_IMPORTED); - $source = new TestSource($this->migration, $this->executable); + $source = new Source($this->migration, $this->executable); // Set the originalHighwater to something higher than our timestamp. $this->migration @@ -126,7 +127,7 @@ public function testNewHighwater() { // Set a highwater property field for source. Now we should have a row // because the row timestamp is greater than the current highwater mark. $this->migration->set('highWaterProperty', ['name' => 'timestamp']); - $source = new TestSource($this->migration, $this->executable); + $source = new Source($this->migration, $this->executable); $source->rewind(); $this->assertTrue(is_a($source->current(), 'Drupal\migrate\Row'), 'Incoming row timestamp is greater than current highwater mark so we have a row.'); @@ -196,11 +197,3 @@ protected function changeDefaultRowStatus($status) { } } - -namespace Drupal\migrate; - -class TestSource extends Source { - protected function t($string, array $args = array(), array $options = array()) { - return $string; - } -}