function MigrateExecutableTest::testImportWithValidRowNoDestinationValues
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowNoDestinationValues()
- 10 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowNoDestinationValues()
- 11.x core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowNoDestinationValues()
Tests the import method with a valid row.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateExecutableTest.php, line 177
Class
- MigrateExecutableTest
- @coversDefaultClass \Drupal\migrate\MigrateExecutable @group migrate
Namespace
Drupal\Tests\migrate\UnitCode
public function testImportWithValidRowNoDestinationValues() {
$source = $this->getMockSource();
$row = $this->getMockBuilder('Drupal\\migrate\\Row')
->disableOriginalConstructor()
->getMock();
$row->expects($this->once())
->method('getSourceIdValues')
->will($this->returnValue([
'id' => 'test',
]));
$source->expects($this->once())
->method('current')
->will($this->returnValue($row));
$this->executable
->setSource($source);
$this->migration
->expects($this->once())
->method('getProcessPlugins')
->will($this->returnValue([]));
$destination = $this->createMock('Drupal\\migrate\\Plugin\\MigrateDestinationInterface');
$destination->expects($this->once())
->method('import')
->with($row, [
'test',
])
->will($this->returnValue([]));
$this->migration
->method('getDestinationPlugin')
->willReturn($destination);
$this->idMap
->expects($this->once())
->method('saveIdMapping')
->with($row, [], MigrateIdMapInterface::STATUS_FAILED, NULL);
$this->idMap
->expects($this->once())
->method('messageCount')
->will($this->returnValue(0));
$this->idMap
->expects($this->once())
->method('saveMessage');
$this->idMap
->expects($this->once())
->method('lookupDestinationIds')
->with([
'id' => 'test',
])
->will($this->returnValue([
[
'test',
],
]));
$this->message
->expects($this->once())
->method('display')
->with('New object was not saved, no error provided');
$this->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable
->import());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.