FormatDate example

/** * Tests that missing configuration will throw an exception. */
  public function testMigrateExceptionMissingFromFormat() {
    $configuration = [
      'from_format' => '',
      'to_format' => 'Y-m-d',
    ];

    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage('Format date plugin is missing from_format configuration.');
    $this->plugin = new FormatDate($configuration, 'test_format_date', []);
    $this->plugin->transform('01/05/1955', $this->migrateExecutable, $this->row, 'field_date');
  }

  /** * Tests that missing configuration will throw an exception. */
  public function testMigrateExceptionMissingToFormat() {
    $configuration = [
      'from_format' => 'm/d/Y',
      'to_format' => '',
    ];

    
Home | Imprint | This part of the site doesn't use cookies.