In a symfony project, I have a PUT method, and I'm trying to read such data:
$data = file_get_contents('php://input');
When I use Postman, it works, the request is in form-data :
: data
value: {"es_title":"edit","es_text":"text edit"}
But when I try to work with WebTestCase in the project does not work, $data in the PUT method is empty. I try this in a test:
$data = array( "data" => '{"es_title":"edit","es_text":"edit"}'); $this->client->request('PUT', $url, $data, array(), array('HTTP_apikey' => $apikey));
Also i try
$data = array( 'data' => json_encode(array( 'es_title' => 'edit', 'es_text' => 'edit' )) ); $this->client->request('PUT', $url, $data, array(), array('HTTP_apikey' => $apikey));
How to do to pass the test?
source share