function YamlTest::testEncodeObjectSupportDisabled
Same name in other branches
- 10 core/tests/Drupal/Tests/Component/Serialization/YamlTest.php \Drupal\Tests\Component\Serialization\YamlTest::testEncodeObjectSupportDisabled()
Ensures that php object support is disabled.
@covers ::encode
File
-
core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlTest.php, line 75
Class
- YamlTest
- Tests the Yaml serialization implementation.
Namespace
Drupal\Tests\Component\SerializationCode
public function testEncodeObjectSupportDisabled() : void {
$this->expectException(InvalidDataTypeException::class);
$this->expectExceptionMessage('Object support when dumping a YAML file has been disabled.');
$object = new \stdClass();
$object->foo = 'bar';
Yaml::encode([
$object,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.