Skip to content

testShouldTrackAddedValueToEmptyCollection not up to date? #16

@gregor-tb

Description

@gregor-tb

I just patched our code because $set on empty array has created an object when using key.0 = val instead of key = [ val ] (makasim@8d61d69)

But I wonder, why the build does not fail, on my setup this test seems invalid now:

public function testShouldTrackAddedValueToEmptyCollection()
    {
        $obj = $this->createPersistedObject();
        $collector = new ChangesCollector();
        $collector->register($obj, get_values($obj));
        add_value($obj, 'aKey', 'aVal');
        self::assertEquals([
            '$set' => [
                'aKey.0' => 'aVal',
            ],
        ], $collector->changes(get_values($obj), $collector->getOriginalValues($obj)));
    }

Shouldn't it be changed to

            '$set' => [
                'aKey' => [ 'aVal' ],
            ],

?

Thanks for your great work
Gregor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions