MINOR: Whitespace fixes in SimpleTest.

This commit is contained in:
Sam Minnee 2015-08-27 13:11:02 +12:00
parent 680b19a1da
commit 0dcccfafb3
8 changed files with 309 additions and 307 deletions

View File

@ -27,7 +27,7 @@ class SimpleCookie {
var $_path;
var $_expiry;
var $_is_secure;
/**
* Constructor. Sets the stored values.
* @param string $name Cookie key.
@ -49,7 +49,7 @@ class SimpleCookie {
}
$this->_is_secure = $is_secure;
}
/**
* Sets the host. The cookie rules determine
* that the first two parts are taken for
@ -67,7 +67,7 @@ class SimpleCookie {
}
return false;
}
/**
* Accessor for the truncated host to which this
* cookie applies.
@ -77,7 +77,7 @@ class SimpleCookie {
function getHost() {
return $this->_host;
}
/**
* Test for a cookie being valid for a host name.
* @param string $host Host to test against.
@ -87,7 +87,7 @@ class SimpleCookie {
function isValidHost($host) {
return ($this->_truncateHost($host) === $this->getHost());
}
/**
* Extracts just the domain part that determines a
* cookie's host validity.
@ -104,7 +104,7 @@ class SimpleCookie {
}
return false;
}
/**
* Accessor for name.
* @return string Cookie key.
@ -113,7 +113,7 @@ class SimpleCookie {
function getName() {
return $this->_name;
}
/**
* Accessor for value. A deleted cookie will
* have an empty string for this.
@ -123,7 +123,7 @@ class SimpleCookie {
function getValue() {
return $this->_value;
}
/**
* Accessor for path.
* @return string Valid cookie path.
@ -132,7 +132,7 @@ class SimpleCookie {
function getPath() {
return $this->_path;
}
/**
* Tests a path to see if the cookie applies
* there. The test path must be longer or
@ -147,7 +147,7 @@ class SimpleCookie {
$this->getPath(),
strlen($this->getPath())) == 0);
}
/**
* Accessor for expiry.
* @return string Expiry string.
@ -159,7 +159,7 @@ class SimpleCookie {
}
return gmdate("D, d M Y H:i:s", $this->_expiry) . " GMT";
}
/**
* Test to see if cookie is expired against
* the cookie format time or timestamp.
@ -180,7 +180,7 @@ class SimpleCookie {
}
return ($this->_expiry < $now);
}
/**
* Ages the cookie by the specified number of
* seconds.
@ -192,7 +192,7 @@ class SimpleCookie {
$this->_expiry -= $interval;
}
}
/**
* Accessor for the secure flag.
* @return boolean True if cookie needs SSL.
@ -201,7 +201,7 @@ class SimpleCookie {
function isSecure() {
return $this->_is_secure;
}
/**
* Adds a trailing and leading slash to the path
* if missing.
@ -227,7 +227,7 @@ class SimpleCookie {
*/
class SimpleCookieJar {
var $_cookies;
/**
* Constructor. Jar starts empty.
* @access public
@ -235,7 +235,7 @@ class SimpleCookieJar {
function __construct() {
$this->_cookies = array();
}
/**
* Removes expired and temporary cookies as if
* the browser was closed and re-opened.
@ -258,7 +258,7 @@ class SimpleCookieJar {
}
$this->_cookies = $surviving_cookies;
}
/**
* Ages all cookies in the cookie jar.
* @param integer $interval The old session is moved
@ -272,7 +272,7 @@ class SimpleCookieJar {
$this->_cookies[$i]->agePrematurely($interval);
}
}
/**
* Sets an additional cookie. If a cookie has
* the same name and path it is replaced.
@ -290,7 +290,7 @@ class SimpleCookieJar {
}
$this->_cookies[$this->_findFirstMatch($cookie)] = $cookie;
}
/**
* Finds a matching cookie to write over or the
* first empty slot if none.
@ -311,7 +311,7 @@ class SimpleCookieJar {
}
return count($this->_cookies);
}
/**
* Reads the most specific cookie value from the
* browser cookies. Looks for the longest path that
@ -335,7 +335,7 @@ class SimpleCookieJar {
}
return (isset($value) ? $value : false);
}
/**
* Tests cookie for matching against search
* criteria.
@ -359,7 +359,7 @@ class SimpleCookieJar {
}
return true;
}
/**
* Uses a URL to sift relevant cookies by host and
* path. Results are list of strings of form "name=value".

View File

@ -5,7 +5,7 @@
* @subpackage WebTester
* @version $Id: encoding.php 1723 2008-04-08 00:34:10Z lastcraft $
*/
/**#@+
* include other SimpleTest class files
*/
@ -20,7 +20,7 @@ require_once(dirname(__FILE__) . '/socket.php');
class SimpleEncodedPair {
var $_key;
var $_value;
/**
* Stashes the data for rendering later.
* @param string $key Form element name.
@ -30,7 +30,7 @@ class SimpleEncodedPair {
$this->_key = $key;
$this->_value = $value;
}
/**
* The pair as a single string.
* @return string Encoded pair.
@ -39,7 +39,7 @@ class SimpleEncodedPair {
function asRequest() {
return urlencode($this->_key) . '=' . urlencode($this->_value);
}
/**
* The MIME part as a string.
* @return string MIME part encoding.
@ -51,7 +51,7 @@ class SimpleEncodedPair {
$part .= "\r\n" . $this->_value;
return $part;
}
/**
* Is this the value we are looking for?
* @param string $key Identifier.
@ -61,7 +61,7 @@ class SimpleEncodedPair {
function isKey($key) {
return $key == $this->_key;
}
/**
* Is this the value we are looking for?
* @return string Identifier.
@ -70,7 +70,7 @@ class SimpleEncodedPair {
function getKey() {
return $this->_key;
}
/**
* Is this the value we are looking for?
* @return string Content.
@ -90,7 +90,7 @@ class SimpleAttachment {
var $_key;
var $_content;
var $_filename;
/**
* Stashes the data for rendering later.
* @param string $key Key to add value to.
@ -102,7 +102,7 @@ class SimpleAttachment {
$this->_content = $content;
$this->_filename = $filename;
}
/**
* The pair as a single string.
* @return string Encoded pair.
@ -111,7 +111,7 @@ class SimpleAttachment {
function asRequest() {
return '';
}
/**
* The MIME part as a string.
* @return string MIME part encoding.
@ -125,7 +125,7 @@ class SimpleAttachment {
$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 @@ class SimpleAttachment {
}
return 'application/octet-stream';
}
/**
* Tests each character is in the range 0-127.
* @param string $ascii String to test.
@ -152,7 +152,7 @@ class SimpleAttachment {
}
return true;
}
/**
* Is this the value we are looking for?
* @param string $key Identifier.
@ -162,7 +162,7 @@ class SimpleAttachment {
function isKey($key) {
return $key == $this->_key;
}
/**
* Is this the value we are looking for?
* @return string Identifier.
@ -171,7 +171,7 @@ class SimpleAttachment {
function getKey() {
return $this->_key;
}
/**
* Is this the value we are looking for?
* @return string Content.
@ -190,7 +190,7 @@ class SimpleAttachment {
*/
class SimpleEncoding {
var $_request;
/**
* Starts empty.
* @param array $query Hash of parameters.
@ -205,7 +205,7 @@ class SimpleEncoding {
$this->clear();
$this->merge($query);
}
/**
* Empties the request of parameters.
* @access public
@ -213,7 +213,7 @@ class SimpleEncoding {
function clear() {
$this->_request = array();
}
/**
* Adds a parameter to the query.
* @param string $key Key to add value to.
@ -232,7 +232,7 @@ class SimpleEncoding {
$this->_addPair($key, $value);
}
}
/**
* Adds a new value into the request.
* @param string $key Key to add value to.
@ -242,7 +242,7 @@ class SimpleEncoding {
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 @@ class SimpleEncoding {
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 @@ class SimpleEncoding {
}
}
}
/**
* Accessor for single value.
* @return string/array False if missing, string
@ -293,7 +293,7 @@ class SimpleEncoding {
return $values;
}
}
/**
* Accessor for listing of pairs.
* @return array All pair objects.
@ -302,7 +302,7 @@ class SimpleEncoding {
function getAll() {
return $this->_request;
}
/**
* Renders the query string as a URL encoded
* request part.
@ -327,7 +327,7 @@ class SimpleEncoding {
* @subpackage WebTester
*/
class SimpleGetEncoding extends SimpleEncoding {
/**
* Starts empty.
* @param array $query Hash of parameters.
@ -335,10 +335,10 @@ class SimpleGetEncoding extends SimpleEncoding {
* as lists on a single key.
* @access public
*/
function SimpleGetEncoding($query = false) {
$this->SimpleEncoding($query);
function __construct($query = false) {
parent::__construct($query);
}
/**
* HTTP request method.
* @return string Always GET.
@ -347,7 +347,7 @@ class SimpleGetEncoding extends SimpleEncoding {
function getMethod() {
return 'GET';
}
/**
* Writes no extra headers.
* @param SimpleSocket $socket Socket to write to.
@ -355,7 +355,7 @@ class SimpleGetEncoding extends SimpleEncoding {
*/
function writeHeadersTo(&$socket) {
}
/**
* No data is sent to the socket as the data is encoded into
* the URL.
@ -364,7 +364,7 @@ class SimpleGetEncoding extends SimpleEncoding {
*/
function writeTo(&$socket) {
}
/**
* Renders the query string as a URL encoded
* request part for attaching to a URL.
@ -382,7 +382,7 @@ class SimpleGetEncoding extends SimpleEncoding {
* @subpackage WebTester
*/
class SimpleHeadEncoding extends SimpleGetEncoding {
/**
* Starts empty.
* @param array $query Hash of parameters.
@ -393,7 +393,7 @@ class SimpleHeadEncoding extends SimpleGetEncoding {
function __construct($query = false) {
parent::__construct($query);
}
/**
* HTTP request method.
* @return string Always HEAD.
@ -411,7 +411,7 @@ class SimpleHeadEncoding extends SimpleGetEncoding {
* @subpackage WebTester
*/
class SimplePostEncoding extends SimpleEncoding {
/**
* Starts empty.
* @param array $query Hash of parameters.
@ -425,7 +425,7 @@ class SimplePostEncoding extends SimpleEncoding {
}
parent::__construct($query);
}
function hasMoreThanOneLevel($query) {
foreach ($query as $key => $value) {
if (is_array($value)) {
@ -449,11 +449,11 @@ class SimplePostEncoding extends SimpleEncoding {
if ($this->hasMoreThanOneLevel($query_)) {
$query_ = $this->rewriteArrayWithMultipleLevels($query_);
}
return $query_;
}
/**
* HTTP request method.
* @return string Always POST.
@ -462,7 +462,7 @@ class SimplePostEncoding extends SimpleEncoding {
function getMethod() {
return 'POST';
}
/**
* Dispatches the form headers down the socket.
* @param SimpleSocket $socket Socket to write to.
@ -472,7 +472,7 @@ class SimplePostEncoding extends SimpleEncoding {
$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.
@ -481,7 +481,7 @@ class SimplePostEncoding extends SimpleEncoding {
function writeTo(&$socket) {
$socket->write($this->_encode());
}
/**
* Renders the query string as a URL encoded
* request part for attaching to a URL.
@ -501,7 +501,7 @@ class SimplePostEncoding extends SimpleEncoding {
*/
class SimpleMultipartEncoding extends SimplePostEncoding {
var $_boundary;
/**
* Starts empty.
* @param array $query Hash of parameters.
@ -513,7 +513,7 @@ class SimpleMultipartEncoding extends SimplePostEncoding {
parent::__construct($query);
$this->_boundary = ($boundary === false ? uniqid('st') : $boundary);
}
/**
* Dispatches the form headers down the socket.
* @param SimpleSocket $socket Socket to write to.
@ -523,7 +523,7 @@ class SimpleMultipartEncoding extends SimplePostEncoding {
$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.
@ -532,7 +532,7 @@ class SimpleMultipartEncoding extends SimplePostEncoding {
function writeTo(&$socket) {
$socket->write($this->_encode());
}
/**
* Renders the query string as a URL encoded
* request part.

View File

@ -5,7 +5,7 @@
* @subpackage WebTester
* @version $Id: form.php 1672 2008-03-02 04:47:34Z edwardzyang $
*/
/**#@+
* include SimpleTest files
*/
@ -30,7 +30,7 @@ class SimpleForm {
var $_widgets;
var $_radios;
var $_checkboxes;
/**
* Starts with no held controls/widgets.
* @param SimpleTag $tag Form tag to read.
@ -48,7 +48,7 @@ class SimpleForm {
$this->_radios = array();
$this->_checkboxes = array();
}
/**
* Creates the request packet to be sent by the form.
* @param SimpleTag $tag Form tag to read.
@ -64,7 +64,7 @@ class SimpleForm {
}
return 'SimpleGetEncoding';
}
/**
* Sets the frame target within a frameset.
* @param string $frame Name of frame.
@ -73,7 +73,7 @@ class SimpleForm {
function setDefaultTarget($frame) {
$this->_default_target = $frame;
}
/**
* Accessor for method of form submission.
* @return string Either get or post.
@ -82,7 +82,7 @@ class SimpleForm {
function getMethod() {
return ($this->_method ? strtolower($this->_method) : 'get');
}
/**
* Combined action attribute with current location
* to get an absolute form target.
@ -96,7 +96,7 @@ class SimpleForm {
}
return $page->expandUrl(new SimpleUrl($action));;
}
/**
* Absolute URL of the target.
* @return SimpleUrl URL target.
@ -109,7 +109,7 @@ class SimpleForm {
}
return $url;
}
/**
* Creates the encoding for the current values in the
* form.
@ -124,7 +124,7 @@ class SimpleForm {
}
return $encoding;
}
/**
* ID field of form for unique identification.
* @return string Unique tag ID.
@ -133,7 +133,7 @@ class SimpleForm {
function getId() {
return $this->_id;
}
/**
* Adds a tag contents to the form.
* @param SimpleWidget $tag Input tag to add.
@ -148,7 +148,7 @@ class SimpleForm {
$this->_setWidget($tag);
}
}
/**
* Sets the widget into the form, grouping radio
* buttons if any.
@ -164,7 +164,7 @@ class SimpleForm {
$this->_widgets[] = &$tag;
}
}
/**
* Adds a radio button, building a group if necessary.
* @param SimpleRadioButtonTag $tag Incoming form control.
@ -177,7 +177,7 @@ class SimpleForm {
}
$this->_widgets[$this->_radios[$tag->getName()]]->addWidget($tag);
}
/**
* Adds a checkbox, making it a group on a repeated name.
* @param SimpleCheckboxTag $tag Incoming form control.
@ -197,7 +197,7 @@ class SimpleForm {
$this->_widgets[$index]->addWidget($tag);
}
}
/**
* Extracts current value from form.
* @param SimpleSelector $selector Criteria to apply.
@ -218,7 +218,7 @@ class SimpleForm {
}
return null;
}
/**
* Sets a widget value within the form.
* @param SimpleSelector $selector Criteria to apply.
@ -243,7 +243,7 @@ class SimpleForm {
}
return $success;
}
/**
* Used by the page object to set widgets labels to
* external label tags.
@ -260,7 +260,7 @@ class SimpleForm {
}
}
}
/**
* Test to see if a form has a submit button.
* @param SimpleSelector $selector Criteria to apply.
@ -275,7 +275,7 @@ class SimpleForm {
}
return false;
}
/**
* Test to see if a form has an image control.
* @param SimpleSelector $selector Criteria to apply.
@ -290,7 +290,7 @@ class SimpleForm {
}
return false;
}
/**
* Gets the submit values for a selected button.
* @param SimpleSelector $selector Criteria to apply.
@ -309,12 +309,12 @@ class SimpleForm {
if ($additional) {
$encoding->merge($additional);
}
return $encoding;
return $encoding;
}
}
return false;
}
/**
* Gets the submit values for an image.
* @param SimpleSelector $selector Criteria to apply.
@ -335,12 +335,12 @@ class SimpleForm {
if ($additional) {
$encoding->merge($additional);
}
return $encoding;
return $encoding;
}
}
return false;
}
/**
* Simply submits the form without the submit button
* value. Used when there is only one button or it

View File

@ -22,7 +22,7 @@ require_once(dirname(__FILE__) . '/url.php');
*/
class SimpleRoute {
var $_url;
/**
* Sets the target URL.
* @param SimpleUrl $url URL as object.
@ -31,7 +31,7 @@ class SimpleRoute {
function __construct($url) {
$this->_url = $url;
}
/**
* Resource name.
* @return SimpleUrl Current url.
@ -40,7 +40,7 @@ class SimpleRoute {
function getUrl() {
return $this->_url;
}
/**
* Creates the first line which is the actual request.
* @param string $method HTTP request method, usually GET.
@ -51,7 +51,7 @@ class SimpleRoute {
return $method . ' ' . $this->_url->getPath() .
$this->_url->getEncodedRequest() . ' HTTP/1.0';
}
/**
* Creates the host part of the request.
* @return string Host line content.
@ -64,7 +64,7 @@ class SimpleRoute {
}
return $line;
}
/**
* Opens a socket to the route.
* @param string $method HTTP request method, usually GET.
@ -86,7 +86,7 @@ class SimpleRoute {
}
return $socket;
}
/**
* Factory for socket.
* @param string $scheme Protocol to use.
@ -116,7 +116,7 @@ class SimpleProxyRoute extends SimpleRoute {
var $_proxy;
var $_username;
var $_password;
/**
* Stashes the proxy address.
* @param SimpleUrl $url URL as object.
@ -131,7 +131,7 @@ class SimpleProxyRoute extends SimpleRoute {
$this->_username = $username;
$this->_password = $password;
}
/**
* Creates the first line which is the actual request.
* @param string $method HTTP request method, usually GET.
@ -146,7 +146,7 @@ class SimpleProxyRoute extends SimpleRoute {
return $method . ' ' . $scheme . '://' . $url->getHost() . $port .
$url->getPath() . $url->getEncodedRequest() . ' HTTP/1.0';
}
/**
* Creates the host part of the request.
* @param SimpleUrl $url URL as object.
@ -158,7 +158,7 @@ class SimpleProxyRoute extends SimpleRoute {
$port = $this->_proxy->getPort() ? $this->_proxy->getPort() : 8080;
return "$host:$port";
}
/**
* Opens a socket to the route.
* @param string $method HTTP request method, usually GET.
@ -198,7 +198,7 @@ class SimpleHttpRequest {
var $_encoding;
var $_headers;
var $_cookies;
/**
* Builds the socket request from the different pieces.
* These include proxy information, URL, cookies, headers,
@ -214,7 +214,7 @@ class SimpleHttpRequest {
$this->_headers = array();
$this->_cookies = array();
}
/**
* Dispatches the content to the route's socket.
* @param integer $timeout Connection timeout.
@ -231,7 +231,7 @@ class SimpleHttpRequest {
$response = &$this->_createResponse($socket);
return $response;
}
/**
* Sends the headers.
* @param SimpleSocket $socket Open socket.
@ -251,7 +251,7 @@ class SimpleHttpRequest {
$socket->write("\r\n");
$encoding->writeTo($socket);
}
/**
* Adds a header line to the request.
* @param string $header_line Text of full header line.
@ -260,7 +260,7 @@ class SimpleHttpRequest {
function addHeaderLine($header_line) {
$this->_headers[] = $header_line;
}
/**
* Reads all the relevant cookies from the
* cookie jar.
@ -271,7 +271,7 @@ class SimpleHttpRequest {
function readCookiesFromJar($jar, $url) {
$this->_cookies = $jar->selectAsPairs($url);
}
/**
* Wraps the socket in a response parser.
* @param SimpleSocket $socket Responding socket.
@ -301,7 +301,7 @@ class SimpleHttpHeaders {
var $_cookies;
var $_authentication;
var $_realm;
/**
* Parses the incoming header block.
* @param string $headers Header block.
@ -320,7 +320,7 @@ class SimpleHttpHeaders {
$this->_parseHeaderLine($header_line);
}
}
/**
* Accessor for parsed HTTP protocol version.
* @return integer HTTP error code.
@ -329,7 +329,7 @@ class SimpleHttpHeaders {
function getHttpVersion() {
return $this->_http_version;
}
/**
* Accessor for raw header block.
* @return string All headers as raw string.
@ -338,7 +338,7 @@ class SimpleHttpHeaders {
function getRaw() {
return $this->_raw_headers;
}
/**
* Accessor for parsed HTTP error code.
* @return integer HTTP error code.
@ -347,7 +347,7 @@ class SimpleHttpHeaders {
function getResponseCode() {
return (integer)$this->_response_code;
}
/**
* Returns the redirected URL or false if
* no redirection.
@ -357,7 +357,7 @@ class SimpleHttpHeaders {
function getLocation() {
return $this->_location;
}
/**
* Test to see if the response is a valid redirect.
* @return boolean True if valid redirect.
@ -367,7 +367,7 @@ class SimpleHttpHeaders {
return in_array($this->_response_code, array(301, 302, 303, 307)) &&
(boolean)$this->getLocation();
}
/**
* Test to see if the response is an authentication
* challenge.
@ -379,7 +379,7 @@ class SimpleHttpHeaders {
(boolean)$this->_authentication &&
(boolean)$this->_realm;
}
/**
* Accessor for MIME type header information.
* @return string MIME type.
@ -388,7 +388,7 @@ class SimpleHttpHeaders {
function getMimeType() {
return $this->_mime_type;
}
/**
* Accessor for authentication type.
* @return string Type.
@ -397,7 +397,7 @@ class SimpleHttpHeaders {
function getAuthentication() {
return $this->_authentication;
}
/**
* Accessor for security realm.
* @return string Realm.
@ -406,7 +406,7 @@ class SimpleHttpHeaders {
function getRealm() {
return $this->_realm;
}
/**
* Writes new cookies to the cookie jar.
* @param SimpleCookieJar $jar Jar to write to.
@ -449,7 +449,7 @@ class SimpleHttpHeaders {
$this->_realm = trim($matches[2]);
}
}
/**
* Parse the Set-cookie content.
* @param string $cookie_line Text after "Set-cookie:"
@ -484,7 +484,7 @@ class SimpleHttpResponse extends SimpleStickyError {
var $_sent;
var $_content;
var $_headers;
/**
* Constructor. Reads and parses the incoming
* content and headers.
@ -507,7 +507,7 @@ class SimpleHttpResponse extends SimpleStickyError {
}
$this->_parse($raw);
}
/**
* Splits up the headers and the rest of the content.
* @param string $raw Content to parse.
@ -525,7 +525,7 @@ class SimpleHttpResponse extends SimpleStickyError {
$this->_headers = new SimpleHttpHeaders($headers);
}
}
/**
* Original request method.
* @return string GET, POST or HEAD.
@ -534,7 +534,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getMethod() {
return $this->_encoding->getMethod();
}
/**
* Resource name.
* @return SimpleUrl Current url.
@ -543,7 +543,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getUrl() {
return $this->_url;
}
/**
* Original request data.
* @return mixed Sent content.
@ -552,7 +552,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getRequestData() {
return $this->_encoding;
}
/**
* Raw request that was sent down the wire.
* @return string Bytes actually sent.
@ -561,7 +561,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getSent() {
return $this->_sent;
}
/**
* Accessor for the content after the last
* header line.
@ -571,7 +571,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getContent() {
return $this->_content;
}
/**
* Accessor for header block. The response is the
* combination of this and the content.
@ -581,7 +581,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getHeaders() {
return $this->_headers;
}
/**
* Accessor for any new cookies.
* @return array List of new cookies.
@ -590,7 +590,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getNewCookies() {
return $this->_headers->getNewCookies();
}
/**
* Reads the whole of the socket output into a
* single string.
@ -606,7 +606,7 @@ class SimpleHttpResponse extends SimpleStickyError {
}
return $all;
}
/**
* Test to see if the packet from the socket is the
* last one.

View File

@ -130,6 +130,7 @@ class SimplePageBuilder extends SimpleSaxListener {
function __construct() {
parent::__construct();
}
/**
* Frees up any references so as to allow the PHP garbage
* collection from unset() to work.
@ -178,7 +179,7 @@ class SimplePageBuilder extends SimpleSaxListener {
$parser = new SimpleHtmlSaxParser($listener);
return $parser;
}
/**
* Start of element event. Opens a new tag.
* @param string $name Element name.

View File

@ -30,7 +30,7 @@ class ParallelRegex {
var $_labels;
var $_regex;
var $_case;
/**
* Constructor. Starts with no patterns.
* @param boolean $case True for case sensitive, false
@ -43,7 +43,7 @@ class ParallelRegex {
$this->_labels = array();
$this->_regex = null;
}
/**
* Adds a pattern with an optional label.
* @param string $pattern Perl style regex, but ( and )
@ -58,7 +58,7 @@ class ParallelRegex {
$this->_labels[$count] = $label;
$this->_regex = null;
}
/**
* Attempts to match all patterns at once against
* a string.
@ -84,7 +84,7 @@ class ParallelRegex {
}
return true;
}
/**
* Compounds the patterns into a single
* regular expression separated with the
@ -105,7 +105,7 @@ class ParallelRegex {
}
return $this->_regex;
}
/**
* Accessor for perl regex mode flags to use.
* @return string Perl regex flags.
@ -123,7 +123,7 @@ class ParallelRegex {
*/
class SimpleStateStack {
var $_stack;
/**
* Constructor. Starts in named state.
* @param string $start Starting state name.
@ -132,7 +132,7 @@ class SimpleStateStack {
function __construct($start) {
$this->_stack = array($start);
}
/**
* Accessor for current state.
* @return string State.
@ -141,7 +141,7 @@ class SimpleStateStack {
function getCurrent() {
return $this->_stack[count($this->_stack) - 1];
}
/**
* Adds a state to the stack and sets it
* to be the current state.
@ -151,7 +151,7 @@ class SimpleStateStack {
function enter($state) {
array_push($this->_stack, $state);
}
/**
* Leaves the current state and reverts
* to the previous one.
@ -183,7 +183,7 @@ class SimpleLexer {
var $_mode;
var $_mode_handlers;
var $_case;
/**
* Sets up the lexer in case insensitive matching
* by default.
@ -200,7 +200,7 @@ class SimpleLexer {
$this->_mode = new SimpleStateStack($start);
$this->_mode_handlers = array($start => $start);
}
/**
* Adds a token search pattern for a particular
* parsing mode. The pattern does not change the
@ -221,7 +221,7 @@ class SimpleLexer {
$this->_mode_handlers[$mode] = $mode;
}
}
/**
* Adds a pattern that will enter a new parsing
* mode. Useful for entering parenthesis, strings,
@ -244,7 +244,7 @@ class SimpleLexer {
$this->_mode_handlers[$new_mode] = $new_mode;
}
}
/**
* Adds a pattern that will exit the current mode
* and re-enter the previous one.
@ -262,7 +262,7 @@ class SimpleLexer {
$this->_mode_handlers[$mode] = $mode;
}
}
/**
* Adds a pattern that has a special mode. Acts as an entry
* and exit pattern in one go, effectively calling a special
@ -284,7 +284,7 @@ class SimpleLexer {
$this->_mode_handlers[$special] = $special;
}
}
/**
* Adds a mapping from a mode to another handler.
* @param string $mode Mode to be remapped.
@ -294,7 +294,7 @@ class SimpleLexer {
function mapHandler($mode, $handler) {
$this->_mode_handlers[$mode] = $handler;
}
/**
* Splits the page text into tokens. Will fail
* if the handlers report an error or if no
@ -328,7 +328,7 @@ class SimpleLexer {
}
return $this->_invokeParser($raw, LEXER_UNMATCHED);
}
/**
* Sends the matched token and any leading unmatched
* text to the parser changing the lexer to a new
@ -364,7 +364,7 @@ class SimpleLexer {
$this->_mode->enter($mode);
return $this->_invokeParser($matched, LEXER_ENTER);
}
/**
* Tests to see if the new mode is actually to leave
* the current mode and pop an item from the matching
@ -376,7 +376,7 @@ class SimpleLexer {
function _isModeEnd($mode) {
return ($mode === "__exit");
}
/**
* Test to see if the mode is one where this mode
* is entered for this token only and automatically
@ -388,7 +388,7 @@ class SimpleLexer {
function _isSpecialMode($mode) {
return (strncmp($mode, "_", 1) == 0);
}
/**
* Strips the magic underscore marking single token
* modes.
@ -399,7 +399,7 @@ class SimpleLexer {
function _decodeSpecial($mode) {
return substr($mode, 1);
}
/**
* Calls the parser method named after the current
* mode. Empty content will be ignored. The lexer
@ -416,7 +416,7 @@ class SimpleLexer {
$handler = $this->_mode_handlers[$this->_mode->getCurrent()];
return $this->_parser->$handler($content, $is_match);
}
/**
* Tries to match a chunk of text and if successful
* removes the recognised chunk and any leading
@ -448,7 +448,7 @@ class SimpleLexer {
* @subpackage WebTester
*/
class SimpleHtmlLexer extends SimpleLexer {
/**
* Sets up the lexer with case insensitive matching
* and adds the HTML handlers.
@ -465,7 +465,7 @@ class SimpleHtmlLexer extends SimpleLexer {
}
$this->_addInTagTokens();
}
/**
* List of parsed tags. Others are ignored.
* @return array List of searched for tags.
@ -475,7 +475,7 @@ class SimpleHtmlLexer extends SimpleLexer {
return array('a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select',
'option', 'frameset', 'frame', 'label');
}
/**
* The lexer has to skip certain sections such
* as server code, client code and styles.
@ -492,7 +492,7 @@ class SimpleHtmlLexer extends SimpleLexer {
$this->addEntryPattern('<!--', 'text', 'comment');
$this->addExitPattern('-->', 'comment');
}
/**
* Pattern matches to start and end a tag.
* @param string $tag Name of tag to scan for.
@ -502,7 +502,7 @@ class SimpleHtmlLexer extends SimpleLexer {
$this->addSpecialPattern("</$tag>", 'text', 'acceptEndToken');
$this->addEntryPattern("<$tag", 'text', 'tag');
}
/**
* Pattern matches to parse the inside of a tag
* including the attributes and their quoting.
@ -515,7 +515,7 @@ class SimpleHtmlLexer extends SimpleLexer {
$this->addExitPattern('/>', 'tag');
$this->addExitPattern('>', 'tag');
}
/**
* Matches attributes that are either single quoted,
* double quoted or unquoted.
@ -546,7 +546,7 @@ class SimpleHtmlSaxParser {
var $_tag;
var $_attributes;
var $_current_attribute;
/**
* Sets the listener.
* @param SimpleSaxListener $listener SAX event handler.
@ -559,7 +559,7 @@ class SimpleHtmlSaxParser {
$this->_attributes = array();
$this->_current_attribute = '';
}
/**
* Runs the content through the lexer which
* should call back to the acceptors.
@ -570,7 +570,7 @@ class SimpleHtmlSaxParser {
function parse($raw) {
return $this->_lexer->parse($raw);
}
/**
* Sets up the matching lexer. Starts in 'text' mode.
* @param SimpleSaxParser $parser Event generator, usually $self.
@ -582,7 +582,7 @@ class SimpleHtmlSaxParser {
$lexer = new SimpleHtmlLexer($parser);
return $lexer;
}
/**
* Accepts a token from the tag mode. If the
* starting element completes then the element
@ -613,7 +613,7 @@ class SimpleHtmlSaxParser {
}
return true;
}
/**
* Accepts a token from the end tag mode.
* The element name is converted to lower case.
@ -628,7 +628,7 @@ class SimpleHtmlSaxParser {
}
return $this->_listener->endElement(strtolower($matches[1]));
}
/**
* Part of the tag data.
* @param string $token Incoming characters.
@ -649,7 +649,7 @@ class SimpleHtmlSaxParser {
}
return true;
}
/**
* A character entity.
* @param string $token Incoming characters.
@ -659,7 +659,7 @@ class SimpleHtmlSaxParser {
*/
function acceptEntityToken($token, $event) {
}
/**
* Character data between tags regarded as
* important.
@ -671,7 +671,7 @@ class SimpleHtmlSaxParser {
function acceptTextToken($token, $event) {
return $this->_listener->addContent($token);
}
/**
* Incoming data to be ignored.
* @param string $token Incoming characters.
@ -682,7 +682,7 @@ class SimpleHtmlSaxParser {
function ignore($token, $event) {
return true;
}
/**
* Decodes any HTML entities.
* @param string $html Incoming HTML.
@ -693,7 +693,7 @@ class SimpleHtmlSaxParser {
static function decodeHtml($html) {
return html_entity_decode($html, ENT_QUOTES);
}
/**
* Turns HTML into text browser visible text. Images
* are converted to their alt text and tags are supressed.
@ -723,14 +723,14 @@ class SimpleHtmlSaxParser {
* @abstract
*/
class SimpleSaxListener {
/**
* Sets the document to write to.
* @access public
*/
function __construct() {
}
/**
* Start of element event.
* @param string $name Element name.
@ -742,7 +742,7 @@ class SimpleSaxListener {
*/
function startElement($name, $attributes) {
}
/**
* End of element event.
* @param string $name Element name.
@ -751,7 +751,7 @@ class SimpleSaxListener {
*/
function endElement($name) {
}
/**
* Unparsed, but relevant data.
* @param string $text May include unparsed tags.

View File

@ -5,7 +5,7 @@
* @subpackage WebTester
* @version $Id: tag.php 1723 2008-04-08 00:34:10Z lastcraft $
*/
/**#@+
* include SimpleTest files
*/
@ -22,7 +22,7 @@ class SimpleTag {
var $_name;
var $_attributes;
var $_content;
/**
* Starts with a named tag with attributes only.
* @param string $name Tag name.
@ -36,7 +36,7 @@ class SimpleTag {
$this->_attributes = $attributes;
$this->_content = '';
}
/**
* Check to see if the tag can have both start and
* end tags with content in between.
@ -46,7 +46,7 @@ class SimpleTag {
function expectEndTag() {
return true;
}
/**
* The current tag should not swallow all content for
* itself as it's searchable page content. Private
@ -68,7 +68,7 @@ class SimpleTag {
function addContent($content) {
$this->_content .= (string)$content;
}
/**
* Adds an enclosed tag to the content.
* @param SimpleTag $tag New tag.
@ -76,7 +76,7 @@ class SimpleTag {
*/
function addTag(&$tag) {
}
/**
* Accessor for tag name.
* @return string Name of tag.
@ -85,7 +85,7 @@ class SimpleTag {
function getTagName() {
return $this->_name;
}
/**
* List of legal child elements.
* @return array List of element names.
@ -94,7 +94,7 @@ class SimpleTag {
function getChildElements() {
return array();
}
/**
* Accessor for an attribute.
* @param string $label Attribute name.
@ -108,7 +108,7 @@ class SimpleTag {
}
return (string)$this->_attributes[$label];
}
/**
* Sets an attribute.
* @param string $label Attribute name.
@ -118,7 +118,7 @@ class SimpleTag {
function _setAttribute($label, $value) {
$this->_attributes[strtolower($label)] = $value;
}
/**
* Accessor for the whole content so far.
* @return string Content as big raw string.
@ -127,7 +127,7 @@ class SimpleTag {
function getContent() {
return $this->_content;
}
/**
* Accessor for content reduced to visible text. Acts
* like a text mode browser, normalising space and
@ -138,7 +138,7 @@ class SimpleTag {
function getText() {
return SimpleHtmlSaxParser::normalise($this->_content);
}
/**
* Test to see if id attribute matches.
* @param string $id ID to test against.
@ -156,7 +156,7 @@ class SimpleTag {
* @subpackage WebTester
*/
class SimpleBaseTag extends SimpleTag {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -182,7 +182,7 @@ class SimpleBaseTag extends SimpleTag {
* @subpackage WebTester
*/
class SimpleTitleTag extends SimpleTag {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -199,7 +199,7 @@ class SimpleTitleTag extends SimpleTag {
* @subpackage WebTester
*/
class SimpleAnchorTag extends SimpleTag {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -208,7 +208,7 @@ class SimpleAnchorTag extends SimpleTag {
function __construct($attributes) {
parent::__construct('a', $attributes);
}
/**
* Accessor for URL as string.
* @return string Coerced as string.
@ -232,7 +232,7 @@ class SimpleWidget extends SimpleTag {
var $_value;
var $_label;
var $_is_set;
/**
* Starts with a named tag with attributes only.
* @param string $name Tag name.
@ -245,7 +245,7 @@ class SimpleWidget extends SimpleTag {
$this->_label = false;
$this->_is_set = false;
}
/**
* Accessor for name submitted as the key in
* GET/POST variables hash.
@ -255,7 +255,7 @@ class SimpleWidget extends SimpleTag {
function getName() {
return $this->getAttribute('name');
}
/**
* Accessor for default value parsed with the tag.
* @return string Parsed value.
@ -264,7 +264,7 @@ class SimpleWidget extends SimpleTag {
function getDefault() {
return $this->getAttribute('value');
}
/**
* Accessor for currently set value or default if
* none.
@ -278,7 +278,7 @@ class SimpleWidget extends SimpleTag {
}
return $this->_value;
}
/**
* Sets the current form element value.
* @param string $value New value.
@ -290,7 +290,7 @@ class SimpleWidget extends SimpleTag {
$this->_is_set = true;
return true;
}
/**
* Resets the form element value back to the
* default.
@ -299,7 +299,7 @@ class SimpleWidget extends SimpleTag {
function resetValue() {
$this->_is_set = false;
}
/**
* Allows setting of a label externally, say by a
* label tag.
@ -309,7 +309,7 @@ class SimpleWidget extends SimpleTag {
function setLabel($label) {
$this->_label = trim($label);
}
/**
* Reads external or internal label.
* @param string $label Label to test.
@ -319,7 +319,7 @@ class SimpleWidget extends SimpleTag {
function isLabel($label) {
return $this->_label == trim($label);
}
/**
* Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet.
@ -338,7 +338,7 @@ class SimpleWidget extends SimpleTag {
* @subpackage WebTester
*/
class SimpleTextTag extends SimpleWidget {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -350,7 +350,7 @@ class SimpleTextTag extends SimpleWidget {
$this->_setAttribute('value', '');
}
}
/**
* Tag contains no content.
* @return boolean False.
@ -359,7 +359,7 @@ class SimpleTextTag extends SimpleWidget {
function expectEndTag() {
return false;
}
/**
* Sets the current form element value. Cannot
* change the value of a hidden field.
@ -381,7 +381,7 @@ class SimpleTextTag extends SimpleWidget {
* @subpackage WebTester
*/
class SimpleSubmitTag extends SimpleWidget {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -393,7 +393,7 @@ class SimpleSubmitTag extends SimpleWidget {
$this->_setAttribute('value', 'Submit');
}
}
/**
* Tag contains no end element.
* @return boolean False.
@ -402,7 +402,7 @@ class SimpleSubmitTag extends SimpleWidget {
function expectEndTag() {
return false;
}
/**
* Disables the setting of the button value.
* @param string $value Ignored.
@ -412,7 +412,7 @@ class SimpleSubmitTag extends SimpleWidget {
function setValue($value) {
return false;
}
/**
* Value of browser visible text.
* @return string Visible label.
@ -421,7 +421,7 @@ class SimpleSubmitTag extends SimpleWidget {
function getLabel() {
return $this->getValue();
}
/**
* Test for a label match when searching.
* @param string $label Label to test.
@ -432,14 +432,14 @@ class SimpleSubmitTag extends SimpleWidget {
return trim($label) == trim($this->getLabel());
}
}
/**
* Image button as input tag.
* @package SimpleTest
* @subpackage WebTester
*/
class SimpleImageSubmitTag extends SimpleWidget {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -448,6 +448,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function __construct($attributes) {
parent::__construct('input', $attributes);
}
/**
* Tag contains no end element.
* @return boolean False.
@ -456,7 +457,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function expectEndTag() {
return false;
}
/**
* Disables the setting of the button value.
* @param string $value Ignored.
@ -466,7 +467,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function setValue($value) {
return false;
}
/**
* Value of browser visible text.
* @return string Visible label.
@ -478,7 +479,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
}
return $this->getAttribute('alt');
}
/**
* Test for a label match when searching.
* @param string $label Label to test.
@ -488,7 +489,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function isLabel($label) {
return trim($label) == trim($this->getLabel());
}
/**
* Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet.
@ -506,14 +507,14 @@ class SimpleImageSubmitTag extends SimpleWidget {
}
}
}
/**
* Submit button as button tag.
* @package SimpleTest
* @subpackage WebTester
*/
class SimpleButtonTag extends SimpleWidget {
/**
* Starts with a named tag with attributes only.
* Defaults are very browser dependent.
@ -523,7 +524,7 @@ class SimpleButtonTag extends SimpleWidget {
function __construct($attributes) {
parent::__construct('button', $attributes);
}
/**
* Check to see if the tag can have both start and
* end tags with content in between.
@ -533,7 +534,7 @@ class SimpleButtonTag extends SimpleWidget {
function expectEndTag() {
return true;
}
/**
* Disables the setting of the button value.
* @param string $value Ignored.
@ -543,7 +544,7 @@ class SimpleButtonTag extends SimpleWidget {
function setValue($value) {
return false;
}
/**
* Value of browser visible text.
* @return string Visible label.
@ -552,7 +553,7 @@ class SimpleButtonTag extends SimpleWidget {
function getLabel() {
return $this->getContent();
}
/**
* Test for a label match when searching.
* @param string $label Label to test.
@ -570,7 +571,7 @@ class SimpleButtonTag extends SimpleWidget {
* @subpackage WebTester
*/
class SimpleTextAreaTag extends SimpleWidget {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -579,7 +580,7 @@ class SimpleTextAreaTag extends SimpleWidget {
function __construct($attributes) {
parent::__construct('textarea', $attributes);
}
/**
* Accessor for starting value.
* @return string Parsed value.
@ -588,7 +589,7 @@ class SimpleTextAreaTag extends SimpleWidget {
function getDefault() {
return $this->_wrap(SimpleHtmlSaxParser::decodeHtml($this->getContent()));
}
/**
* Applies word wrapping if needed.
* @param string $value New value.
@ -598,7 +599,7 @@ class SimpleTextAreaTag extends SimpleWidget {
function setValue($value) {
return parent::setValue($this->_wrap($value));
}
/**
* Test to see if text should be wrapped.
* @return boolean True if wrapping on.
@ -613,7 +614,7 @@ class SimpleTextAreaTag extends SimpleWidget {
}
return false;
}
/**
* Performs the formatting that is peculiar to
* this tag. There is strange behaviour in this
@ -638,7 +639,7 @@ class SimpleTextAreaTag extends SimpleWidget {
}
return $text;
}
/**
* The content of textarea is not part of the page.
* @return boolean True.
@ -655,7 +656,7 @@ class SimpleTextAreaTag extends SimpleWidget {
* @subpackage WebTester
*/
class SimpleUploadTag extends SimpleWidget {
/**
* Starts with attributes only.
* @param hash $attributes Attribute names and
@ -664,7 +665,7 @@ class SimpleUploadTag extends SimpleWidget {
function __construct($attributes) {
parent::__construct('input', $attributes);
}
/**
* Tag contains no content.
* @return boolean False.
@ -673,7 +674,7 @@ class SimpleUploadTag extends SimpleWidget {
function expectEndTag() {
return false;
}
/**
* Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet.
@ -698,7 +699,7 @@ class SimpleUploadTag extends SimpleWidget {
class SimpleSelectionTag extends SimpleWidget {
var $_options;
var $_choice;
/**
* Starts with attributes only.
* @param hash $attributes Attribute names and
@ -709,7 +710,7 @@ class SimpleSelectionTag extends SimpleWidget {
$this->_options = array();
$this->_choice = false;
}
/**
* Adds an option tag to a selection field.
* @param SimpleOptionTag $tag New option.
@ -720,7 +721,7 @@ class SimpleSelectionTag extends SimpleWidget {
$this->_options[] = &$tag;
}
}
/**
* Text within the selection element is ignored.
* @param string $content Ignored.
@ -728,7 +729,7 @@ class SimpleSelectionTag extends SimpleWidget {
*/
function addContent($content) {
}
/**
* Scans options for defaults. If none, then
* the first option is selected.
@ -746,7 +747,7 @@ class SimpleSelectionTag extends SimpleWidget {
}
return '';
}
/**
* Can only set allowed values.
* @param string $value New choice.
@ -762,7 +763,7 @@ class SimpleSelectionTag extends SimpleWidget {
}
return false;
}
/**
* Accessor for current selection value.
* @return string Value attribute or
@ -785,7 +786,7 @@ class SimpleSelectionTag extends SimpleWidget {
class MultipleSelectionTag extends SimpleWidget {
var $_options;
var $_values;
/**
* Starts with attributes only.
* @param hash $attributes Attribute names and
@ -796,7 +797,7 @@ class MultipleSelectionTag extends SimpleWidget {
$this->_options = array();
$this->_values = false;
}
/**
* Adds an option tag to a selection field.
* @param SimpleOptionTag $tag New option.
@ -807,7 +808,7 @@ class MultipleSelectionTag extends SimpleWidget {
$this->_options[] = &$tag;
}
}
/**
* Text within the selection element is ignored.
* @param string $content Ignored.
@ -815,7 +816,7 @@ class MultipleSelectionTag extends SimpleWidget {
*/
function addContent($content) {
}
/**
* Scans options for defaults to populate the
* value array().
@ -831,7 +832,7 @@ class MultipleSelectionTag extends SimpleWidget {
}
return $default;
}
/**
* Can only set allowed values. Any illegal value
* will result in a failure, but all correct values
@ -858,7 +859,7 @@ class MultipleSelectionTag extends SimpleWidget {
$this->_values = $achieved;
return true;
}
/**
* Accessor for current selection value.
* @return array List of currently set options.
@ -878,14 +879,14 @@ class MultipleSelectionTag extends SimpleWidget {
* @subpackage WebTester
*/
class SimpleOptionTag extends SimpleWidget {
/**
* Stashes the attributes.
*/
function __construct($attributes) {
parent::__construct('option', $attributes);
}
/**
* Does nothing.
* @param string $value Ignored.
@ -895,7 +896,7 @@ class SimpleOptionTag extends SimpleWidget {
function setValue($value) {
return false;
}
/**
* Test to see if a value matches the option.
* @param string $compare Value to compare with.
@ -909,7 +910,7 @@ class SimpleOptionTag extends SimpleWidget {
}
return trim($this->getContent()) == $compare;
}
/**
* Accessor for starting value. Will be set to
* the option label if no value exists.
@ -922,7 +923,7 @@ class SimpleOptionTag extends SimpleWidget {
}
return $this->getAttribute('value');
}
/**
* The content of options is not part of the page.
* @return boolean True.
@ -939,7 +940,7 @@ class SimpleOptionTag extends SimpleWidget {
* @subpackage WebTester
*/
class SimpleRadioButtonTag extends SimpleWidget {
/**
* Stashes the attributes.
* @param array $attributes Hash of attributes.
@ -950,7 +951,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
$this->_setAttribute('value', 'on');
}
}
/**
* Tag contains no content.
* @return boolean False.
@ -959,7 +960,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
function expectEndTag() {
return false;
}
/**
* The only allowed value sn the one in the
* "value" attribute.
@ -976,7 +977,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
}
return parent::setValue($value);
}
/**
* Accessor for starting value.
* @return string Parsed value.
@ -996,7 +997,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
* @subpackage WebTester
*/
class SimpleCheckboxTag extends SimpleWidget {
/**
* Starts with attributes only.
* @param hash $attributes Attribute names and
@ -1008,7 +1009,7 @@ class SimpleCheckboxTag extends SimpleWidget {
$this->_setAttribute('value', 'on');
}
}
/**
* Tag contains no content.
* @return boolean False.
@ -1017,7 +1018,7 @@ class SimpleCheckboxTag extends SimpleWidget {
function expectEndTag() {
return false;
}
/**
* The only allowed value in the one in the
* "value" attribute. The default for this
@ -1039,7 +1040,7 @@ class SimpleCheckboxTag extends SimpleWidget {
}
return parent::setValue($value);
}
/**
* Accessor for starting value. The default
* value is "on".
@ -1070,7 +1071,7 @@ class SimpleTagGroup {
function addWidget(&$widget) {
$this->_widgets[] = &$widget;
}
/**
* Accessor to widget set.
* @return array All widgets.
@ -1089,7 +1090,7 @@ class SimpleTagGroup {
function getAttribute($label) {
return false;
}
/**
* Fetches the name for the widget from the first
* member.
@ -1101,7 +1102,7 @@ class SimpleTagGroup {
return $this->_widgets[0]->getName();
}
}
/**
* Scans the widgets for one with the appropriate
* ID field.
@ -1117,7 +1118,7 @@ class SimpleTagGroup {
}
return false;
}
/**
* Scans the widgets for one with the appropriate
* attached label.
@ -1133,7 +1134,7 @@ class SimpleTagGroup {
}
return false;
}
/**
* Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet.
@ -1150,7 +1151,7 @@ class SimpleTagGroup {
* @subpackage WebTester
*/
class SimpleCheckboxGroup extends SimpleTagGroup {
/**
* Accessor for current selected widget or false
* if none.
@ -1167,7 +1168,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
}
return $this->_coerceValues($values);
}
/**
* Accessor for starting value that is active.
* @return string/array Widget values or false if none.
@ -1183,7 +1184,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
}
return $this->_coerceValues($values);
}
/**
* Accessor for current set values.
* @param string/array/boolean $values Either a single string, a
@ -1207,7 +1208,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
}
return true;
}
/**
* Tests to see if a possible value set is legal.
* @param string/array/boolean $values Either a single string, a
@ -1227,7 +1228,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
}
return ($values == $matches);
}
/**
* Converts the output to an appropriate format. This means
* that no values is false, a single value is just that
@ -1245,7 +1246,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
return $values;
}
}
/**
* Converts false or string into array. The opposite of
* the coercian method.
@ -1273,7 +1274,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
* @subpackage WebTester
*/
class SimpleRadioGroup extends SimpleTagGroup {
/**
* Each tag is tried in turn until one is
* successfully set. The others will be
@ -1295,7 +1296,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
}
return true;
}
/**
* Tests to see if a value is allowed.
* @param string Attempted value.
@ -1311,7 +1312,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
}
return false;
}
/**
* Accessor for current selected widget or false
* if none.
@ -1328,7 +1329,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
}
return false;
}
/**
* Accessor for starting value that is active.
* @return string/boolean Value of first checked
@ -1352,7 +1353,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
* @subpackage WebTester
*/
class SimpleLabelTag extends SimpleTag {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -1361,7 +1362,7 @@ class SimpleLabelTag extends SimpleTag {
function __construct($attributes) {
parent::__construct('label', $attributes);
}
/**
* Access for the ID to attach the label to.
* @return string For attribute.
@ -1378,7 +1379,7 @@ class SimpleLabelTag extends SimpleTag {
* @subpackage WebTester
*/
class SimpleFormTag extends SimpleTag {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -1395,7 +1396,7 @@ class SimpleFormTag extends SimpleTag {
* @subpackage WebTester
*/
class SimpleFrameTag extends SimpleTag {
/**
* Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and
@ -1404,7 +1405,7 @@ class SimpleFrameTag extends SimpleTag {
function __construct($attributes) {
parent::__construct('frame', $attributes);
}
/**
* Tag contains no content.
* @return boolean False.

View File

@ -35,7 +35,7 @@ class SimpleUrl {
var $_y;
var $_target;
var $_raw = false;
/**
* Constructor. Parses URL into sections.
* @param string $url Incoming URL.
@ -57,7 +57,7 @@ class SimpleUrl {
$this->_fragment = (strncmp($url, "#", 1) == 0 ? substr($url, 1) : false);
$this->_target = false;
}
/**
* Extracts the X, Y coordinate pair from an image map.
* @param string $url URL so far. The coordinates will be
@ -72,7 +72,7 @@ class SimpleUrl {
}
return array(false, false);
}
/**
* Extracts the scheme part of an incoming URL.
* @param string $url URL so far. The scheme will be
@ -87,7 +87,7 @@ class SimpleUrl {
}
return false;
}
/**
* Extracts the username and password from the
* incoming URL. The // prefix will be reattached
@ -114,7 +114,7 @@ class SimpleUrl {
$url = $prefix . $url;
return array(false, false);
}
/**
* Extracts the host part of an incoming URL.
* Includes the port number part. Will extract
@ -143,7 +143,7 @@ class SimpleUrl {
}
return false;
}
/**
* Extracts the path information from the incoming
* URL. Strips this path from the URL.
@ -159,7 +159,7 @@ class SimpleUrl {
}
return '';
}
/**
* Strips off the request data.
* @param string $url URL so far. The request will be
@ -174,7 +174,7 @@ class SimpleUrl {
}
return '';
}
/**
* Breaks the request down into an object.
* @param string $raw Raw request.
@ -193,7 +193,7 @@ class SimpleUrl {
}
return $request;
}
/**
* Accessor for protocol part.
* @param string $default Value to use if not present.
@ -203,7 +203,7 @@ class SimpleUrl {
function getScheme($default = false) {
return $this->_scheme ? $this->_scheme : $default;
}
/**
* Accessor for user name.
* @return string Username preceding host.
@ -212,7 +212,7 @@ class SimpleUrl {
function getUsername() {
return $this->_username;
}
/**
* Accessor for password.
* @return string Password preceding host.
@ -221,7 +221,7 @@ class SimpleUrl {
function getPassword() {
return $this->_password;
}
/**
* Accessor for hostname and port.
* @param string $default Value to use if not present.
@ -231,7 +231,7 @@ class SimpleUrl {
function getHost($default = false) {
return $this->_host ? $this->_host : $default;
}
/**
* Accessor for top level domain.
* @return string Last part of host.
@ -241,7 +241,7 @@ class SimpleUrl {
$path_parts = pathinfo($this->getHost());
return (isset($path_parts['extension']) ? $path_parts['extension'] : false);
}
/**
* Accessor for port number.
* @return integer TCP/IP port number.
@ -249,8 +249,8 @@ class SimpleUrl {
*/
function getPort() {
return $this->_port;
}
}
/**
* Accessor for path.
* @return string Full path including leading slash if implied.
@ -262,7 +262,7 @@ class SimpleUrl {
}
return $this->_path;
}
/**
* Accessor for page if any. This may be a
* directory name if ambiguious.
@ -275,7 +275,7 @@ class SimpleUrl {
}
return $matches[1];
}
/**
* Gets the path to the page.
* @return string Path less the page.
@ -287,7 +287,7 @@ class SimpleUrl {
}
return $matches[1];
}
/**
* Accessor for fragment at end of URL after the "#".
* @return string Part after "#".
@ -296,7 +296,7 @@ class SimpleUrl {
function getFragment() {
return $this->_fragment;
}
/**
* Sets image coordinates. Set to false to clear
* them.
@ -312,7 +312,7 @@ class SimpleUrl {
$this->_x = (integer)$x;
$this->_y = (integer)$y;
}
/**
* Accessor for horizontal image coordinate.
* @return integer X value.
@ -321,7 +321,7 @@ class SimpleUrl {
function getX() {
return $this->_x;
}
/**
* Accessor for vertical image coordinate.
* @return integer Y value.
@ -330,7 +330,7 @@ class SimpleUrl {
function getY() {
return $this->_y;
}
/**
* Accessor for current request parameters
* in URL string form. Will return teh original request
@ -350,7 +350,7 @@ class SimpleUrl {
}
return '';
}
/**
* Adds an additional parameter to the request.
* @param string $key Name of parameter.
@ -361,7 +361,7 @@ class SimpleUrl {
$this->_raw = false;
$this->_request->add($key, $value);
}
/**
* Adds additional parameters to the request.
* @param hash/SimpleFormEncoding $parameters Additional
@ -372,7 +372,7 @@ class SimpleUrl {
$this->_raw = false;
$this->_request->merge($parameters);
}
/**
* Clears down all parameters.
* @access public
@ -381,7 +381,7 @@ class SimpleUrl {
$this->_raw = false;
$this->_request = new SimpleGetEncoding();
}
/**
* Gets the frame target if present. Although
* not strictly part of the URL specification it
@ -392,7 +392,7 @@ class SimpleUrl {
function getTarget() {
return $this->_target;
}
/**
* Attaches a frame target.
* @param string $frame Name of frame.
@ -402,7 +402,7 @@ class SimpleUrl {
$this->_raw = false;
$this->_target = $frame;
}
/**
* Renders the URL back into a string.
* @return string URL in canonical form.
@ -430,7 +430,7 @@ class SimpleUrl {
$coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY();
return "$scheme$identity$host$port$path$encoded$fragment$coords";
}
/**
* Replaces unknown sections to turn a relative
* URL into an absolute one. The base URL can
@ -462,7 +462,7 @@ class SimpleUrl {
$coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY();
return new SimpleUrl("$scheme://$identity$host$port$path$encoded$fragment$coords");
}
/**
* Replaces unknown sections of the path with base parts
* to return a complete absolute one.
@ -482,7 +482,7 @@ class SimpleUrl {
}
return $base->getPath();
}
/**
* Simple test to see if a path part is relative.
* @param string $path Path to test.
@ -492,7 +492,7 @@ class SimpleUrl {
function _isRelativePath($path) {
return (substr($path, 0, 1) != '/');
}
/**
* Extracts the username and password for use in rendering
* a URL.
@ -505,7 +505,7 @@ class SimpleUrl {
}
return false;
}
/**
* Replaces . and .. sections of the path.
* @param string $path Unoptimised path.
@ -516,7 +516,7 @@ class SimpleUrl {
$path = preg_replace('|/\./|', '/', $path);
return preg_replace('|/[^/]+/\.\./|', '/', $path);
}
/**
* A pipe seperated list of all TLDs that result in two part
* domain names.