les commentaires dans l'historique sont en gras
[bazdig.git] / test / simpletest / selector.php
blob7280009045e4e6bbd777734388c36b6cbb7687f4
1 <?php
2 /**
3 * Base include file for SimpleTest.
4 * @package SimpleTest
5 * @subpackage WebTester
6 * @version $Id: selector.php,v 1.3 2005/08/25 03:34:24 lastcraft Exp $
7 */
9 /**#@+
10 * include SimpleTest files
12 require_once(dirname(__FILE__) . '/tag.php');
13 require_once(dirname(__FILE__) . '/encoding.php');
14 /**#@-*/
16 /**
17 * Used to extract form elements for testing against.
18 * Searches by name attribute.
19 * @package SimpleTest
20 * @subpackage WebTester
22 class SimpleByName {
23 var $_name;
25 /**
26 * Stashes the name for later comparison.
27 * @param string $name Name attribute to match.
29 function SimpleByName($name) {
30 $this->_name = $name;
33 /**
34 * Compares with name attribute of widget.
35 * @param SimpleWidget $widget Control to compare.
36 * @access public
38 function isMatch($widget) {
39 return ($widget->getName() == $this->_name);
43 /**
44 * Used to extract form elements for testing against.
45 * Searches by visible label or alt text.
46 * @package SimpleTest
47 * @subpackage WebTester
49 class SimpleByLabel {
50 var $_label;
52 /**
53 * Stashes the name for later comparison.
54 * @param string $label Visible text to match.
56 function SimpleByLabel($label) {
57 $this->_label = $label;
60 /**
61 * Comparison. Compares visible text of widget or
62 * related label.
63 * @param SimpleWidget $widget Control to compare.
64 * @access public
66 function isMatch($widget) {
67 if (! method_exists($widget, 'isLabel')) {
68 return false;
70 return $widget->isLabel($this->_label);
74 /**
75 * Used to extract form elements for testing against.
76 * Searches dy id attribute.
77 * @package SimpleTest
78 * @subpackage WebTester
80 class SimpleById {
81 var $_id;
83 /**
84 * Stashes the name for later comparison.
85 * @param string $id ID atribute to match.
87 function SimpleById($id) {
88 $this->_id = $id;
91 /**
92 * Comparison. Compares id attribute of widget.
93 * @param SimpleWidget $widget Control to compare.
94 * @access public
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 {
108 var $_label;
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.
122 * @access public
124 function isMatch($widget) {
125 if (method_exists($widget, 'isLabel')) {
126 if ($widget->isLabel($this->_label)) {
127 return true;
130 return ($widget->getName() == $this->_label);