lithium\tests\cases\action\RequestTest::testConvertToStringWithJson PHP Method

testConvertToStringWithJson() public method

    public function testConvertToStringWithJson()
    {
        $expected = join("\r\n", array('GET /posts HTTP/1.1', 'Host: li3.me', 'Connection: Close', 'User-Agent: Mozilla/5.0', 'Content-Type: application/json', 'Content-Length: 36', '', '{"some":"body","parameter":"values"}'));
        $request = new Request(array('env' => array('HTTP_HOST' => 'li3.me', 'CONTENT_TYPE' => 'application/json', 'HTTP_USER_AGENT' => 'Mozilla/5.0'), 'url' => '/posts', 'body' => '{"some":"body","parameter":"values"}'));
        $this->assertEqual($expected, $request->to('string'));
        $request = new Request(array('env' => array('HTTP_HOST' => 'li3.me', 'CONTENT_TYPE' => 'application/json', 'HTTP_USER_AGENT' => 'Mozilla/5.0'), 'url' => '/posts', 'data' => array('some' => 'body', 'parameter' => 'values')));
        $this->assertEqual($expected, $request->to('string'));
    }
RequestTest