FlattenTest.php

Same filename in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/FlattenTest.php
  2. 10 core/modules/migrate/tests/src/Unit/process/FlattenTest.php
  3. 11.x core/modules/migrate/tests/src/Unit/process/FlattenTest.php

Namespace

Drupal\Tests\migrate\Unit\process

File

core/modules/migrate/tests/src/Unit/process/FlattenTest.php

View source
<?php

namespace Drupal\Tests\migrate\Unit\process;

use Drupal\migrate\Plugin\migrate\process\Flatten;

/**
 * Tests the flatten plugin.
 *
 * @group migrate
 */
class FlattenTest extends MigrateProcessTestCase {
    
    /**
     * Test that various array flatten operations work properly.
     */
    public function testFlatten() {
        $plugin = new Flatten([], 'flatten', []);
        $flattened = $plugin->transform([
            1,
            2,
            [
                3,
                4,
                [
                    5,
                ],
            ],
            [],
            [
                7,
                8,
            ],
        ], $this->migrateExecutable, $this->row, 'destination_property');
        $this->assertSame([
            1,
            2,
            3,
            4,
            5,
            7,
            8,
        ], $flattened);
    }

}

Classes

Title Deprecated Summary
FlattenTest Tests the flatten plugin.

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