[Pkg-php-commits] r1445 - in pear/php-testing-selenium/trunk/debian: . patches
Mark Hershberger
mah-guest at alioth.debian.org
Sun Sep 5 00:58:47 UTC 2010
Author: mah-guest
Date: 2010-09-05 00:58:45 +0000 (Sun, 05 Sep 2010)
New Revision: 1445
Added:
pear/php-testing-selenium/trunk/debian/patches/add-verbose-option.patch
pear/php-testing-selenium/trunk/debian/patches/error-handling-for-bad-browser.patch
Modified:
pear/php-testing-selenium/trunk/debian/changelog
pear/php-testing-selenium/trunk/debian/patches/fix-fopen-warnings.patch
pear/php-testing-selenium/trunk/debian/patches/series
Log:
patches to provide better handling
Modified: pear/php-testing-selenium/trunk/debian/changelog
===================================================================
--- pear/php-testing-selenium/trunk/debian/changelog 2010-08-26 20:35:30 UTC (rev 1444)
+++ pear/php-testing-selenium/trunk/debian/changelog 2010-09-05 00:58:45 UTC (rev 1445)
@@ -1,6 +1,9 @@
php-testing-selenium (0.4.3-1) unstable; urgency=low
* Initial release.
+ * Add patch to provide better error reporting.
+ * Add verbose option.
+ * Add better handling of fopen.
* Closes: #59287
-- Mark A. Hershberger <mah at everybody.org> Sun, 08 Aug 2010 13:23:06 -0400
Added: pear/php-testing-selenium/trunk/debian/patches/add-verbose-option.patch
===================================================================
--- pear/php-testing-selenium/trunk/debian/patches/add-verbose-option.patch (rev 0)
+++ pear/php-testing-selenium/trunk/debian/patches/add-verbose-option.patch 2010-09-05 00:58:45 UTC (rev 1445)
@@ -0,0 +1,32 @@
+Add a verbose option for convenience.
+--- a/Testing_Selenium-0.4.3/Selenium.php
++++ b/Testing_Selenium-0.4.3/Selenium.php
+@@ -290,6 +290,8 @@
+ */
+ class Testing_Selenium
+ {
++ private $verbose;
++
+ /**
+ * @var string
+ * @access private
+@@ -808,6 +814,10 @@
+ $this->doCommand("typeKeys", array($locator, $value));
+ }
+
++ public function setVerbose($value = true)
++ {
++ $this->verbose = $value;
++ }
+
+ /**
+ * Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e.,
+@@ -2545,6 +2555,8 @@
+
+ protected function doCommand($verb, $args = array())
+ {
++ if( $this->verbose ) echo "doCommand: $verb( '".implode("', '", $args)."')\n";
++
+ $url = sprintf('http://%s:%s/selenium-server/driver/?cmd=%s', $this->host, $this->port, urlencode($verb));
+ for ($i = 0; $i < count($args); $i++) {
+ $argNum = strval($i + 1);
Added: pear/php-testing-selenium/trunk/debian/patches/error-handling-for-bad-browser.patch
===================================================================
--- pear/php-testing-selenium/trunk/debian/patches/error-handling-for-bad-browser.patch (rev 0)
+++ pear/php-testing-selenium/trunk/debian/patches/error-handling-for-bad-browser.patch 2010-09-05 00:58:45 UTC (rev 1445)
@@ -0,0 +1,18 @@
+Better error handling for invalid browser.
+--- a/Testing_Selenium-0.4.3/Selenium.php
++++ b/Testing_Selenium-0.4.3/Selenium.php
+@@ -354,8 +356,12 @@
+ */
+ public function start()
+ {
+- $this->sessionId = $this->getString("getNewBrowserSession", array($this->browser, $this->browserUrl));
+- return $this->sessionId;
++ $resp = $this->getString("getNewBrowserSession", array($this->browser, $this->browserUrl));
++ if( strstr($resp, "ERROR:") !== false ) {
++ throw new Testing_Selenium_Exception("Error from the Selenium server: $resp");
++ }
++
++ return $this->sessionId = $resp;
+ }
+
+ /**
Modified: pear/php-testing-selenium/trunk/debian/patches/fix-fopen-warnings.patch
===================================================================
--- pear/php-testing-selenium/trunk/debian/patches/fix-fopen-warnings.patch 2010-08-26 20:35:30 UTC (rev 1444)
+++ pear/php-testing-selenium/trunk/debian/patches/fix-fopen-warnings.patch 2010-09-05 00:58:45 UTC (rev 1445)
@@ -1,12 +1,36 @@
fopen emits E_WARNING that annoy.
--- a/Testing_Selenium-0.4.3/Selenium.php
+++ b/Testing_Selenium-0.4.3/Selenium.php
-@@ -2555,7 +2555,7 @@
+@@ -2554,15 +2566,27 @@
+ if (isset($this->sessionId)) {
$url .= sprintf('&%s=%s', 'sessionId', $this->sessionId);
}
-
+-
- if (!$handle = fopen($url, 'r')) {
-+ if (!$handle = @fopen($url, 'r')) {
- throw new Testing_Selenium_Exception('Cannot connected to Selenium RC Server');
+- throw new Testing_Selenium_Exception('Cannot connected to Selenium RC Server');
++ $context = stream_context_create( array( 'http' =>
++ array( 'timeout' => $this->timeout, /* We should really use another timeout here */
++ 'method' => 'GET',
++ 'ignore_errors' => true,
++ 'protocol_version' => '1.0' ) ) );
++ /* Interesting... grid always replies with HTTP/1.1 */
++ if (!$handle = fopen($url, 'r', false, $context)) {
++ throw new Testing_Selenium_Exception('Cannot connect to Selenium RC Server');
}
+- stream_set_blocking($handle, false);
++ $md = stream_get_meta_data($handle);
+ $response = stream_get_contents($handle);
+- fclose($handle);
++ if ( strpos( $md['wrapper_data'][0], '200' ) == false ) {
++ if ( $response !== '' ) {
++ throw new Testing_Selenium_Exception("Error executing $verb: $response");
++ } else {
++ throw new Testing_Selenium_Exception("Error executing $verb");
++ }
++ }
+
++ fclose($handle);
+ return $response;
+ }
+
Modified: pear/php-testing-selenium/trunk/debian/patches/series
===================================================================
--- pear/php-testing-selenium/trunk/debian/patches/series 2010-08-26 20:35:30 UTC (rev 1444)
+++ pear/php-testing-selenium/trunk/debian/patches/series 2010-09-05 00:58:45 UTC (rev 1445)
@@ -1 +1,3 @@
fix-fopen-warnings.patch
+add-verbose-option.patch
+error-handling-for-bad-browser.patch
More information about the Pkg-php-commits
mailing list