jeudi 29 octobre 2015

Laravel5.1 Testing JSON APIs ,Array or Object Error

My Test Code

public function test_Query()
{
    $this->post('/Controller/User_Controller/query', ['id' => $this::$id])
        ->seeJson([
            'data'   => [ 0 =>['username' =>  $this::$id.'_update']],
        ]);
}

But printf error

1) User_Test::test_Query
Unable to find JSON fragment ["data":[{"username":"1137598_update"}]] within [{"current_page":1,"data":[{"updated_at":"2015-10-29 18:57:13","username":"1137598_update"}]}].
Failed asserting that false is true.

I guess the match should not be a problem arrays and objects ? Or that I need all the attributes of data are included



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire