function 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.