You are here

public function ElementTest::providerVisibleChildren in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Render/ElementTest.php \Drupal\Tests\Core\Render\ElementTest::providerVisibleChildren()

Data provider for testVisibleChildren.

Return value

array

File

core/tests/Drupal/Tests/Core/Render/ElementTest.php, line 143

Class

ElementTest
@coversDefaultClass \Drupal\Core\Render\Element @group Render

Namespace

Drupal\Tests\Core\Render

Code

public function providerVisibleChildren() {
  return [
    [
      [
        '#property1' => '',
        '#property2' => [],
      ],
      [],
    ],
    [
      [
        '#property1' => '',
        'child1' => [],
      ],
      [
        'child1',
      ],
    ],
    [
      [
        '#property1' => '',
        'child1' => [],
        'child2' => [
          '#access' => TRUE,
        ],
      ],
      [
        'child1',
        'child2',
      ],
    ],
    [
      [
        '#property1' => '',
        'child1' => [],
        'child2' => [
          '#access' => FALSE,
        ],
      ],
      [
        'child1',
      ],
    ],
    'access_result_object_allowed' => [
      [
        '#property1' => '',
        'child1' => [],
        'child2' => [
          '#access' => AccessResult::allowed(),
        ],
      ],
      [
        'child1',
        'child2',
      ],
    ],
    'access_result_object_forbidden' => [
      [
        '#property1' => '',
        'child1' => [],
        'child2' => [
          '#access' => AccessResult::forbidden(),
        ],
      ],
      [
        'child1',
      ],
    ],
    [
      [
        '#property1' => '',
        'child1' => [],
        'child2' => [
          '#type' => 'textfield',
        ],
      ],
      [
        'child1',
        'child2',
      ],
    ],
    [
      [
        '#property1' => '',
        'child1' => [],
        'child2' => [
          '#type' => 'value',
        ],
      ],
      [
        'child1',
      ],
    ],
    [
      [
        '#property1' => '',
        'child1' => [],
        'child2' => [
          '#type' => 'hidden',
        ],
      ],
      [
        'child1',
      ],
    ],
  ];
}