function PathSetTranslatedTest::transformDataProvider

Same name in other branches
  1. 9 core/modules/path/tests/src/Unit/migrate/process/PathSetTranslatedTest.php \Drupal\Tests\path\Unit\migrate\process\PathSetTranslatedTest::transformDataProvider()
  2. 8.9.x core/modules/path/tests/src/Unit/migrate/process/PathSetTranslatedTest.php \Drupal\Tests\path\Unit\migrate\process\PathSetTranslatedTest::transformDataProvider()
  3. 10 core/modules/path/tests/src/Unit/migrate/process/PathSetTranslatedTest.php \Drupal\Tests\path\Unit\migrate\process\PathSetTranslatedTest::transformDataProvider()

Provides data for the testTransform method.

Return value

array The data.

File

core/modules/path/tests/src/Unit/migrate/process/PathSetTranslatedTest.php, line 43

Class

PathSetTranslatedTest
Tests the path_set_translated process plugin.

Namespace

Drupal\Tests\path\Unit\migrate\process

Code

public static function transformDataProvider() {
    return [
        'non-node-path' => [
            'path' => '/non-node-path',
            'node_translation' => [
                1,
                'en',
            ],
            'expected_result' => '/non-node-path',
        ],
        'no_translated_node_1' => [
            'path' => '/node/1',
            'node_translation' => 'INVALID_NID',
            'expected_result' => '/node/1',
        ],
        'no_translated_node_2' => [
            'path' => '/node/1',
            'node_translation' => NULL,
            'expected_result' => '/node/1',
        ],
        'no_translated_node_3' => [
            'path' => '/node/1',
            'node_translation' => FALSE,
            'expected_result' => '/node/1',
        ],
        'valid_transform' => [
            'path' => '/node/1',
            'node_translation' => [
                3,
                'en',
            ],
            'expected_result' => '/node/3',
        ],
    ];
}

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