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

testPutActionWithInvalidAttribute() public method

    public function testPutActionWithInvalidAttribute()
    {
        $person = new Person();
        $person->name = "Stan Lemon";
        $this->em->persist($person);
        $this->em->flush($person);
        $this->em->clear();
        $request = $this->makeRequest('POST', '/person/' . $person->id, json_encode(array('name' => '')));
        /** @var \Symfony\Component\HttpFoundation\Response $response */
        $response = $this->controller->putAction($request, 'person', $person->id);
        $this->assertEquals(400, $response->getStatusCode());
        $refresh = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findOneBy(array('id' => $person->id));
        $this->assertNotNull($refresh);
        $this->assertEquals($person->name, $refresh->name);
    }