function OptGroupTest::providerTestFlattenOptions

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Form/OptGroupTest.php \Drupal\Tests\Core\Form\OptGroupTest::providerTestFlattenOptions()
  2. 10 core/tests/Drupal/Tests/Core/Form/OptGroupTest.php \Drupal\Tests\Core\Form\OptGroupTest::providerTestFlattenOptions()
  3. 11.x core/tests/Drupal/Tests/Core/Form/OptGroupTest.php \Drupal\Tests\Core\Form\OptGroupTest::providerTestFlattenOptions()

Provides test data for the flattenOptions() method.

Return value

array

File

core/tests/Drupal/Tests/Core/Form/OptGroupTest.php, line 28

Class

OptGroupTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21OptGroup.php/class/OptGroup/8.9.x" title="Provides helpers for HTML option groups." class="local">\Drupal\Core\Form\OptGroup</a> @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function providerTestFlattenOptions() {
    $object1 = new \stdClass();
    $object1->option = [
        'foo' => 'foo',
    ];
    $object2 = new \stdClass();
    $object2->option = [
        [
            'foo' => 'foo',
        ],
        [
            'foo' => 'foo',
        ],
    ];
    $object3 = new \stdClass();
    return [
        [
            [
                'foo' => 'foo',
            ],
        ],
        [
            [
                [
                    'foo' => 'foo',
                ],
            ],
        ],
        [
            [
                $object1,
            ],
        ],
        [
            [
                $object2,
            ],
        ],
        [
            [
                $object1,
                $object2,
            ],
        ],
        [
            [
                'foo' => $object3,
                $object1,
                [
                    'foo' => 'foo',
                ],
            ],
        ],
    ];
}

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