lithium\tests\cases\net\http\ServiceTest::testJsonPost PHP Method

testJsonPost() public method

public testJsonPost ( )
    public function testJsonPost()
    {
        $http = new Service($this->_testConfig);
        $data = array('status' => array('cool', 'awesome'));
        $http->post('update.xml', $data, array('type' => 'json'));
        $expected = join("\r\n", array('POST /update.xml HTTP/1.1', 'Host: localhost:80', 'Connection: Close', 'User-Agent: Mozilla/5.0', 'Content-Type: application/json', 'Content-Length: 29', '', '{"status":["cool","awesome"]}'));
        $result = (string) $http->last->request;
        $this->assertEqual($expected, $result);
        $expected = join("\r\n", array('HTTP/1.1 200 OK', 'Host: localhost:80', 'Connection: Close', 'User-Agent: Mozilla/5.0', 'Content-Type: application/json;charset=UTF-8', 'Content-Length: 29', '', '{"status":["cool","awesome"]}'));
        $result = (string) $http->last->response;
        $this->assertEqual($expected, $result);
    }