You are here

public function CSVSourceYieldTest::testFields in Migrate Source CSV 8.2

Test fields method with a source plugin using yield.

Throws

\Drupal\migrate\MigrateException

File

tests/src/Unit/Plugin/migrate/source/CSVSourceYieldTest.php, line 66

Class

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

Namespace

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

Code

public function testFields() {
  $configuration = [
    'path' => $this->happyPath,
    'keys' => [
      'id',
    ],
    'header_row_count' => 1,
  ];
  $plugin = new YieldRows($configuration, $this->pluginId, $this->pluginDefinition, $this->migration);
  $expected_fields = [
    'id' => 'id',
    'first_name' => 'first_name',
    'last_name' => 'last_name',
    'email' => 'email',
    'country' => 'country',
    'ip_address' => 'ip_address',
  ];
  $fields = $plugin
    ->fields();
  $this
    ->assertArrayEquals($expected_fields, $fields);
}