Difference between revisions of "Selenium.class.php"

From Organic Design wiki
(New page: <?php /** * Selenium extension * * ...)
 
m
Line 2: Line 2:
 
/**
 
/**
 
  * Selenium extension
 
  * Selenium extension
  *
+
  * {{php}}
 
  * See http://www.mediawiki.org/Extension:Selenium for installation and usage details
 
  * See http://www.mediawiki.org/Extension:Selenium for installation and usage details
 
  * See http://www.organicdesign.co.nz/Extension_talk:Selenium.php for development notes and disucssion
 
  * See http://www.organicdesign.co.nz/Extension_talk:Selenium.php for development notes and disucssion

Revision as of 10:25, 1 August 2008

<?php /**

* Selenium extension
* Template:Php
* See http://www.mediawiki.org/Extension:Selenium for installation and usage details
* See http://www.organicdesign.co.nz/Extension_talk:Selenium.php for development notes and disucssion
* 
* @package MediaWiki
* @subpackage Extensions
* @author Marcus Davy User:Sven
* @copyright © 2007 Marcus Davy
* @licence GNU General Public Licence 2.0 or later
*/

if (!defined('MEDIAWIKI')) die('Not an entry point.');

class Selenium {

function __construct() { global $wgParser;

# Add the tag hooks $wgParser->setHook('body', array($this, 'tagBody')); $wgParser->setHook('head', array($this, 'tagHead')); $wgParser->setHook('html', array($this, 'tagParseContent')); $wgParser->setHook('thead', array($this, 'tagParseContent')); $wgParser->setHook('tbody', array($this, 'tagParseContent'));

# todo: check the schedule and see if any test-runs should be spawned

}

/** * Body tags surround the main test table and should be converted to a div of class "selenium" * - this tag also handles the categorisation of the article into Category:Selenium */ public function tagBody($text, &$argv, &$parser) { global $egSeleniumCategory; $text .= ""; $text = $parser->parse($text, $parser->mTitle, $parser->mOptions, false, false)->getText();

return "

$text

";

}

/** * The head tag of a selenium test doesn't need to be rendered, so simply returns an empty string */ public function tagHead(&$text, &$argv, &$parser) { return ; }

/** * The html, thead and tbody tags need to parse and return their content */ public function tagParseContent(&$text, &$argv, &$parser) { return $parser->parse($text, $parser->mTitle, $parser->mOptions, false, false)->getText(); }

/** * Needed in some versions to prevent Special:Version from breaking */ private function __toString() { return __CLASS__; } }