function MigrateExecutableTest::testImportWithValidRowWithoutDestinationId

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowWithoutDestinationId()
  2. 10 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowWithoutDestinationId()
  3. 11.x core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowWithoutDestinationId()

Tests the import method with a valid row.

File

core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php, line 132

Class

MigrateExecutableTest
@coversDefaultClass \Drupal\migrate\MigrateExecutable @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

public function testImportWithValidRowWithoutDestinationId() {
    $source = $this->getMockSource();
    $row = $this->getMockBuilder('Drupal\\migrate\\Row')
        ->disableOriginalConstructor()
        ->getMock();
    $this->executable
        ->setSource($source);
    $this->migration
        ->expects($this->once())
        ->method('getProcessPlugins')
        ->willReturn([]);
    $destination = $this->createMock('Drupal\\migrate\\Plugin\\MigrateDestinationInterface');
    $this->migration
        ->method('getDestinationPlugin')
        ->willReturn($destination);
    $this->idMap
        ->expects($this->never())
        ->method('saveIdMapping');
    $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.