I'm trying to test if a "name" is actually inserted into my controller.
I created this test to check for the "name":
public function testStoreName()
{
$json = '{"name":"FOO", "address":"fubar City", "nickname":"fubar"}';
$post = $this->action('POST', 'FooController@store', null, array(), array(), array(), $json);
$output= json_decode($this->client->getResponse()->getContent());
$output->name;
if($output->name != "")
{
echo "Test Passed\n\n";
}
elseif($output->name == "")
{
echo "Name cannot be null";
}
// $this->assertTrue($this->client->getResponse()->isOk());
}
But when I alter the $json and set "name": ""; I get errors. I want it to say that "name cannot be null.