vendredi 1 février 2019

Laravel: assertDatabaseHas - unexpected fail

I don't understand why this database test fails. I'm aware that i don't assert on the created_at and updated_at columns, but the three columns (id, user_id, thing_id) should be enough and i'm sure that i have tested on just a selection of columns before, and it has worked!

What am i missing?

Failed asserting that a row in the table [thing_history] matches the attributes [
        {
            "id": 1,
            "user_id": 1,
            "thing_id": 1
        },
        {
            "id": 2,
            "user_id": 1,
            "thing_id": 2
        },
        {
            "id": 3,
            "user_id": 1,
            "thing_id": 3
        }
    ].

    Found: [
        {
            "id": "1",
            "user_id": "1",
            "thing_id": "1",
            "created_at": "2019-02-01 21:18:17",
            "updated_at": "2019-02-01 21:18:17"
        },
        {
            "id": "2",
            "user_id": "1",
            "thing_id": "2",
            "created_at": "2019-02-01 21:18:17",
            "updated_at": "2019-02-01 21:18:17"
        },
        {
            "id": "3",
            "user_id": "1",
            "thing_id": "3",
            "created_at": "2019-02-01 21:18:17",
            "updated_at": "2019-02-01 21:18:17"
        }
    ]

Aucun commentaire:

Enregistrer un commentaire