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

testInvalidMethod() public method

public testInvalidMethod ( )
    public function testInvalidMethod()
    {
        $registry = $this->container->get('lemon_rest.object_registry');
        $definition = new Definition('place', 'Lemon\\RestBundle\\Tests\\Fixtures\\Place', true, false, false, true, false);
        $registry->add($definition);
        $place1 = new Place();
        $place1->name = "Seymour";
        $this->em->persist($place1);
        $this->em->flush($place1);
        $this->em->clear();
        $place2 = new Place();
        $place2->name = "Brownstown";
        $this->em->persist($place2);
        $this->em->flush($place2);
        $this->em->clear();
        $places = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Place')->findAll();
        $this->assertCount(2, $places);
        $request = $this->makeRequest('POST', '/place', json_encode(array('name' => 'Smallville')));
        /** @var \Symfony\Component\HttpFoundation\Response $response */
        $response = $this->controller->postAction($request, 'place');
        $this->assertEquals(405, $response->getStatusCode());
        $request = $this->makeRequest('GET', '/place');
        /** @var \Symfony\Component\HttpFoundation\Response $response */
        $response = $this->controller->listAction($request, 'place');
        $this->assertEquals(2, $response->headers->get('X-Total-Count'));
    }