class InternalViolationTest
Same name and namespace in other branches
- 10 core/tests/Drupal/Tests/Core/Field/InternalViolationTest.php \Drupal\Tests\Core\Field\InternalViolationTest
@coversDefaultClass \Drupal\Core\Field\InternalViolation
@group legacy
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Field\InternalViolationTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of InternalViolationTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Field/ InternalViolationTest.php, line 13
Namespace
Drupal\Tests\Core\FieldView source
class InternalViolationTest extends UnitTestCase {
/**
* @covers ::__get
* @covers ::__set
*/
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);
}
/**
* @covers ::__get
* @covers ::__set
*/
public function testSetGetArrayPropertyPath() {
$violation = new InternalViolation($this->prophesize(ConstraintViolationInterface::class)
->reveal());
$this->expectDeprecation('Accessing the arrayPropertyPath property is deprecated in drupal:9.5.0 and is removed from drupal:11.0.0. Use \\Symfony\\Component\\Validator\\ConstraintViolationInterface::getPropertyPath() instead. See https://www.drupal.org/node/3307919');
$violation->arrayPropertyPath = [
'bar',
];
$this->assertSame([
'bar',
], $violation->arrayPropertyPath);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.