b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / vendor / jms / serializer / tests / Serializer /
Filename/home/dev2.destoffenstraat.com/vendor/jms/serializer/tests/Serializer/YamlSerializationTest.php
Size3.75 kb
Permissionrw-r--r--
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified22-Feb-2020 21:59
Last accessed23-Aug-2025 03:56
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php

namespace JMS\Serializer\Tests\Serializer;

use JMS\Serializer\Exception\RuntimeException;
use JMS\Serializer\SerializationContext;

class YamlSerializationTest extends BaseSerializationTest
{
public function testObjectUsingTypeCasting()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

public function testEmptyChild()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

public function testSkipEmptyChild()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

public function testConstraintViolation()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

public function testConstraintViolationList()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

public function testFormErrors()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

public function testNestedFormErrors()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

public function testFormErrorsWithNonFormComponents()
{
$this->markTestSkipped('This is not available for the YAML format.');
}

protected function getContent($key)
{
if (!file_exists($file = __DIR__ . '/yml/' . $key . '.yml')) {
throw new RuntimeException(sprintf('The content with key "%s" does not exist.', $key));
}

return file_get_contents($file);
}

public function getTypeHintedArrays()
{
return [

[[1, 2], "- 1\n- 2\n", null],
[['a', 'b'], "- a\n- b\n", null],
[['a' => 'a', 'b' => 'b'], "a: a\nb: b\n", null],

[[], " []\n", null],
[[], " []\n", SerializationContext::create()->setInitialType('array')],
[[], " []\n", SerializationContext::create()->setInitialType('array<integer>')],
[[], " {}\n", SerializationContext::create()->setInitialType('array<string,integer>')],


[[1, 2], "- 1\n- 2\n", SerializationContext::create()->setInitialType('array')],
[[1 => 1, 2 => 2], "1: 1\n2: 2\n", SerializationContext::create()->setInitialType('array')],
[[1 => 1, 2 => 2], "- 1\n- 2\n", SerializationContext::create()->setInitialType('array<integer>')],
[['a', 'b'], "- a\n- b\n", SerializationContext::create()->setInitialType('array<string>')],

[[1 => 'a', 2 => 'b'], "- a\n- b\n", SerializationContext::create()->setInitialType('array<string>')],
[['a' => 'a', 'b' => 'b'], "- a\n- b\n", SerializationContext::create()->setInitialType('array<string>')],


[[1, 2], "0: 1\n1: 2\n", SerializationContext::create()->setInitialType('array<integer,integer>')],
[[1, 2], "0: 1\n1: 2\n", SerializationContext::create()->setInitialType('array<string,integer>')],
[[1, 2], "0: 1\n1: 2\n", SerializationContext::create()->setInitialType('array<string,string>')],


[['a', 'b'], "0: a\n1: b\n", SerializationContext::create()->setInitialType('array<integer,string>')],
[['a' => 'a', 'b' => 'b'], "a: a\nb: b\n", SerializationContext::create()->setInitialType('array<string,string>')],
];
}

/**
* @dataProvider getTypeHintedArrays
* @param array $array
* @param string $expected
* @param SerializationContext|null $context
*/
public function testTypeHintedArraySerialization(array $array, $expected, $context = null)
{
$this->assertEquals($expected, $this->serialize($array, $context));
}


protected function getFormat()
{
return 'yml';
}

protected function hasDeserializer()
{
return false;
}
}