/** * Starts empty. * @param array $query Hash of parameters. * Multiple values are * as lists on a single key. * @access public */ function __construct($query = false, $boundary = false) { parent::__construct($query); $this->boundary = $boundary === false ? uniqid('st') : $boundary; }
function testEmptyEncodingWritesZeroContentLength() { $socket = new MockSimpleSocket(); $socket->expectArgumentsAt(0, 'write', array("Content-Length: 0\r\n")); $socket->expectArgumentsAt(1, 'write', array("Content-Type: application/x-www-form-urlencoded\r\n")); $encoding = new SimplePostEncoding(); $encoding->writeHeadersTo($socket); }
function testAddingLists() { $encoding = new SimplePostEncoding(); $encoding->add('a', array('Hello', 'Goodbye')); $this->assertIdentical($encoding->getValue('a'), array('Hello', 'Goodbye')); $this->assertWritten($encoding, 'a=Hello&a=Goodbye'); }