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

testDeleteAction() public method

public testDeleteAction ( )
    public function testDeleteAction()
    {
        $person = new Person();
        $person->name = "Stan Lemon";
        $this->em->persist($person);
        $this->em->flush($person);
        $this->em->clear();
        $request = $this->makeRequest('DELETE', '/person/1');
        $person = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findOneBy(array('id' => $person->id));
        $this->assertNotNull($person);
        /** @var \Symfony\Component\HttpFoundation\Response $response */
        $response = $this->controller->deleteAction($request, 'person', $person->id);
        $this->assertEquals("null", $response->getContent());
        $this->assertEquals(204, $response->getStatusCode());
        $person = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findOneBy(array('id' => $person->id));
        $this->assertNull($person);
    }