vendredi 28 août 2015

Laravel's TestCase method seeJson() only looks for array

I'm using Laravel 5.1 Testsuite.

Now, I test my json api with the method seeJson(). This method expects an array, such as:

->seeJson(['created' => 1]);

But my json api always returns a json object or an array with json objects with, in this case:

Response::json(['created' => 1], 200);

In the case above, my json api returns:

{created: 1}

But seeJson() looks for the given array exactly:

[created: 1]

I never get my tests pass without a match. How can I match?

Aucun commentaire:

Enregistrer un commentaire