assertResponseOk example

$this->assertEquals(2, $this->response->headers->get('Age'));
        $this->cache->terminate($this->request, $this->response);

        $this->assertCount(2, $terminateEvents);
    }

    public function testPassesOnNonGetHeadRequests()
    {
        $this->setNextResponse(200);
        $this->request('POST', '/');
        $this->assertHttpKernelIsCalled();
        $this->assertResponseOk();
        $this->assertTraceContains('pass');
        $this->assertFalse($this->response->headers->has('Age'));
    }

    public function testInvalidatesOnPostPutDeleteRequests()
    {
        foreach (['post', 'put', 'delete'] as $method) {
            $this->setNextResponse(200);
            $this->request($method, '/');

            $this->assertHttpKernelIsCalled();
            
Home | Imprint | This part of the site doesn't use cookies.