summaryrefslogtreecommitdiff
path: root/test_tools/simpletest/remote.php
diff options
context:
space:
mode:
authorwei <>2006-07-05 07:40:57 +0000
committerwei <>2006-07-05 07:40:57 +0000
commitdfa5aa5fbf11f89ce483c58016465ddc3921f082 (patch)
treef01dd1c13d700b266695e503b3ebb6e05e591410 /test_tools/simpletest/remote.php
parentb6dfb6c447cf502e694d299dbda1b2e092c3312d (diff)
move to tests
Diffstat (limited to 'test_tools/simpletest/remote.php')
-rw-r--r--test_tools/simpletest/remote.php115
1 files changed, 0 insertions, 115 deletions
diff --git a/test_tools/simpletest/remote.php b/test_tools/simpletest/remote.php
deleted file mode 100644
index 5a5f2d32..00000000
--- a/test_tools/simpletest/remote.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: remote.php,v 1.11 2004/08/04 22:09:39 lastcraft Exp $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/browser.php');
- require_once(dirname(__FILE__) . '/xml.php');
- require_once(dirname(__FILE__) . '/simple_test.php');
- /**#@-*/
-
- /**
- * Runs an XML formated test on a remote server.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class RemoteTestCase {
- protected $_url;
- protected $_dry_url;
- protected $_size;
-
- /**
- * Sets the location of the remote test.
- * @param string $url Test location.
- * @param string $dry_url Location for dry run.
- * @access public
- */
- function RemoteTestCase($url, $dry_url = false) {
- $this->_url = $url;
- $this->_dry_url = $dry_url ? $dry_url : $url;
- $this->_size = false;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_url;
- }
-
- /**
- * Runs the top level test for this class. Currently
- * reads the data as a single chunk. I'll fix this
- * once I have added iteration to the browser.
- * @param SimpleReporter $reporter Target of test results.
- * @returns boolean True if no failures.
- * @access public
- */
- function run($reporter) {
- $browser = $this->_createBrowser();
- $xml = $browser->get($this->_url);
- if (! $xml) {
- trigger_error('Cannot read remote test URL [' . $this->_url . ']');
- return false;
- }
- $parser = $this->_createParser($reporter);
- if (! $parser->parse($xml)) {
- trigger_error('Cannot parse incoming XML from [' . $this->_url . ']');
- return false;
- }
- return true;
- }
-
- /**
- * Creates a new web browser object for fetching
- * the XML report.
- * @return SimpleBrowser New browser.
- * @access protected
- */
- function _createBrowser() {
- return new SimpleBrowser();
- }
-
- /**
- * Creates the XML parser.
- * @param SimpleReporter $reporter Target of test results.
- * @return SimpleTestXmlListener XML reader.
- * @access protected
- */
- function _createParser($reporter) {
- return new SimpleTestXmlParser($reporter);
- }
-
- /**
- * Accessor for the number of subtests.
- * @return integer Number of test cases.
- * @access public
- */
- function getSize() {
- if ($this->_size === false) {
- $browser = $this->_createBrowser();
- $xml = $browser->get($this->_dry_url);
- if (! $xml) {
- trigger_error('Cannot read remote test URL [' . $this->_dry_url . ']');
- return false;
- }
- $reporter = new SimpleReporter();
- $parser = $this->_createParser($reporter);
- if (! $parser->parse($xml)) {
- trigger_error('Cannot parse incoming XML from [' . $this->_dry_url . ']');
- return false;
- }
- $this->_size = $reporter->getTestCaseCount();
- }
- return $this->_size;
- }
- }
-?> \ No newline at end of file