8000 [YAML] Arrays encoded as object · Issue #17710 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[YAML] Arrays encoded as object #17710
Closed
Closed
@johnknl

Description

@johnknl
    /**
     * Check Symfony\Yaml bug
     *
     * @test
     */
    public function willParseArrayAsArrayAndObjectAsObject()
    {
        $yaml = <<<YAML
array:
  - key: one
  - key: two
YAML;

        $actual = Yaml::parse($yaml, true, false, true);
        $this->assertInternalType('object', $actual);

        $this->assertInternalType('array', $actual->array);
        $this->assertInternalType('object', $actual->array[0]);
        $this->assertInternalType('object', $actual->array[1]);
        $this->assertSame('one', $actual->array[0]->key);
        $this->assertSame('two', $actual->array[1]->key);
    }

Result:

PHPUnit 4.8.22 by Sebastian Bergmann and contributors.

F

Time: 174 ms, Memory: 8.25Mb

There was 1 failure:

1) KleijnWeb\SwaggerBundle\Tests\Document\RefResolverTest::willParseArrayAsArrayAndObjectAsObject
Failed asserting that stdClass Object &0000000031cec1200000000029c5fbcc (
    0 => stdClass Object &0000000031cec1de0000000029c5fbcc (
        'key' => 'one'
    )
    1 => stdClass Object &0000000031cec1dd0000000029c5fbcc (
        'key' => 'two'
    )
) is of type "array".

/home/jkleijn/Projects/php/kleijnweb/swagger-bundle/src/Tests/Document/RefResolverTest.php:35

FAILURES!
Tests: 1, Assertions: 2, Failures: 1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pu 2B3B ll requests

    Issue actions

      0