class ConcatTest
Same name and namespace in other branches
- 11.x core/modules/migrate/tests/src/Unit/process/ConcatTest.php \Drupal\Tests\migrate\Unit\process\ConcatTest
- 10 core/modules/migrate/tests/src/Unit/process/ConcatTest.php \Drupal\Tests\migrate\Unit\process\ConcatTest
- 8.9.x core/modules/migrate/tests/src/Unit/process/ConcatTest.php \Drupal\Tests\migrate\Unit\process\ConcatTest
Tests the concat process plugin.
@group migrate
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Unit\MigrateTestCase extends \Drupal\Tests\UnitTestCase
- class \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase extends \Drupal\Tests\migrate\Unit\MigrateTestCase
- class \Drupal\Tests\migrate\Unit\process\ConcatTest extends \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase
- class \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase extends \Drupal\Tests\migrate\Unit\MigrateTestCase
- class \Drupal\Tests\migrate\Unit\MigrateTestCase extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of ConcatTest
File
-
core/
modules/ migrate/ tests/ src/ Unit/ process/ ConcatTest.php, line 18
Namespace
Drupal\Tests\migrate\Unit\processView source
class ConcatTest extends MigrateProcessTestCase {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
$this->plugin = new TestConcat();
parent::setUp();
}
/**
* Tests concat works without a delimiter.
*/
public function testConcatWithoutDelimiter() {
$value = $this->plugin
->transform([
'foo',
'bar',
], $this->migrateExecutable, $this->row, 'destination_property');
$this->assertSame('foobar', $value);
}
/**
* Tests concat fails properly on non-arrays.
*/
public function testConcatWithNonArray() {
$this->expectException(MigrateException::class);
$this->plugin
->transform('foo', $this->migrateExecutable, $this->row, 'destination_property');
}
/**
* Tests concat works without a delimiter.
*/
public function testConcatWithDelimiter() {
$this->plugin
->setDelimiter('_');
$value = $this->plugin
->transform([
'foo',
'bar',
], $this->migrateExecutable, $this->row, 'destination_property');
$this->assertSame('foo_bar', $value);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.