function YamlPeclTest::testObjectSupportDisabled

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php \Drupal\Tests\Component\Serialization\YamlPeclTest::testObjectSupportDisabled()
  2. 8.9.x core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php \Drupal\Tests\Component\Serialization\YamlPeclTest::testObjectSupportDisabled()
  3. 11.x 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 34

Class

YamlPeclTest
Tests the YamlPecl serialization implementation.

Namespace

Drupal\Tests\Component\Serialization

Code

public function testObjectSupportDisabled() : void {
    $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'));
}

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