Phalcon\Test\Unit\Http\RequestTest::testHttpRequestAcceptableContent PHP Метод

testHttpRequestAcceptableContent() публичный Метод

    public function testHttpRequestAcceptableContent()
    {
        $request = $this->getRequestObject();
        $_SERVER['HTTP_ACCEPT'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json; level=2; q=0.7';
        $accept = $request->getAcceptableContent();
        $this->assertEquals(count($accept), 5);
        $firstAccept = $accept[0];
        $this->assertEquals($firstAccept['accept'], 'text/html');
        $this->assertEquals($firstAccept['quality'], 1);
        $fourthAccept = $accept[3];
        $this->assertEquals($fourthAccept['accept'], '*/*');
        $this->assertEquals($fourthAccept['quality'], 0.8);
        $lastAccept = $accept[4];
        $this->assertEquals($lastAccept['accept'], 'application/json');
        $this->assertEquals($lastAccept['quality'], 0.7);
        $this->assertEquals($lastAccept['level'], 2);
        $this->assertEquals($request->getBestAccept(), 'text/html');
    }