diff --git a/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php b/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php index f113c7d..5c8354c 100644 --- a/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php +++ b/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php @@ -21,7 +21,10 @@ class ExplodeTest extends MigrateProcessTestCase { * {@inheritdoc} */ protected function setUp() { - $this->plugin = new TestExplode(); + $configuration = [ + 'delimiter' => ',', + ]; + $this->plugin = new Explode($configuration, 'map', []); parent::setUp(); } @@ -29,7 +32,6 @@ protected function setUp() { * Test explode transform process works. */ public function testTransform() { - $this->plugin->setDelimiter(','); $value = $this->plugin->transform('foo,bar,tik', $this->migrateExecutable, $this->row, 'destinationproperty'); $this->assertSame($value, ['foo', 'bar', 'tik']); } @@ -38,10 +40,8 @@ public function testTransform() { * Test explode transform process works with a limit. */ public function testTransformLimit() { - $this->plugin->setDelimiter('_'); - $this->plugin->setLimit(2); - - $value = $this->plugin->transform('foo_bar_tik', $this->migrateExecutable, $this->row, 'destinationproperty'); + $plugin = new Explode(['delimiter' => '_', 'limit' => 2], 'map', []); + $value = $plugin->transform('foo_bar_tik', $this->migrateExecutable, $this->row, 'destinationproperty'); $this->assertSame($value, ['foo', 'bar_tik']); } @@ -49,10 +49,9 @@ public function testTransformLimit() { * Test if the explode process can be chained with a handles_multiple process. */ public function testChainedTransform() { - $this->plugin->setDelimiter(','); $exploded = $this->plugin->transform('foo,bar,tik', $this->migrateExecutable, $this->row, 'destinationproperty'); - $concat = new TestConcatAlso(); + $concat = new Concat([], 'map', []); $concatenated = $concat->transform($exploded, $this->migrateExecutable, $this->row, 'destinationproperty'); $this->assertSame($concatenated, 'foobartik'); } @@ -61,6 +60,7 @@ public function testChainedTransform() { * Test explode fails properly on non-strings. * * @expectedException \Drupal\migrate\MigrateException + * * @expectedExceptionMessage is not a string */ public function testExplodeWithNonString() { @@ -71,42 +71,12 @@ public function testExplodeWithNonString() { * Test explode fails with empty delimiter. * * @expectedException \Drupal\migrate\MigrateException + * * @expectedExceptionMessage delimiter is empty */ public function testExplodeWithEmptyDelimiter() { - $this->plugin->setDelimiter(''); - $this->plugin->transform('foo,bar', $this->migrateExecutable, $this->row, 'destinationproperty'); - } - -} - -class TestExplode extends Explode { - public function __construct() { - } - - /** - * Set the delimiter. - * - * @param string $delimiter - * The new delimiter. - */ - public function setDelimiter($delimiter) { - $this->configuration['delimiter'] = $delimiter; - } - - /** - * Set the limit. - * - * @param integer $limit - * The new limit. - */ - public function setLimit($limit) { - $this->configuration['limit'] = $limit; + $plugin = new Explode(['delimiter' => ''], 'map', []); + $plugin->transform('foo,bar', $this->migrateExecutable, $this->row, 'destinationproperty'); } } - -class TestConcatAlso extends Concat { - public function __construct() { - } -}