public function YamlSymfonyTest::testObjectSupportDisabled in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php \Drupal\Tests\Component\Serialization\YamlSymfonyTest::testObjectSupportDisabled()
- 9 core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php \Drupal\Tests\Component\Serialization\YamlSymfonyTest::testObjectSupportDisabled()
Ensures that php object support is disabled.
@covers ::encode
File
- core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlSymfonyTest.php, line 73
Class
- YamlSymfonyTest
- Tests the YamlSymfony serialization implementation.
Namespace
Drupal\Tests\Component\SerializationCode
public function testObjectSupportDisabled() {
$this
->expectException(InvalidDataTypeException::class);
$this
->expectExceptionMessage('Object support when dumping a YAML file has been disabled.');
$object = new \stdClass();
$object->foo = 'bar';
YamlSymfony::encode([
$object,
]);
}