class LinkCckTest
Same name in this branch
- 8.9.x core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php \Drupal\Tests\link\Unit\Plugin\migrate\cckfield\LinkCckTest
@coversDefaultClass \Drupal\link\Plugin\migrate\cckfield\d7\LinkField
@group link
@group legacy
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\AssertHelperTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpunitCompatibilityTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\link\Kernel\Plugin\migrate\cckfield\d7\LinkCckTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of LinkCckTest
File
-
core/
modules/ link/ tests/ src/ Kernel/ Plugin/ migrate/ cckfield/ d7/ LinkCckTest.php, line 15
Namespace
Drupal\Tests\link\Kernel\Plugin\migrate\cckfield\d7View source
class LinkCckTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
];
/**
* @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface
*/
protected $plugin;
/**
* @var \Drupal\migrate\Plugin\MigrationInterface
*/
protected $migration;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->plugin = new LinkField([], 'link', []);
$migration = $this->prophesize(MigrationInterface::class);
// The plugin's alterFieldInstanceMigration() method will call
// mergeProcessOfProperty() and return nothing. So, in order to examine the
// process pipeline created by the plugin, we need to ensure that
// getProcess() always returns the last input to mergeProcessOfProperty().
$migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
->will(function ($arguments) use ($migration) {
$migration->getProcess()
->willReturn($arguments[1]);
});
$this->migration = $migration->reveal();
}
/**
* @covers ::alterFieldInstanceMigration
*/
public function testAlterFieldInstanceMigration($method = 'alterFieldInstanceMigration') {
$this->plugin
->{$method}($this->migration);
$expected = [
'plugin' => 'static_map',
'source' => 'settings/title',
'bypass' => TRUE,
'map' => [
'disabled' => DRUPAL_DISABLED,
'optional' => DRUPAL_OPTIONAL,
'required' => DRUPAL_REQUIRED,
],
];
$this->assertSame($expected, $this->migration
->getProcess());
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
LinkCckTest::$migration | protected | property | ||
LinkCckTest::$modules | protected static | property | ||
LinkCckTest::$plugin | protected | property | ||
LinkCckTest::setUp | protected | function | ||
LinkCckTest::testAlterFieldInstanceMigration | public | function | @covers ::alterFieldInstanceMigration[[api-linebreak]] | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.