public function testPostActionReturnsErrorBecauseAttributesAreMissing()
{
//error need to be tested as production or exception will be thrown in debug mode.
$this->app['config']->set('app.debug', false);
$content = <<<JSON
{
"data": {
"type": "employee",
"attributes": {
"company": "NilPortugues.com",
"surname": "Portugués",
"first_name": "Nil",
"email_address": "nilportugues@localhost",
"job_title": "Web Developer",
"business_phone": "(123)555-0100",
"home_phone": "(123)555-0102",
"mobile_phone": null,
"country_region": "Spain",
"web_page": "http://nilportugues.com",
"notes": null,
"attachments": null
}
}
}
JSON;
$response = $this->call('POST', 'http://localhost/employees', json_decode($content, true), [], [], []);
$this->assertEquals(422, $response->getStatusCode());
$this->assertEquals('application/vnd.api+json', $response->headers->get('Content-type'));
}