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) {
34 * Compares with name attribute of widget.
35 * @param SimpleWidget $widget Control to compare.
38 function isMatch($widget) {
39 return ($widget->getName() == $this->_name
);
44 * Used to extract form elements for testing against.
45 * Searches by visible label or alt text.
47 * @subpackage WebTester
53 * Stashes the name for later comparison.
54 * @param string $label Visible text to match.
56 function SimpleByLabel($label) {
57 $this->_label
= $label;
61 * Comparison. Compares visible text of widget or
63 * @param SimpleWidget $widget Control to compare.
66 function isMatch($widget) {
67 if (! method_exists($widget, 'isLabel')) {
70 return $widget->isLabel($this->_label
);
75 * Used to extract form elements for testing against.
76 * Searches dy id attribute.
78 * @subpackage WebTester
84 * Stashes the name for later comparison.
85 * @param string $id ID atribute to match.
87 function SimpleById($id) {
92 * Comparison. Compares id attribute of widget.
93 * @param SimpleWidget $widget Control to compare.
96 function isMatch($widget) {
97 return $widget->isId($this->_id
);
102 * Used to extract form elements for testing against.
103 * Searches by visible label, name or alt text.
104 * @package SimpleTest
105 * @subpackage WebTester
107 class SimpleByLabelOrName
{
111 * Stashes the name/label for later comparison.
112 * @param string $label Visible text to match.
114 function SimpleByLabelOrName($label) {
115 $this->_label
= $label;
119 * Comparison. Compares visible text of widget or
120 * related label or name.
121 * @param SimpleWidget $widget Control to compare.
124 function isMatch($widget) {
125 if (method_exists($widget, 'isLabel')) {
126 if ($widget->isLabel($this->_label
)) {
130 return ($widget->getName() == $this->_label
);