jeudi 23 avril 2015

Testing a POST request with specific parameter in Lumen

My Lumen app currently responds to unkown values for a hub.mode parameter with a 501 response. If there is no hub.mode parameter set a 400 response is returned. I can manually test this behavior with cURL with:

curl -v --data "hub.mode=unkown-value" http://lumen.app

As expected there is a 501 response. I can’t seem to test this with phpunit. Here’s my current test case:

public function test501ResponseFromUnkownMode()
{
    $this->call('POST', '/', ['hub.mode' => 'unkown-value']);

    $this->assertResponseStatus(501);
}

However, a 400 response is returned, indicating the hub.mode parameter isn’t being passed by the call() method for some reason. Anyone encountered anything like this before?

Aucun commentaire:

Enregistrer un commentaire