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

testPatchAction() public method

public testPatchAction ( )
    public function testPatchAction()
    {
        $person = new Person();
        $person->name = 'Stan Lemon';
        $person->ssn = '123-45-678';
        $person->favoriteColor = 'purple';
        $this->em->persist($person);
        $this->em->flush($person);
        $this->em->clear();
        $request = $this->makeRequest('PATCH', '/person/' . $person->id, json_encode(array('id' => $person->id, 'favorite_color' => 'blue')));
        $this->controller->patchAction($request, 'person', $person->id);
        $refresh = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findOneBy(array('id' => $person->id));
        $this->assertEquals('blue', $refresh->favoriteColor);
        $this->assertEquals($person->ssn, $refresh->ssn);
        $this->assertEquals($person->name, $refresh->name);
    }