summaryrefslogtreecommitdiff
path: root/tests/test_tools/simpletest/encoding.php
diff options
context:
space:
mode:
authorctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
committerctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
commit74b31be9515eddfa63005d6760614badfaba9fea (patch)
tree47c952901dcb5eccd6dd8b7c6ee7e0b6bf176510 /tests/test_tools/simpletest/encoding.php
parent2b11341614ac4a15be697fa8acad07055154ac54 (diff)
parent0c5026b55cde5c104f10686afd8b441568175d38 (diff)
Merge pull request #530 from pradosoft/prado-3.2.43.2.4prado-3.2
Backports for Prado 3.2.4
Diffstat (limited to 'tests/test_tools/simpletest/encoding.php')
-rw-r--r--tests/test_tools/simpletest/encoding.php91
1 files changed, 45 insertions, 46 deletions
diff --git a/tests/test_tools/simpletest/encoding.php b/tests/test_tools/simpletest/encoding.php
index 0dc9fbfa..ca2083a3 100644
--- a/tests/test_tools/simpletest/encoding.php
+++ b/tests/test_tools/simpletest/encoding.php
@@ -5,7 +5,7 @@
* @subpackage WebTester
* @version $Id: encoding.php 1398 2006-09-08 19:31:03Z xue $
*/
-
+
/**#@+
* include other SimpleTest class files
*/
@@ -20,7 +20,7 @@
class SimpleEncodedPair {
protected $_key;
protected $_value;
-
+
/**
* Stashes the data for rendering later.
* @param string $key Form element name.
@@ -30,7 +30,7 @@
$this->_key = $key;
$this->_value = $value;
}
-
+
/**
* The pair as a single string.
* @return string Encoded pair.
@@ -39,7 +39,7 @@
function asRequest() {
return $this->_key . '=' . urlencode($this->_value);
}
-
+
/**
* The MIME part as a string.
* @return string MIME part encoding.
@@ -51,7 +51,7 @@
$part .= "\r\n" . $this->_value;
return $part;
}
-
+
/**
* Is this the value we are looking for?
* @param string $key Identifier.
@@ -61,7 +61,7 @@
function isKey($key) {
return $key == $this->_key;
}
-
+
/**
* Is this the value we are looking for?
* @return string Identifier.
@@ -70,7 +70,7 @@
function getKey() {
return $this->_key;
}
-
+
/**
* Is this the value we are looking for?
* @return string Content.
@@ -90,7 +90,7 @@
protected $_key;
protected $_content;
protected $_filename;
-
+
/**
* Stashes the data for rendering later.
* @param string $key Key to add value to.
@@ -102,7 +102,7 @@
$this->_content = $content;
$this->_filename = $filename;
}
-
+
/**
* The pair as a single string.
* @return string Encoded pair.
@@ -111,7 +111,7 @@
function asRequest() {
return '';
}
-
+
/**
* The MIME part as a string.
* @return string MIME part encoding.
@@ -125,7 +125,7 @@
$part .= "\r\n\r\n" . $this->_content;
return $part;
}
-
+
/**
* Attempts to figure out the MIME type from the
* file extension and the content.
@@ -138,7 +138,7 @@
}
return 'application/octet-stream';
}
-
+
/**
* Tests each character is in the range 0-127.
* @param string $ascii String to test.
@@ -152,7 +152,7 @@
}
return true;
}
-
+
/**
* Is this the value we are looking for?
* @param string $key Identifier.
@@ -162,7 +162,7 @@
function isKey($key) {
return $key == $this->_key;
}
-
+
/**
* Is this the value we are looking for?
* @return string Identifier.
@@ -171,7 +171,7 @@
function getKey() {
return $this->_key;
}
-
+
/**
* Is this the value we are looking for?
* @return string Content.
@@ -190,7 +190,7 @@
*/
class SimpleEncoding {
protected $_request;
-
+
/**
* Starts empty.
* @param array $query Hash of parameters.
@@ -205,7 +205,7 @@
$this->clear();
$this->merge($query);
}
-
+
/**
* Empties the request of parameters.
* @access public
@@ -213,7 +213,7 @@
function clear() {
$this->_request = array();
}
-
+
/**
* Adds a parameter to the query.
* @param string $key Key to add value to.
@@ -232,7 +232,7 @@
$this->_addPair($key, $value);
}
}
-
+
/**
* Adds a new value into the request.
* @param string $key Key to add value to.
@@ -242,7 +242,7 @@
function _addPair($key, $value) {
$this->_request[] = new SimpleEncodedPair($key, $value);
}
-
+
/**
* Adds a MIME part to the query. Does nothing for a
* form encoded packet.
@@ -254,7 +254,7 @@
function attach($key, $content, $filename) {
$this->_request[] = new SimpleAttachment($key, $content, $filename);
}
-
+
/**
* Adds a set of parameters to this query.
* @param array/SimpleQueryString $query Multiple values are
@@ -270,7 +270,7 @@
}
}
}
-
+
/**
* Accessor for single value.
* @return string/array False if missing, string
@@ -293,7 +293,7 @@
return $values;
}
}
-
+
/**
* Accessor for listing of pairs.
* @return array All pair objects.
@@ -302,7 +302,7 @@
function getAll() {
return $this->_request;
}
-
+
/**
* Renders the query string as a URL encoded
* request part.
@@ -319,7 +319,7 @@
return implode('&', $statements);
}
}
-
+
/**
* Bundle of GET parameters. Can include
* repeated parameters.
@@ -327,7 +327,7 @@
* @subpackage WebTester
*/
class SimpleGetEncoding extends SimpleEncoding {
-
+
/**
* Starts empty.
* @param array $query Hash of parameters.
@@ -338,7 +338,7 @@
function SimpleGetEncoding($query = false) {
$this->SimpleEncoding($query);
}
-
+
/**
* HTTP request method.
* @return string Always GET.
@@ -347,7 +347,7 @@
function getMethod() {
return 'GET';
}
-
+
/**
* Writes no extra headers.
* @param SimpleSocket $socket Socket to write to.
@@ -355,7 +355,7 @@
*/
function writeHeadersTo($socket) {
}
-
+
/**
* No data is sent to the socket as the data is encoded into
* the URL.
@@ -364,7 +364,7 @@
*/
function writeTo($socket) {
}
-
+
/**
* Renders the query string as a URL encoded
* request part for attaching to a URL.
@@ -375,14 +375,14 @@
return $this->_encode();
}
}
-
+
/**
* Bundle of URL parameters for a HEAD request.
* @package SimpleTest
* @subpackage WebTester
*/
class SimpleHeadEncoding extends SimpleGetEncoding {
-
+
/**
* Starts empty.
* @param array $query Hash of parameters.
@@ -393,7 +393,7 @@
function SimpleHeadEncoding($query = false) {
$this->SimpleGetEncoding($query);
}
-
+
/**
* HTTP request method.
* @return string Always HEAD.
@@ -403,7 +403,7 @@
return 'HEAD';
}
}
-
+
/**
* Bundle of POST parameters. Can include
* repeated parameters.
@@ -411,7 +411,7 @@
* @subpackage WebTester
*/
class SimplePostEncoding extends SimpleEncoding {
-
+
/**
* Starts empty.
* @param array $query Hash of parameters.
@@ -422,7 +422,7 @@
function SimplePostEncoding($query = false) {
$this->SimpleEncoding($query);
}
-
+
/**
* HTTP request method.
* @return string Always POST.
@@ -431,7 +431,7 @@
function getMethod() {
return 'POST';
}
-
+
/**
* Dispatches the form headers down the socket.
* @param SimpleSocket $socket Socket to write to.
@@ -441,7 +441,7 @@
$socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n");
$socket->write("Content-Type: application/x-www-form-urlencoded\r\n");
}
-
+
/**
* Dispatches the form data down the socket.
* @param SimpleSocket $socket Socket to write to.
@@ -450,7 +450,7 @@
function writeTo($socket) {
$socket->write($this->_encode());
}
-
+
/**
* Renders the query string as a URL encoded
* request part for attaching to a URL.
@@ -461,7 +461,7 @@
return '';
}
}
-
+
/**
* Bundle of POST parameters in the multipart
* format. Can include file uploads.
@@ -470,7 +470,7 @@
*/
class SimpleMultipartEncoding extends SimplePostEncoding {
protected $_boundary;
-
+
/**
* Starts empty.
* @param array $query Hash of parameters.
@@ -482,7 +482,7 @@
$this->SimplePostEncoding($query);
$this->_boundary = ($boundary === false ? uniqid('st') : $boundary);
}
-
+
/**
* Dispatches the form headers down the socket.
* @param SimpleSocket $socket Socket to write to.
@@ -492,7 +492,7 @@
$socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n");
$socket->write("Content-Type: multipart/form-data, boundary=" . $this->_boundary . "\r\n");
}
-
+
/**
* Dispatches the form data down the socket.
* @param SimpleSocket $socket Socket to write to.
@@ -501,7 +501,7 @@
function writeTo($socket) {
$socket->write($this->_encode());
}
-
+
/**
* Renders the query string as a URL encoded
* request part.
@@ -517,5 +517,4 @@
$stream .= "--" . $this->_boundary . "--\r\n";
return $stream;
}
- }
-?> \ No newline at end of file
+ } \ No newline at end of file