function ConfigTargetTest::testGetValueCorrectConfig

Same name in other branches
  1. 11.x 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 \Drupal\Core\Form\ConfigTarget @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.