function ConfigTargetTest::testSetValueCorrectConfig

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php \Drupal\Tests\Core\Form\ConfigTargetTest::testSetValueCorrectConfig()

File

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

Class

ConfigTargetTest
@coversDefaultClass \Drupal\Core\Form\ConfigTarget @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function testSetValueCorrectConfig() : 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->setValue($config->reveal(), $this->randomString(), $this->prophesize(FormStateInterface::class)
        ->reveal());
}

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