class OptGroupTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Form/OptGroupTest.php \Drupal\Tests\Core\Form\OptGroupTest
- 10 core/tests/Drupal/Tests/Core/Form/OptGroupTest.php \Drupal\Tests\Core\Form\OptGroupTest
- 8.9.x core/tests/Drupal/Tests/Core/Form/OptGroupTest.php \Drupal\Tests\Core\Form\OptGroupTest
@coversDefaultClass \Drupal\Core\Form\OptGroup
@group Form
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Form\OptGroupTest implements \Drupal\Tests\UnitTestCase
Expanded class hierarchy of OptGroupTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ OptGroupTest.php, line 12
Namespace
Drupal\Tests\Core\FormView source
class OptGroupTest extends UnitTestCase {
/**
* Tests the flattenOptions() method.
*
* @dataProvider providerTestFlattenOptions
*/
public function testFlattenOptions($options) {
$this->assertSame([
'foo' => 'foo',
], OptGroup::flattenOptions($options));
}
/**
* Provides test data for the flattenOptions() method.
*
* @return array
*/
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.