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

testPostActionWithInvalidAttribute() public method

    public function testPostActionWithInvalidAttribute()
    {
        $all = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findAll();
        $total = count($all);
        $request = $this->makeRequest('POST', '/person', json_encode(array('name' => '')));
        /** @var \Symfony\Component\HttpFoundation\Response $response */
        $response = $this->controller->postAction($request, 'person');
        $this->em->clear();
        $this->assertEquals(400, $response->getStatusCode());
        $this->assertEquals($total, count($this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findAll()));
    }