function EntityReferenceSelectionUnitTest::testSetConfiguration

Tests selection handler plugin configuration set.

@dataProvider providerTestSetConfiguration @covers ::setConfiguration @covers ::resolveBackwardCompatibilityConfiguration @covers ::ensureBackwardCompatibilityConfiguration

Parameters

array $options: The configuration passed to the plugin.

File

core/tests/Drupal/Tests/Core/EntityReferenceSelection/EntityReferenceSelectionUnitTest.php, line 118

Class

EntityReferenceSelectionUnitTest
Provides unit testing for selection handlers.

Namespace

Drupal\Tests\Core\EntityReferenceSelection

Code

public function testSetConfiguration($options) {
    $selection = new TestSelection($options, 'test_selector', []);
    $expected = [
        'target_type' => NULL,
        'handler' => 'test_selector',
        'entity' => NULL,
        'setting1' => 'foo',
        'setting2' => [
            'qux' => 'qux value',
            'bar' => 'bar value',
            'baz' => 'baz value',
        ],
        'setting3' => 'foobar',
        'handler_settings' => [
            'setting1' => 'foo',
            'setting2' => [
                'qux' => 'qux value',
                'bar' => 'bar value',
                'baz' => 'baz value',
            ],
            'setting3' => 'foobar',
        ],
    ];
    $this->assertArrayEquals($expected, $selection->getConfiguration());
}

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