function InternalViolationTest::testSetGetDynamicProperties

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Field/InternalViolationTest.php \Drupal\Tests\Core\Field\InternalViolationTest::testSetGetDynamicProperties()
  2. 11.x core/tests/Drupal/Tests/Core/Field/InternalViolationTest.php \Drupal\Tests\Core\Field\InternalViolationTest::testSetGetDynamicProperties()

@covers ::__get @covers ::__set

File

core/tests/Drupal/Tests/Core/Field/InternalViolationTest.php, line 19

Class

InternalViolationTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Field%21InternalViolation.php/class/InternalViolation/9" title="Wraps a violation to allow arrayPropertyPath to be deprecated." class="local">\Drupal\Core\Field\InternalViolation</a> @group legacy

Namespace

Drupal\Tests\Core\Field

Code

public function testSetGetDynamicProperties() {
    $violation = new InternalViolation($this->prophesize(ConstraintViolationInterface::class)
        ->reveal());
    $this->expectDeprecation('Setting dynamic properties on violations is deprecated in drupal:9.5.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3307919');
    $this->expectDeprecation('Accessing dynamic properties on violations is deprecated in drupal:9.5.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3307919');
    $violation->foo = 'bar';
    $this->assertSame('bar', $violation->foo);
}

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