function ContactCategoryTest::providerSource

Same name in other branches
  1. 9 core/modules/contact/tests/src/Kernel/Plugin/migrate/source/ContactCategoryTest.php \Drupal\Tests\contact\Kernel\Plugin\migrate\source\ContactCategoryTest::providerSource()
  2. 8.9.x core/modules/contact/tests/src/Kernel/Plugin/migrate/source/ContactCategoryTest.php \Drupal\Tests\contact\Kernel\Plugin\migrate\source\ContactCategoryTest::providerSource()
  3. 11.x core/modules/contact/tests/src/Kernel/Plugin/migrate/source/ContactCategoryTest.php \Drupal\Tests\contact\Kernel\Plugin\migrate\source\ContactCategoryTest::providerSource()

File

core/modules/contact/tests/src/Kernel/Plugin/migrate/source/ContactCategoryTest.php, line 25

Class

ContactCategoryTest
Tests D6 contact category source plugin.

Namespace

Drupal\Tests\contact\Kernel\Plugin\migrate\source

Code

public static function providerSource() {
    $tests = [
        [
            'source_data' => [],
            'expected_data' => [],
        ],
    ];
    $tests[0]['expected_data'] = [
        [
            'cid' => 1,
            'category' => 'contact category value 1',
            'recipients' => [
                'admin@example.com',
                'user@example.com',
            ],
            'reply' => 'auto reply value 1',
            'weight' => 0,
            'selected' => 0,
        ],
        [
            'cid' => 2,
            'category' => 'contact category value 2',
            'recipients' => [
                'admin@example.com',
                'user@example.com',
            ],
            'reply' => 'auto reply value 2',
            'weight' => 0,
            'selected' => 0,
        ],
    ];
    foreach ($tests[0]['expected_data'] as $k => $row) {
        $row['recipients'] = implode(',', $row['recipients']);
        $tests[0]['source_data']['contact'][$k] = $row;
    }
    return $tests;
}

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