Commit d4b1f4b3 authored by Lucas Hedding's avatar Lucas Hedding Committed by Lucas Hedding
Browse files

Issue #2727975 by heddn, generalconsensus, mpp: Migration Source Data too long for column sourceid1

parent 060fac27
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -120,8 +120,13 @@ class CSV extends SourcePluginBase {
   */
  public function getIDs() {
    $ids = [];
    foreach ($this->configuration['keys'] as $key) {
      $ids[$key]['type'] = 'string';
    foreach ($this->configuration['keys'] as $delta => $value) {
      if (is_array($value)) {
        $ids[$delta] = $value;
      }
      else {
        $ids[$value]['type'] = 'string';
      }
    }
    return $ids;
  }
+32 −0
Original line number Diff line number Diff line
@@ -223,6 +223,38 @@ class CSVUnitTest extends CSVUnitBase {
    $this->assertArrayEquals($expected, $csv->getIds());
  }

  /**
   * Tests that the key is properly identified.
   *
   * @covers ::getIds
   */
  public function testGetIdsComplex() {
    $configuration = [
      'path' => $this->happyPath,
      'keys' => [
        'id',
        'paragraph' => [
          'type' => 'text',
          'size' => 'big',
        ],
      ],
      'header_row_count' => 1,
    ];

    $csv = new CSV($configuration, $this->pluginId, $this->pluginDefinition, $this->migration);

    $expected = [
      'id' => [
        'type' => 'string',
      ],
      'paragraph' => [
        'type' => 'text',
        'size' => 'big',
      ],
    ];
    $this->assertArrayEquals($expected, $csv->getIds());
  }

  /**
   * Tests that fields have a machine name and description.
   *