You are here

public function YamlPeclTest::testObjectSupportDisabled in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php \Drupal\Tests\Component\Serialization\YamlPeclTest::testObjectSupportDisabled()

Ensures that php object support is disabled.

File

core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php, line 32

Class

YamlPeclTest
Tests the YamlPecl serialization implementation.

Namespace

Drupal\Tests\Component\Serialization

Code

public function testObjectSupportDisabled() {
  $object = new \stdClass();
  $object->foo = 'bar';
  $this
    ->assertEquals([
    'O:8:"stdClass":1:{s:3:"foo";s:3:"bar";}',
  ], YamlPecl::decode(YamlPecl::encode([
    $object,
  ])));
  $this
    ->assertEquals(0, ini_get('yaml.decode_php'));
}