function ConfigTargetTest::testGetValueCorrectConfig

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php \Drupal\Tests\Core\Form\ConfigTargetTest::testGetValueCorrectConfig()

File

core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php, line 224

Class

ConfigTargetTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21ConfigTarget.php/class/ConfigTarget/11.x" title="Represents the mapping of a config property to a form element." class="local">\Drupal\Core\Form\ConfigTarget</a> @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function testGetValueCorrectConfig() : void {
    $sut = new ConfigTarget('foo.settings', $this->randomMachineName());
    $config = $this->prophesize(Config::class);
    $config->getName()
        ->willReturn('bar.settings');
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('Config target is associated with foo.settings but bar.settings given.');
    $sut->getValue($config->reveal());
}

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