Lemon\RestBundle\Tests\Controller\ResourceControllerTest::testGetActionForNonExistentObject PHP Method

testGetActionForNonExistentObject() public method

    public function testGetActionForNonExistentObject()
    {
        $id = mt_rand(1, 100);
        $request = $this->makeRequest('GET', '/person/' . $id);
        /** @var \Symfony\Component\HttpFoundation\Response $response */
        $response = $this->controller->getAction($request, 'person', $id);
        $data = json_decode($response->getContent());
        $this->assertEquals(404, $response->getStatusCode());
        $this->assertObjectHasAttribute('code', $data);
        $this->assertObjectHasAttribute('message', $data);
        $this->assertEquals(404, $data->code);
    }