You are here

public function DateFieldTest::testDefineValueProcessPipeline in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/datetime/tests/src/Unit/Plugin/migrate/field/DateFieldTest.php \Drupal\Tests\datetime\Unit\Plugin\migrate\field\DateFieldTest::testDefineValueProcessPipeline()

Tests defineValueProcessPipeline.

@covers ::defineValueProcessPipeline

@dataProvider providerTestDefineValueProcessPipeline

File

core/modules/datetime/tests/src/Unit/Plugin/migrate/field/DateFieldTest.php, line 25

Class

DateFieldTest
Provides unit tests for the DateField Plugin.

Namespace

Drupal\Tests\datetime\Unit\Plugin\migrate\field

Code

public function testDefineValueProcessPipeline($data, $from_format, $to_format) {
  $migration = $this
    ->createMock('Drupal\\migrate\\Plugin\\MigrationInterface');
  $migration
    ->expects($this
    ->once())
    ->method('mergeProcessOfProperty')
    ->with('field_date', [
    'plugin' => 'sub_process',
    'source' => 'field_date',
    'process' => [
      'value' => [
        'plugin' => 'format_date',
        'from_format' => $from_format,
        'to_format' => $to_format,
        'source' => 'value',
      ],
    ],
  ])
    ->will($this
    ->returnValue($migration));
  $plugin = new DateField([], '', []);
  $plugin
    ->defineValueProcessPipeline($migration, 'field_date', $data);
}