NodeReferenceFieldTest.php in Drupal 9
File
core/modules/migrate_drupal/tests/src/Unit/Plugin/migrate/field/d6/NodeReferenceFieldTest.php
View source
<?php
namespace Drupal\Tests\migrate_drupal\Unit\Plugin\migrate\field\d6;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\migrate_drupal\Plugin\migrate\field\NodeReference;
use Prophecy\Argument;
class NodeReferenceFieldTest extends UnitTestCase {
protected $plugin;
protected $migration;
protected function setUp() : void {
$this->plugin = new NodeReference([], 'nodereference', []);
$migration = $this
->prophesize(MigrationInterface::class);
$migration
->setProcessOfProperty(Argument::type('string'), Argument::type('array'))
->will(function ($arguments) use ($migration) {
$migration
->getProcess()
->willReturn($arguments[1]);
});
$this->migration = $migration
->reveal();
}
public function testDefineValueProcessPipeline() {
$this
->expectDeprecation('The Drupal\\migrate_drupal\\Plugin\\migrate\\field\\NodeReference is deprecated in drupal:9.1.0 and will be removed from drupal:10.0.0. Instead use \\Drupal\\migrate_drupal\\Plugin\\migrate\\field\\d6\\NodeReference. See https://www.drupal.org/node/3159537.');
$this->plugin
->defineValueProcessPipeline($this->migration, 'somefieldname', []);
$expected = [
'plugin' => 'sub_process',
'source' => 'somefieldname',
'process' => [
'target_id' => 'nid',
],
];
$this
->assertSame($expected, $this->migration
->getProcess());
}
}