mardi 3 décembre 2019

Multidimensional array causing error Fatal error: Default value for parameters with a class type hint can only be NULL in PHPunit 5.7 laravel 5.6

I'm pretty stuck on this bug, pretty much this is the code that runs fine

$data = ['tipo'=>1];

      $respuesta = $this->json('POST','api/endpoint',$data);

      $respuesta->assertJsonFragment(['success' => 1]);

and this is the one that gives error Fatal error: Default value for parameters with a class type hint can only be NULL

$data = ['data' => ['tipo'=>1]];

      $respuesta = $this->json('POST','api/endpoint',$data);

      $respuesta->assertJsonFragment(['success' => 1]);

The first one runs perfectly, marking the assertion, the second one, throws that error, now,ive tried, using post(), to no avail, exact same thing happens, so im lost, i dont see how a multidimensional array could do this, and while this specific api doesnt use multidimensional arrays i have many others that do



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire