Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testShouldTrackAddedValueToEmptyCollection not up to date? #16

Open
gregor-tb opened this issue Aug 14, 2018 · 1 comment
Open

testShouldTrackAddedValueToEmptyCollection not up to date? #16

gregor-tb opened this issue Aug 14, 2018 · 1 comment

Comments

@gregor-tb
Copy link

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

@makasim
Copy link
Contributor

makasim commented Aug 14, 2018

Yeah, you are right, tests are a bit out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants