public function PerComponentEntityFormDisplayTest::testImport in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php \Drupal\Tests\migrate\Unit\destination\PerComponentEntityFormDisplayTest::testImport()
Tests the entity display import method.
File
- core/
modules/ migrate/ tests/ src/ Unit/ destination/ PerComponentEntityFormDisplayTest.php, line 24 - Contains \Drupal\Tests\migrate\Unit\destination\PerComponentEntityFormDisplayTest.
Class
- PerComponentEntityFormDisplayTest
- Tests the entity display destination plugin.
Namespace
Drupal\Tests\migrate\Unit\destinationCode
public function testImport() {
$values = array(
'entity_type' => 'entity_type_test',
'bundle' => 'bundle_test',
'form_mode' => 'form_mode_test',
'field_name' => 'field_name_test',
'options' => array(
'test setting',
),
);
$row = new Row(array(), array());
foreach ($values as $key => $value) {
$row
->setDestinationProperty($key, $value);
}
$entity = $this
->getMockBuilder('Drupal\\Core\\Entity\\Entity\\EntityFormDisplay')
->disableOriginalConstructor()
->getMock();
$entity
->expects($this
->once())
->method('setComponent')
->with('field_name_test', array(
'test setting',
))
->will($this
->returnSelf());
$entity
->expects($this
->once())
->method('save')
->with();
$plugin = new TestPerComponentEntityFormDisplay($entity);
$this
->assertSame($plugin
->import($row), array(
'entity_type_test',
'bundle_test',
'form_mode_test',
'field_name_test',
));
$this
->assertSame($plugin
->getTestValues(), array(
'entity_type_test',
'bundle_test',
'form_mode_test',
));
}