You are here

public function MigrateExecutableTest::testImportWithValidRowWithException in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowWithException()
  2. 9 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testImportWithValidRowWithException()

Tests the import method with a regular Exception being thrown.

File

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

Class

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

Namespace

Drupal\Tests\migrate\Unit

Code

public function testImportWithValidRowWithException() {
  $exception_message = $this
    ->getRandomGenerator()
    ->string();
  $source = $this
    ->getMockSource();
  $row = $this
    ->getMockBuilder('Drupal\\migrate\\Row')
    ->disableOriginalConstructor()
    ->getMock();
  $this->executable
    ->setSource($source);
  $this->migration
    ->expects($this
    ->once())
    ->method('getProcessPlugins')
    ->will($this
    ->returnValue([]));
  $destination = $this
    ->createMock('Drupal\\migrate\\Plugin\\MigrateDestinationInterface');
  $this->migration
    ->method('getDestinationPlugin')
    ->willReturn($destination);
  $this
    ->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable
    ->import());
}