You are here

public function CSVUnitTest::testMalformedFilePath in Migrate Source CSV 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Plugin/migrate/source/CSVUnitTest.php \Drupal\Tests\migrate_source_csv\Unit\Plugin\migrate\source\CSVUnitTest::testMalformedFilePath()

Tests malformed CSV file path.

@covers ::initializeIterator

File

tests/src/Unit/Plugin/migrate/source/CSVUnitTest.php, line 408

Class

CSVUnitTest
@coversDefaultClass \Drupal\migrate_source_csv\Plugin\migrate\source\CSV

Namespace

Drupal\Tests\migrate_source_csv\Unit\Plugin\migrate\source

Code

public function testMalformedFilePath() : void {
  $configuration = [
    'path' => 'non-existent-path',
    'ids' => [
      'id',
    ],
  ];
  $csv = new CSV($configuration, $this->pluginId, $this->pluginDefinition, $this->migration);
  $this
    ->expectException(\RuntimeException::class);
  $this
    ->expectExceptionMessage('File "non-existent-path" was not found.');
  $csv
    ->initializeIterator();
}