3 * Base include file for SimpleTest.
5 * @subpackage WebTester
10 * include SimpleTest files
12 require_once(dirname(__FILE__
) . '/tag.php');
13 require_once(dirname(__FILE__
) . '/encoding.php');
17 * Used to extract form elements for testing against.
18 * Searches by name attribute.
20 * @subpackage WebTester
26 * Stashes the name for later comparison.
27 * @param string $name Name attribute to match.
29 function SimpleByName($name) {
38 * Compares with name attribute of widget.
39 * @param SimpleWidget $widget Control to compare.
42 function isMatch($widget) {
43 return ($widget->getName() == $this->_name
);
48 * Used to extract form elements for testing against.
49 * Searches by visible label or alt text.
51 * @subpackage WebTester
57 * Stashes the name for later comparison.
58 * @param string $label Visible text to match.
60 function SimpleByLabel($label) {
61 $this->_label
= $label;
65 * Comparison. Compares visible text of widget or
67 * @param SimpleWidget $widget Control to compare.
70 function isMatch($widget) {
71 if (! method_exists($widget, 'isLabel')) {
74 return $widget->isLabel($this->_label
);
79 * Used to extract form elements for testing against.
80 * Searches dy id attribute.
82 * @subpackage WebTester
88 * Stashes the name for later comparison.
89 * @param string $id ID atribute to match.
91 function SimpleById($id) {
96 * Comparison. Compares id attribute of widget.
97 * @param SimpleWidget $widget Control to compare.
100 function isMatch($widget) {
101 return $widget->isId($this->_id
);
106 * Used to extract form elements for testing against.
107 * Searches by visible label, name or alt text.
108 * @package SimpleTest
109 * @subpackage WebTester
111 class SimpleByLabelOrName
{
115 * Stashes the name/label for later comparison.
116 * @param string $label Visible text to match.
118 function SimpleByLabelOrName($label) {
119 $this->_label
= $label;
123 * Comparison. Compares visible text of widget or
124 * related label or name.
125 * @param SimpleWidget $widget Control to compare.
128 function isMatch($widget) {
129 if (method_exists($widget, 'isLabel')) {
130 if ($widget->isLabel($this->_label
)) {
134 return ($widget->getName() == $this->_label
);