public function GateTest::testGate in Migrate Plus 8.5
Test Gate plugin.
@dataProvider gateProvider
File
- tests/
src/ Unit/ process/ GateTest.php, line 24
Class
- GateTest
- Tests the gate process plugin.
Namespace
Drupal\Tests\migrate_plus\Unit\processCode
public function testGate($row_data, $destination_data, $configuration, $message) : void {
$row = new Row($row_data);
if (!empty($destination_data)) {
foreach ($destination_data as $key => $val) {
$row
->setDestinationProperty($key, $val);
}
}
if (!empty($message)) {
$this
->expectException(MigrateSkipProcessException::class);
$this
->expectExceptionMessage($message);
}
$plugin = new Gate($configuration, 'gate', []);
$value = $row_data[$configuration['source']];
$transformed = $plugin
->transform($value, $this->migrateExecutable, $row, 'destinationproperty');
if (empty($message)) {
$this
->assertSame($value, $transformed);
}
}