FlattenTest.php 567 Bytes
Newer Older
1 2
<?php

3
namespace Drupal\Tests\migrate\Unit\process;
4

5
use Drupal\migrate\Plugin\migrate\process\Flatten;
6 7 8 9 10 11 12 13 14 15 16 17

/**
 * Tests the flatten plugin.
 *
 * @group migrate
 */
class FlattenTest extends MigrateProcessTestCase {

  /**
   * Test that various array flatten operations work properly.
   */
  public function testFlatten() {
18
    $plugin = new Flatten([], 'flatten', []);
19
    $flattened = $plugin->transform([1, 2, [3, 4, [5]], [], [7, 8]], $this->migrateExecutable, $this->row, 'destination_property');
20
    $this->assertSame([1, 2, 3, 4, 5, 7, 8], $flattened);
21 22 23
  }

}