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

testGetAction() public method

public testGetAction ( )
    public function testGetAction()
    {
        $person = new Person();
        $person->name = "Stan Lemon";
        $person->ssn = '123-45-678';
        $this->em->persist($person);
        $this->em->flush($person);
        $this->em->clear();
        $request = $this->makeRequest('GET', '/person/' . $person->id);
        /** @var \Symfony\Component\HttpFoundation\Response $response */
        $response = $this->controller->getAction($request, 'person', $person->id);
        $data = json_decode($response->getContent());
        $this->assertTrue(!isset($data->updated), "Excluded fields should not appear");
        $this->assertEquals($person->id, $data->id);
        $this->assertEquals($person->name, $data->name);
        $this->assertEquals($person->ssn, $data->ssn, "Our read-only property is still readable");
    }