Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[YAML] Arrays encoded as object #17710

Copy link
Copy link
Closed
Closed
Copy link
@johnknl

Description

@johnknl
Issue body actions
    /**
     * 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 pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.