Completed
Push — scrutinizer ( 84e9d0...6a9613 )
by Fabio
22:48
created
tests/test_tools/simpletest/xml.php 1 patch
Indentation   +597 added lines, -597 removed lines patch added patch discarded remove patch
@@ -1,613 +1,613 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	base include file for SimpleTest
4
-     *	@package	SimpleTest
5
-     *	@subpackage	UnitTester
6
-     *	@version	$Id: xml.php 1398 2006-09-08 19:31:03Z xue $
7
-     */
8
-
9
-    /**#@+
2
+	/**
3
+	 *	base include file for SimpleTest
4
+	 *	@package	SimpleTest
5
+	 *	@subpackage	UnitTester
6
+	 *	@version	$Id: xml.php 1398 2006-09-08 19:31:03Z xue $
7
+	 */
8
+
9
+	/**#@+
10 10
      *	include other SimpleTest class files
11 11
      */
12
-    require_once(dirname(__FILE__) . '/scorer.php');
13
-    /**#@-*/
12
+	require_once(dirname(__FILE__) . '/scorer.php');
13
+	/**#@-*/
14 14
 
15
-    /**
16
-     *    Creates the XML needed for remote communication
17
-     *    by SimpleTest.
15
+	/**
16
+	 *    Creates the XML needed for remote communication
17
+	 *    by SimpleTest.
18 18
 	 *	  @package SimpleTest
19 19
 	 *	  @subpackage UnitTester
20
-     */
21
-    class XmlReporter extends SimpleReporter {
22
-        protected $_indent;
23
-        protected $_namespace;
24
-
25
-        /**
26
-         *    Does nothing yet.
27
-         *    @access public
28
-         */
29
-        function XmlReporter($namespace = false, $indent = '  ') {
30
-            $this->SimpleReporter();
31
-            $this->_namespace = ($namespace ? $namespace . ':' : '');
32
-            $this->_indent = $indent;
33
-        }
34
-
35
-        /**
36
-         *    Calculates the pretty printing indent level
37
-         *    from the current level of nesting.
38
-         *    @param integer $offset  Extra indenting level.
39
-         *    @return string          Leading space.
40
-         *    @access protected
41
-         */
42
-        function _getIndent($offset = 0) {
43
-            return str_repeat(
44
-                    $this->_indent,
45
-                    count($this->getTestList()) + $offset);
46
-        }
47
-
48
-        /**
49
-         *    Converts character string to parsed XML
50
-         *    entities string.
51
-         *    @param string text        Unparsed character data.
52
-         *    @return string            Parsed character data.
53
-         *    @access public
54
-         */
55
-        function toParsedXml($text) {
56
-            return str_replace(
57
-                    array('&', '<', '>', '"', '\''),
58
-                    array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),
59
-                    $text);
60
-        }
61
-
62
-        /**
63
-         *    Paints the start of a group test.
64
-         *    @param string $test_name   Name of test that is starting.
65
-         *    @param integer $size       Number of test cases starting.
66
-         *    @access public
67
-         */
68
-        function paintGroupStart($test_name, $size) {
69
-            parent::paintGroupStart($test_name, $size);
70
-            print $this->_getIndent();
71
-            print "<" . $this->_namespace . "group size=\"$size\">\n";
72
-            print $this->_getIndent(1);
73
-            print "<" . $this->_namespace . "name>" .
74
-                    $this->toParsedXml($test_name) .
75
-                    "</" . $this->_namespace . "name>\n";
76
-        }
77
-
78
-        /**
79
-         *    Paints the end of a group test.
80
-         *    @param string $test_name   Name of test that is ending.
81
-         *    @access public
82
-         */
83
-        function paintGroupEnd($test_name) {
84
-            print $this->_getIndent();
85
-            print "</" . $this->_namespace . "group>\n";
86
-            parent::paintGroupEnd($test_name);
87
-        }
88
-
89
-        /**
90
-         *    Paints the start of a test case.
91
-         *    @param string $test_name   Name of test that is starting.
92
-         *    @access public
93
-         */
94
-        function paintCaseStart($test_name) {
95
-            parent::paintCaseStart($test_name);
96
-            print $this->_getIndent();
97
-            print "<" . $this->_namespace . "case>\n";
98
-            print $this->_getIndent(1);
99
-            print "<" . $this->_namespace . "name>" .
100
-                    $this->toParsedXml($test_name) .
101
-                    "</" . $this->_namespace . "name>\n";
102
-        }
103
-
104
-        /**
105
-         *    Paints the end of a test case.
106
-         *    @param string $test_name   Name of test that is ending.
107
-         *    @access public
108
-         */
109
-        function paintCaseEnd($test_name) {
110
-            print $this->_getIndent();
111
-            print "</" . $this->_namespace . "case>\n";
112
-            parent::paintCaseEnd($test_name);
113
-        }
114
-
115
-        /**
116
-         *    Paints the start of a test method.
117
-         *    @param string $test_name   Name of test that is starting.
118
-         *    @access public
119
-         */
120
-        function paintMethodStart($test_name) {
121
-            parent::paintMethodStart($test_name);
122
-            print $this->_getIndent();
123
-            print "<" . $this->_namespace . "test>\n";
124
-            print $this->_getIndent(1);
125
-            print "<" . $this->_namespace . "name>" .
126
-                    $this->toParsedXml($test_name) .
127
-                    "</" . $this->_namespace . "name>\n";
128
-        }
129
-
130
-        /**
131
-         *    Paints the end of a test method.
132
-         *    @param string $test_name   Name of test that is ending.
133
-         *    @param integer $progress   Number of test cases ending.
134
-         *    @access public
135
-         */
136
-        function paintMethodEnd($test_name) {
137
-            print $this->_getIndent();
138
-            print "</" . $this->_namespace . "test>\n";
139
-            parent::paintMethodEnd($test_name);
140
-        }
141
-
142
-        /**
143
-         *    Increments the pass count.
144
-         *    @param string $message        Message is ignored.
145
-         *    @access public
146
-         */
147
-        function paintPass($message) {
148
-            parent::paintPass($message);
149
-            print $this->_getIndent(1);
150
-            print "<" . $this->_namespace . "pass>";
151
-            print $this->toParsedXml($message);
152
-            print "</" . $this->_namespace . "pass>\n";
153
-        }
154
-
155
-        /**
156
-         *    Increments the fail count.
157
-         *    @param string $message        Message is ignored.
158
-         *    @access public
159
-         */
160
-        function paintFail($message) {
161
-            parent::paintFail($message);
162
-            print $this->_getIndent(1);
163
-            print "<" . $this->_namespace . "fail>";
164
-            print $this->toParsedXml($message);
165
-            print "</" . $this->_namespace . "fail>\n";
166
-        }
167
-
168
-        /**
169
-         *    Paints a PHP error or exception.
170
-         *    @param string $message        Message is ignored.
171
-         *    @access public
172
-         *    @abstract
173
-         */
174
-        function paintError($message) {
175
-            parent::paintError($message);
176
-            print $this->_getIndent(1);
177
-            print "<" . $this->_namespace . "exception>";
178
-            print $this->toParsedXml($message);
179
-            print "</" . $this->_namespace . "exception>\n";
180
-        }
181
-
182
-        /**
183
-         *    Paints a simple supplementary message.
184
-         *    @param string $message        Text to display.
185
-         *    @access public
186
-         */
187
-        function paintMessage($message) {
188
-            parent::paintMessage($message);
189
-            print $this->_getIndent(1);
190
-            print "<" . $this->_namespace . "message>";
191
-            print $this->toParsedXml($message);
192
-            print "</" . $this->_namespace . "message>\n";
193
-        }
194
-
195
-        /**
196
-         *    Paints a formatted ASCII message such as a
197
-         *    variable dump.
198
-         *    @param string $message        Text to display.
199
-         *    @access public
200
-         */
201
-        function paintFormattedMessage($message) {
202
-            parent::paintFormattedMessage($message);
203
-            print $this->_getIndent(1);
204
-            print "<" . $this->_namespace . "formatted>";
205
-            print "<![CDATA[$message]]>";
206
-            print "</" . $this->_namespace . "formatted>\n";
207
-        }
208
-
209
-        /**
210
-         *    Serialises the event object.
211
-         *    @param string $type        Event type as text.
212
-         *    @param mixed $payload      Message or object.
213
-         *    @access public
214
-         */
215
-        function paintSignal($type, $payload) {
216
-            parent::paintSignal($type, $payload);
217
-            print $this->_getIndent(1);
218
-            print "<" . $this->_namespace . "signal type=\"$type\">";
219
-            print "<![CDATA[" . serialize($payload) . "]]>";
220
-            print "</" . $this->_namespace . "signal>\n";
221
-        }
222
-
223
-        /**
224
-         *    Paints the test document header.
225
-         *    @param string $test_name     First test top level
226
-         *                                 to start.
227
-         *    @access public
228
-         *    @abstract
229
-         */
230
-        function paintHeader($test_name) {
231
-            if (! SimpleReporter::inCli()) {
232
-                header('Content-type: text/xml');
233
-            }
234
-            print "<?xml version=\"1.0\"";
235
-            if ($this->_namespace) {
236
-                print " xmlns:" . $this->_namespace .
237
-                        "=\"www.lastcraft.com/SimpleTest/Beta3/Report\"";
238
-            }
239
-            print "?>\n";
240
-            print "<" . $this->_namespace . "run>\n";
241
-        }
242
-
243
-        /**
244
-         *    Paints the test document footer.
245
-         *    @param string $test_name        The top level test.
246
-         *    @access public
247
-         *    @abstract
248
-         */
249
-        function paintFooter($test_name) {
250
-            print "</" . $this->_namespace . "run>\n";
251
-        }
252
-    }
253
-
254
-    /**
255
-     *    Accumulator for incoming tag. Holds the
256
-     *    incoming test structure information for
257
-     *    later dispatch to the reporter.
20
+	 */
21
+	class XmlReporter extends SimpleReporter {
22
+		protected $_indent;
23
+		protected $_namespace;
24
+
25
+		/**
26
+		 *    Does nothing yet.
27
+		 *    @access public
28
+		 */
29
+		function XmlReporter($namespace = false, $indent = '  ') {
30
+			$this->SimpleReporter();
31
+			$this->_namespace = ($namespace ? $namespace . ':' : '');
32
+			$this->_indent = $indent;
33
+		}
34
+
35
+		/**
36
+		 *    Calculates the pretty printing indent level
37
+		 *    from the current level of nesting.
38
+		 *    @param integer $offset  Extra indenting level.
39
+		 *    @return string          Leading space.
40
+		 *    @access protected
41
+		 */
42
+		function _getIndent($offset = 0) {
43
+			return str_repeat(
44
+					$this->_indent,
45
+					count($this->getTestList()) + $offset);
46
+		}
47
+
48
+		/**
49
+		 *    Converts character string to parsed XML
50
+		 *    entities string.
51
+		 *    @param string text        Unparsed character data.
52
+		 *    @return string            Parsed character data.
53
+		 *    @access public
54
+		 */
55
+		function toParsedXml($text) {
56
+			return str_replace(
57
+					array('&', '<', '>', '"', '\''),
58
+					array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),
59
+					$text);
60
+		}
61
+
62
+		/**
63
+		 *    Paints the start of a group test.
64
+		 *    @param string $test_name   Name of test that is starting.
65
+		 *    @param integer $size       Number of test cases starting.
66
+		 *    @access public
67
+		 */
68
+		function paintGroupStart($test_name, $size) {
69
+			parent::paintGroupStart($test_name, $size);
70
+			print $this->_getIndent();
71
+			print "<" . $this->_namespace . "group size=\"$size\">\n";
72
+			print $this->_getIndent(1);
73
+			print "<" . $this->_namespace . "name>" .
74
+					$this->toParsedXml($test_name) .
75
+					"</" . $this->_namespace . "name>\n";
76
+		}
77
+
78
+		/**
79
+		 *    Paints the end of a group test.
80
+		 *    @param string $test_name   Name of test that is ending.
81
+		 *    @access public
82
+		 */
83
+		function paintGroupEnd($test_name) {
84
+			print $this->_getIndent();
85
+			print "</" . $this->_namespace . "group>\n";
86
+			parent::paintGroupEnd($test_name);
87
+		}
88
+
89
+		/**
90
+		 *    Paints the start of a test case.
91
+		 *    @param string $test_name   Name of test that is starting.
92
+		 *    @access public
93
+		 */
94
+		function paintCaseStart($test_name) {
95
+			parent::paintCaseStart($test_name);
96
+			print $this->_getIndent();
97
+			print "<" . $this->_namespace . "case>\n";
98
+			print $this->_getIndent(1);
99
+			print "<" . $this->_namespace . "name>" .
100
+					$this->toParsedXml($test_name) .
101
+					"</" . $this->_namespace . "name>\n";
102
+		}
103
+
104
+		/**
105
+		 *    Paints the end of a test case.
106
+		 *    @param string $test_name   Name of test that is ending.
107
+		 *    @access public
108
+		 */
109
+		function paintCaseEnd($test_name) {
110
+			print $this->_getIndent();
111
+			print "</" . $this->_namespace . "case>\n";
112
+			parent::paintCaseEnd($test_name);
113
+		}
114
+
115
+		/**
116
+		 *    Paints the start of a test method.
117
+		 *    @param string $test_name   Name of test that is starting.
118
+		 *    @access public
119
+		 */
120
+		function paintMethodStart($test_name) {
121
+			parent::paintMethodStart($test_name);
122
+			print $this->_getIndent();
123
+			print "<" . $this->_namespace . "test>\n";
124
+			print $this->_getIndent(1);
125
+			print "<" . $this->_namespace . "name>" .
126
+					$this->toParsedXml($test_name) .
127
+					"</" . $this->_namespace . "name>\n";
128
+		}
129
+
130
+		/**
131
+		 *    Paints the end of a test method.
132
+		 *    @param string $test_name   Name of test that is ending.
133
+		 *    @param integer $progress   Number of test cases ending.
134
+		 *    @access public
135
+		 */
136
+		function paintMethodEnd($test_name) {
137
+			print $this->_getIndent();
138
+			print "</" . $this->_namespace . "test>\n";
139
+			parent::paintMethodEnd($test_name);
140
+		}
141
+
142
+		/**
143
+		 *    Increments the pass count.
144
+		 *    @param string $message        Message is ignored.
145
+		 *    @access public
146
+		 */
147
+		function paintPass($message) {
148
+			parent::paintPass($message);
149
+			print $this->_getIndent(1);
150
+			print "<" . $this->_namespace . "pass>";
151
+			print $this->toParsedXml($message);
152
+			print "</" . $this->_namespace . "pass>\n";
153
+		}
154
+
155
+		/**
156
+		 *    Increments the fail count.
157
+		 *    @param string $message        Message is ignored.
158
+		 *    @access public
159
+		 */
160
+		function paintFail($message) {
161
+			parent::paintFail($message);
162
+			print $this->_getIndent(1);
163
+			print "<" . $this->_namespace . "fail>";
164
+			print $this->toParsedXml($message);
165
+			print "</" . $this->_namespace . "fail>\n";
166
+		}
167
+
168
+		/**
169
+		 *    Paints a PHP error or exception.
170
+		 *    @param string $message        Message is ignored.
171
+		 *    @access public
172
+		 *    @abstract
173
+		 */
174
+		function paintError($message) {
175
+			parent::paintError($message);
176
+			print $this->_getIndent(1);
177
+			print "<" . $this->_namespace . "exception>";
178
+			print $this->toParsedXml($message);
179
+			print "</" . $this->_namespace . "exception>\n";
180
+		}
181
+
182
+		/**
183
+		 *    Paints a simple supplementary message.
184
+		 *    @param string $message        Text to display.
185
+		 *    @access public
186
+		 */
187
+		function paintMessage($message) {
188
+			parent::paintMessage($message);
189
+			print $this->_getIndent(1);
190
+			print "<" . $this->_namespace . "message>";
191
+			print $this->toParsedXml($message);
192
+			print "</" . $this->_namespace . "message>\n";
193
+		}
194
+
195
+		/**
196
+		 *    Paints a formatted ASCII message such as a
197
+		 *    variable dump.
198
+		 *    @param string $message        Text to display.
199
+		 *    @access public
200
+		 */
201
+		function paintFormattedMessage($message) {
202
+			parent::paintFormattedMessage($message);
203
+			print $this->_getIndent(1);
204
+			print "<" . $this->_namespace . "formatted>";
205
+			print "<![CDATA[$message]]>";
206
+			print "</" . $this->_namespace . "formatted>\n";
207
+		}
208
+
209
+		/**
210
+		 *    Serialises the event object.
211
+		 *    @param string $type        Event type as text.
212
+		 *    @param mixed $payload      Message or object.
213
+		 *    @access public
214
+		 */
215
+		function paintSignal($type, $payload) {
216
+			parent::paintSignal($type, $payload);
217
+			print $this->_getIndent(1);
218
+			print "<" . $this->_namespace . "signal type=\"$type\">";
219
+			print "<![CDATA[" . serialize($payload) . "]]>";
220
+			print "</" . $this->_namespace . "signal>\n";
221
+		}
222
+
223
+		/**
224
+		 *    Paints the test document header.
225
+		 *    @param string $test_name     First test top level
226
+		 *                                 to start.
227
+		 *    @access public
228
+		 *    @abstract
229
+		 */
230
+		function paintHeader($test_name) {
231
+			if (! SimpleReporter::inCli()) {
232
+				header('Content-type: text/xml');
233
+			}
234
+			print "<?xml version=\"1.0\"";
235
+			if ($this->_namespace) {
236
+				print " xmlns:" . $this->_namespace .
237
+						"=\"www.lastcraft.com/SimpleTest/Beta3/Report\"";
238
+			}
239
+			print "?>\n";
240
+			print "<" . $this->_namespace . "run>\n";
241
+		}
242
+
243
+		/**
244
+		 *    Paints the test document footer.
245
+		 *    @param string $test_name        The top level test.
246
+		 *    @access public
247
+		 *    @abstract
248
+		 */
249
+		function paintFooter($test_name) {
250
+			print "</" . $this->_namespace . "run>\n";
251
+		}
252
+	}
253
+
254
+	/**
255
+	 *    Accumulator for incoming tag. Holds the
256
+	 *    incoming test structure information for
257
+	 *    later dispatch to the reporter.
258 258
 	 *	  @package SimpleTest
259 259
 	 *	  @subpackage UnitTester
260
-     */
261
-    class NestingXmlTag {
262
-        protected $_name;
263
-        protected $_attributes;
264
-
265
-        /**
266
-         *    Sets the basic test information except
267
-         *    the name.
268
-         *    @param hash $attributes   Name value pairs.
269
-         *    @access public
270
-         */
271
-        function NestingXmlTag($attributes) {
272
-            $this->_name = false;
273
-            $this->_attributes = $attributes;
274
-        }
275
-
276
-        /**
277
-         *    Sets the test case/method name.
278
-         *    @param string $name        Name of test.
279
-         *    @access public
280
-         */
281
-        function setName($name) {
282
-            $this->_name = $name;
283
-        }
284
-
285
-        /**
286
-         *    Accessor for name.
287
-         *    @return string        Name of test.
288
-         *    @access public
289
-         */
290
-        function getName() {
291
-            return $this->_name;
292
-        }
293
-
294
-        /**
295
-         *    Accessor for attributes.
296
-         *    @return hash        All attributes.
297
-         *    @access protected
298
-         */
299
-        function _getAttributes() {
300
-            return $this->_attributes;
301
-        }
302
-    }
303
-
304
-    /**
305
-     *    Accumulator for incoming method tag. Holds the
306
-     *    incoming test structure information for
307
-     *    later dispatch to the reporter.
260
+	 */
261
+	class NestingXmlTag {
262
+		protected $_name;
263
+		protected $_attributes;
264
+
265
+		/**
266
+		 *    Sets the basic test information except
267
+		 *    the name.
268
+		 *    @param hash $attributes   Name value pairs.
269
+		 *    @access public
270
+		 */
271
+		function NestingXmlTag($attributes) {
272
+			$this->_name = false;
273
+			$this->_attributes = $attributes;
274
+		}
275
+
276
+		/**
277
+		 *    Sets the test case/method name.
278
+		 *    @param string $name        Name of test.
279
+		 *    @access public
280
+		 */
281
+		function setName($name) {
282
+			$this->_name = $name;
283
+		}
284
+
285
+		/**
286
+		 *    Accessor for name.
287
+		 *    @return string        Name of test.
288
+		 *    @access public
289
+		 */
290
+		function getName() {
291
+			return $this->_name;
292
+		}
293
+
294
+		/**
295
+		 *    Accessor for attributes.
296
+		 *    @return hash        All attributes.
297
+		 *    @access protected
298
+		 */
299
+		function _getAttributes() {
300
+			return $this->_attributes;
301
+		}
302
+	}
303
+
304
+	/**
305
+	 *    Accumulator for incoming method tag. Holds the
306
+	 *    incoming test structure information for
307
+	 *    later dispatch to the reporter.
308 308
 	 *	  @package SimpleTest
309 309
 	 *	  @subpackage UnitTester
310
-     */
311
-    class NestingMethodTag extends NestingXmlTag {
312
-
313
-        /**
314
-         *    Sets the basic test information except
315
-         *    the name.
316
-         *    @param hash $attributes   Name value pairs.
317
-         *    @access public
318
-         */
319
-        function NestingMethodTag($attributes) {
320
-            $this->NestingXmlTag($attributes);
321
-        }
322
-
323
-        /**
324
-         *    Signals the appropriate start event on the
325
-         *    listener.
326
-         *    @param SimpleReporter $listener    Target for events.
327
-         *    @access public
328
-         */
329
-        function paintStart($listener) {
330
-            $listener->paintMethodStart($this->getName());
331
-        }
332
-
333
-        /**
334
-         *    Signals the appropriate end event on the
335
-         *    listener.
336
-         *    @param SimpleReporter $listener    Target for events.
337
-         *    @access public
338
-         */
339
-        function paintEnd($listener) {
340
-            $listener->paintMethodEnd($this->getName());
341
-        }
342
-    }
343
-
344
-    /**
345
-     *    Accumulator for incoming case tag. Holds the
346
-     *    incoming test structure information for
347
-     *    later dispatch to the reporter.
310
+	 */
311
+	class NestingMethodTag extends NestingXmlTag {
312
+
313
+		/**
314
+		 *    Sets the basic test information except
315
+		 *    the name.
316
+		 *    @param hash $attributes   Name value pairs.
317
+		 *    @access public
318
+		 */
319
+		function NestingMethodTag($attributes) {
320
+			$this->NestingXmlTag($attributes);
321
+		}
322
+
323
+		/**
324
+		 *    Signals the appropriate start event on the
325
+		 *    listener.
326
+		 *    @param SimpleReporter $listener    Target for events.
327
+		 *    @access public
328
+		 */
329
+		function paintStart($listener) {
330
+			$listener->paintMethodStart($this->getName());
331
+		}
332
+
333
+		/**
334
+		 *    Signals the appropriate end event on the
335
+		 *    listener.
336
+		 *    @param SimpleReporter $listener    Target for events.
337
+		 *    @access public
338
+		 */
339
+		function paintEnd($listener) {
340
+			$listener->paintMethodEnd($this->getName());
341
+		}
342
+	}
343
+
344
+	/**
345
+	 *    Accumulator for incoming case tag. Holds the
346
+	 *    incoming test structure information for
347
+	 *    later dispatch to the reporter.
348 348
 	 *	  @package SimpleTest
349 349
 	 *	  @subpackage UnitTester
350
-     */
351
-    class NestingCaseTag extends NestingXmlTag {
352
-
353
-        /**
354
-         *    Sets the basic test information except
355
-         *    the name.
356
-         *    @param hash $attributes   Name value pairs.
357
-         *    @access public
358
-         */
359
-        function NestingCaseTag($attributes) {
360
-            $this->NestingXmlTag($attributes);
361
-        }
362
-
363
-        /**
364
-         *    Signals the appropriate start event on the
365
-         *    listener.
366
-         *    @param SimpleReporter $listener    Target for events.
367
-         *    @access public
368
-         */
369
-        function paintStart($listener) {
370
-            $listener->paintCaseStart($this->getName());
371
-        }
372
-
373
-        /**
374
-         *    Signals the appropriate end event on the
375
-         *    listener.
376
-         *    @param SimpleReporter $listener    Target for events.
377
-         *    @access public
378
-         */
379
-        function paintEnd($listener) {
380
-            $listener->paintCaseEnd($this->getName());
381
-        }
382
-    }
383
-
384
-    /**
385
-     *    Accumulator for incoming group tag. Holds the
386
-     *    incoming test structure information for
387
-     *    later dispatch to the reporter.
350
+	 */
351
+	class NestingCaseTag extends NestingXmlTag {
352
+
353
+		/**
354
+		 *    Sets the basic test information except
355
+		 *    the name.
356
+		 *    @param hash $attributes   Name value pairs.
357
+		 *    @access public
358
+		 */
359
+		function NestingCaseTag($attributes) {
360
+			$this->NestingXmlTag($attributes);
361
+		}
362
+
363
+		/**
364
+		 *    Signals the appropriate start event on the
365
+		 *    listener.
366
+		 *    @param SimpleReporter $listener    Target for events.
367
+		 *    @access public
368
+		 */
369
+		function paintStart($listener) {
370
+			$listener->paintCaseStart($this->getName());
371
+		}
372
+
373
+		/**
374
+		 *    Signals the appropriate end event on the
375
+		 *    listener.
376
+		 *    @param SimpleReporter $listener    Target for events.
377
+		 *    @access public
378
+		 */
379
+		function paintEnd($listener) {
380
+			$listener->paintCaseEnd($this->getName());
381
+		}
382
+	}
383
+
384
+	/**
385
+	 *    Accumulator for incoming group tag. Holds the
386
+	 *    incoming test structure information for
387
+	 *    later dispatch to the reporter.
388 388
 	 *	  @package SimpleTest
389 389
 	 *	  @subpackage UnitTester
390
-     */
391
-    class NestingGroupTag extends NestingXmlTag {
392
-
393
-        /**
394
-         *    Sets the basic test information except
395
-         *    the name.
396
-         *    @param hash $attributes   Name value pairs.
397
-         *    @access public
398
-         */
399
-        function NestingGroupTag($attributes) {
400
-            $this->NestingXmlTag($attributes);
401
-        }
402
-
403
-        /**
404
-         *    Signals the appropriate start event on the
405
-         *    listener.
406
-         *    @param SimpleReporter $listener    Target for events.
407
-         *    @access public
408
-         */
409
-        function paintStart($listener) {
410
-            $listener->paintGroupStart($this->getName(), $this->getSize());
411
-        }
412
-
413
-        /**
414
-         *    Signals the appropriate end event on the
415
-         *    listener.
416
-         *    @param SimpleReporter $listener    Target for events.
417
-         *    @access public
418
-         */
419
-        function paintEnd($listener) {
420
-            $listener->paintGroupEnd($this->getName());
421
-        }
422
-
423
-        /**
424
-         *    The size in the attributes.
425
-         *    @return integer     Value of size attribute or zero.
426
-         *    @access public
427
-         */
428
-        function getSize() {
429
-            $attributes = $this->_getAttributes();
430
-            if (isset($attributes['SIZE'])) {
431
-                return (integer)$attributes['SIZE'];
432
-            }
433
-            return 0;
434
-        }
435
-    }
436
-
437
-    /**
438
-     *    Parser for importing the output of the XmlReporter.
439
-     *    Dispatches that output to another reporter.
390
+	 */
391
+	class NestingGroupTag extends NestingXmlTag {
392
+
393
+		/**
394
+		 *    Sets the basic test information except
395
+		 *    the name.
396
+		 *    @param hash $attributes   Name value pairs.
397
+		 *    @access public
398
+		 */
399
+		function NestingGroupTag($attributes) {
400
+			$this->NestingXmlTag($attributes);
401
+		}
402
+
403
+		/**
404
+		 *    Signals the appropriate start event on the
405
+		 *    listener.
406
+		 *    @param SimpleReporter $listener    Target for events.
407
+		 *    @access public
408
+		 */
409
+		function paintStart($listener) {
410
+			$listener->paintGroupStart($this->getName(), $this->getSize());
411
+		}
412
+
413
+		/**
414
+		 *    Signals the appropriate end event on the
415
+		 *    listener.
416
+		 *    @param SimpleReporter $listener    Target for events.
417
+		 *    @access public
418
+		 */
419
+		function paintEnd($listener) {
420
+			$listener->paintGroupEnd($this->getName());
421
+		}
422
+
423
+		/**
424
+		 *    The size in the attributes.
425
+		 *    @return integer     Value of size attribute or zero.
426
+		 *    @access public
427
+		 */
428
+		function getSize() {
429
+			$attributes = $this->_getAttributes();
430
+			if (isset($attributes['SIZE'])) {
431
+				return (integer)$attributes['SIZE'];
432
+			}
433
+			return 0;
434
+		}
435
+	}
436
+
437
+	/**
438
+	 *    Parser for importing the output of the XmlReporter.
439
+	 *    Dispatches that output to another reporter.
440 440
 	 *	  @package SimpleTest
441 441
 	 *	  @subpackage UnitTester
442
-     */
443
-    class SimpleTestXmlParser {
444
-        protected $_listener;
445
-        protected $_expat;
446
-        protected $_tag_stack;
447
-        protected $_in_content_tag;
448
-        protected $_content;
449
-        protected $_attributes;
450
-
451
-        /**
452
-         *    Loads a listener with the SimpleReporter
453
-         *    interface.
454
-         *    @param SimpleReporter $listener   Listener of tag events.
455
-         *    @access public
456
-         */
457
-        function SimpleTestXmlParser($listener) {
458
-            $this->_listener = $listener;
459
-            $this->_expat = $this->_createParser();
460
-            $this->_tag_stack = array();
461
-            $this->_in_content_tag = false;
462
-            $this->_content = '';
463
-            $this->_attributes = array();
464
-        }
465
-
466
-        /**
467
-         *    Parses a block of XML sending the results to
468
-         *    the listener.
469
-         *    @param string $chunk        Block of text to read.
470
-         *    @return boolean             True if valid XML.
471
-         *    @access public
472
-         */
473
-        function parse($chunk) {
474
-            if (! xml_parse($this->_expat, $chunk)) {
475
-                trigger_error('XML parse error with ' .
476
-                        xml_error_string(xml_get_error_code($this->_expat)));
477
-                return false;
478
-            }
479
-            return true;
480
-        }
481
-
482
-        /**
483
-         *    Sets up expat as the XML parser.
484
-         *    @return resource        Expat handle.
485
-         *    @access protected
486
-         */
487
-        function &_createParser() {
488
-            $expat = xml_parser_create();
489
-            xml_set_object($expat, $this);
490
-            xml_set_element_handler($expat, '_startElement', '_endElement');
491
-            xml_set_character_data_handler($expat, '_addContent');
492
-            xml_set_default_handler($expat, '_default');
493
-            return $expat;
494
-        }
495
-
496
-        /**
497
-         *    Opens a new test nesting level.
498
-         *    @return NestedXmlTag     The group, case or method tag
499
-         *                             to start.
500
-         *    @access private
501
-         */
502
-        function _pushNestingTag($nested) {
503
-            array_unshift($this->_tag_stack, $nested);
504
-        }
505
-
506
-        /**
507
-         *    Accessor for current test structure tag.
508
-         *    @return NestedXmlTag     The group, case or method tag
509
-         *                             being parsed.
510
-         *    @access private
511
-         */
512
-        function &_getCurrentNestingTag() {
513
-            return $this->_tag_stack[0];
514
-        }
515
-
516
-        /**
517
-         *    Ends a nesting tag.
518
-         *    @return NestedXmlTag     The group, case or method tag
519
-         *                             just finished.
520
-         *    @access private
521
-         */
522
-        function _popNestingTag() {
523
-            return array_shift($this->_tag_stack);
524
-        }
525
-
526
-        /**
527
-         *    Test if tag is a leaf node with only text content.
528
-         *    @param string $tag        XML tag name.
529
-         *    @return @boolean          True if leaf, false if nesting.
530
-         *    @private
531
-         */
532
-        function _isLeaf($tag) {
533
-            return in_array($tag, array(
534
-                    'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'MESSAGE', 'FORMATTED', 'SIGNAL'));
535
-        }
536
-
537
-        /**
538
-         *    Handler for start of event element.
539
-         *    @param resource $expat     Parser handle.
540
-         *    @param string $tag         Element name.
541
-         *    @param hash $attributes    Name value pairs.
542
-         *                               Attributes without content
543
-         *                               are marked as true.
544
-         *    @access protected
545
-         */
546
-        function _startElement($expat, $tag, $attributes) {
547
-            $this->_attributes = $attributes;
548
-            if ($tag == 'GROUP') {
549
-                $this->_pushNestingTag(new NestingGroupTag($attributes));
550
-            } elseif ($tag == 'CASE') {
551
-                $this->_pushNestingTag(new NestingCaseTag($attributes));
552
-            } elseif ($tag == 'TEST') {
553
-                $this->_pushNestingTag(new NestingMethodTag($attributes));
554
-            } elseif ($this->_isLeaf($tag)) {
555
-                $this->_in_content_tag = true;
556
-                $this->_content = '';
557
-            }
558
-        }
559
-
560
-        /**
561
-         *    End of element event.
562
-         *    @param resource $expat     Parser handle.
563
-         *    @param string $tag         Element name.
564
-         *    @access protected
565
-         */
566
-        function _endElement($expat, $tag) {
567
-            $this->_in_content_tag = false;
568
-            if (in_array($tag, array('GROUP', 'CASE', 'TEST'))) {
569
-                $nesting_tag = $this->_popNestingTag();
570
-                $nesting_tag->paintEnd($this->_listener);
571
-            } elseif ($tag == 'NAME') {
572
-                $nesting_tag = $this->_getCurrentNestingTag();
573
-                $nesting_tag->setName($this->_content);
574
-                $nesting_tag->paintStart($this->_listener);
575
-            } elseif ($tag == 'PASS') {
576
-                $this->_listener->paintPass($this->_content);
577
-            } elseif ($tag == 'FAIL') {
578
-                $this->_listener->paintFail($this->_content);
579
-            } elseif ($tag == 'EXCEPTION') {
580
-                $this->_listener->paintError($this->_content);
581
-            } elseif ($tag == 'SIGNAL') {
582
-                $this->_listener->paintSignal(
583
-                        $this->_attributes['TYPE'],
584
-                        unserialize($this->_content));
585
-            } elseif ($tag == 'MESSAGE') {
586
-                $this->_listener->paintMessage($this->_content);
587
-            } elseif ($tag == 'FORMATTED') {
588
-                $this->_listener->paintFormattedMessage($this->_content);
589
-            }
590
-        }
591
-
592
-        /**
593
-         *    Content between start and end elements.
594
-         *    @param resource $expat     Parser handle.
595
-         *    @param string $text        Usually output messages.
596
-         *    @access protected
597
-         */
598
-        function _addContent($expat, $text) {
599
-            if ($this->_in_content_tag) {
600
-                $this->_content .= $text;
601
-            }
602
-            return true;
603
-        }
604
-
605
-        /**
606
-         *    XML and Doctype handler. Discards all such content.
607
-         *    @param resource $expat     Parser handle.
608
-         *    @param string $default     Text of default content.
609
-         *    @access protected
610
-         */
611
-        function _default($expat, $default) {
612
-        }
613
-    }
442
+	 */
443
+	class SimpleTestXmlParser {
444
+		protected $_listener;
445
+		protected $_expat;
446
+		protected $_tag_stack;
447
+		protected $_in_content_tag;
448
+		protected $_content;
449
+		protected $_attributes;
450
+
451
+		/**
452
+		 *    Loads a listener with the SimpleReporter
453
+		 *    interface.
454
+		 *    @param SimpleReporter $listener   Listener of tag events.
455
+		 *    @access public
456
+		 */
457
+		function SimpleTestXmlParser($listener) {
458
+			$this->_listener = $listener;
459
+			$this->_expat = $this->_createParser();
460
+			$this->_tag_stack = array();
461
+			$this->_in_content_tag = false;
462
+			$this->_content = '';
463
+			$this->_attributes = array();
464
+		}
465
+
466
+		/**
467
+		 *    Parses a block of XML sending the results to
468
+		 *    the listener.
469
+		 *    @param string $chunk        Block of text to read.
470
+		 *    @return boolean             True if valid XML.
471
+		 *    @access public
472
+		 */
473
+		function parse($chunk) {
474
+			if (! xml_parse($this->_expat, $chunk)) {
475
+				trigger_error('XML parse error with ' .
476
+						xml_error_string(xml_get_error_code($this->_expat)));
477
+				return false;
478
+			}
479
+			return true;
480
+		}
481
+
482
+		/**
483
+		 *    Sets up expat as the XML parser.
484
+		 *    @return resource        Expat handle.
485
+		 *    @access protected
486
+		 */
487
+		function &_createParser() {
488
+			$expat = xml_parser_create();
489
+			xml_set_object($expat, $this);
490
+			xml_set_element_handler($expat, '_startElement', '_endElement');
491
+			xml_set_character_data_handler($expat, '_addContent');
492
+			xml_set_default_handler($expat, '_default');
493
+			return $expat;
494
+		}
495
+
496
+		/**
497
+		 *    Opens a new test nesting level.
498
+		 *    @return NestedXmlTag     The group, case or method tag
499
+		 *                             to start.
500
+		 *    @access private
501
+		 */
502
+		function _pushNestingTag($nested) {
503
+			array_unshift($this->_tag_stack, $nested);
504
+		}
505
+
506
+		/**
507
+		 *    Accessor for current test structure tag.
508
+		 *    @return NestedXmlTag     The group, case or method tag
509
+		 *                             being parsed.
510
+		 *    @access private
511
+		 */
512
+		function &_getCurrentNestingTag() {
513
+			return $this->_tag_stack[0];
514
+		}
515
+
516
+		/**
517
+		 *    Ends a nesting tag.
518
+		 *    @return NestedXmlTag     The group, case or method tag
519
+		 *                             just finished.
520
+		 *    @access private
521
+		 */
522
+		function _popNestingTag() {
523
+			return array_shift($this->_tag_stack);
524
+		}
525
+
526
+		/**
527
+		 *    Test if tag is a leaf node with only text content.
528
+		 *    @param string $tag        XML tag name.
529
+		 *    @return @boolean          True if leaf, false if nesting.
530
+		 *    @private
531
+		 */
532
+		function _isLeaf($tag) {
533
+			return in_array($tag, array(
534
+					'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'MESSAGE', 'FORMATTED', 'SIGNAL'));
535
+		}
536
+
537
+		/**
538
+		 *    Handler for start of event element.
539
+		 *    @param resource $expat     Parser handle.
540
+		 *    @param string $tag         Element name.
541
+		 *    @param hash $attributes    Name value pairs.
542
+		 *                               Attributes without content
543
+		 *                               are marked as true.
544
+		 *    @access protected
545
+		 */
546
+		function _startElement($expat, $tag, $attributes) {
547
+			$this->_attributes = $attributes;
548
+			if ($tag == 'GROUP') {
549
+				$this->_pushNestingTag(new NestingGroupTag($attributes));
550
+			} elseif ($tag == 'CASE') {
551
+				$this->_pushNestingTag(new NestingCaseTag($attributes));
552
+			} elseif ($tag == 'TEST') {
553
+				$this->_pushNestingTag(new NestingMethodTag($attributes));
554
+			} elseif ($this->_isLeaf($tag)) {
555
+				$this->_in_content_tag = true;
556
+				$this->_content = '';
557
+			}
558
+		}
559
+
560
+		/**
561
+		 *    End of element event.
562
+		 *    @param resource $expat     Parser handle.
563
+		 *    @param string $tag         Element name.
564
+		 *    @access protected
565
+		 */
566
+		function _endElement($expat, $tag) {
567
+			$this->_in_content_tag = false;
568
+			if (in_array($tag, array('GROUP', 'CASE', 'TEST'))) {
569
+				$nesting_tag = $this->_popNestingTag();
570
+				$nesting_tag->paintEnd($this->_listener);
571
+			} elseif ($tag == 'NAME') {
572
+				$nesting_tag = $this->_getCurrentNestingTag();
573
+				$nesting_tag->setName($this->_content);
574
+				$nesting_tag->paintStart($this->_listener);
575
+			} elseif ($tag == 'PASS') {
576
+				$this->_listener->paintPass($this->_content);
577
+			} elseif ($tag == 'FAIL') {
578
+				$this->_listener->paintFail($this->_content);
579
+			} elseif ($tag == 'EXCEPTION') {
580
+				$this->_listener->paintError($this->_content);
581
+			} elseif ($tag == 'SIGNAL') {
582
+				$this->_listener->paintSignal(
583
+						$this->_attributes['TYPE'],
584
+						unserialize($this->_content));
585
+			} elseif ($tag == 'MESSAGE') {
586
+				$this->_listener->paintMessage($this->_content);
587
+			} elseif ($tag == 'FORMATTED') {
588
+				$this->_listener->paintFormattedMessage($this->_content);
589
+			}
590
+		}
591
+
592
+		/**
593
+		 *    Content between start and end elements.
594
+		 *    @param resource $expat     Parser handle.
595
+		 *    @param string $text        Usually output messages.
596
+		 *    @access protected
597
+		 */
598
+		function _addContent($expat, $text) {
599
+			if ($this->_in_content_tag) {
600
+				$this->_content .= $text;
601
+			}
602
+			return true;
603
+		}
604
+
605
+		/**
606
+		 *    XML and Doctype handler. Discards all such content.
607
+		 *    @param resource $expat     Parser handle.
608
+		 *    @param string $default     Text of default content.
609
+		 *    @access protected
610
+		 */
611
+		function _default($expat, $default) {
612
+		}
613
+	}
Please login to merge, or discard this patch.
tests/test_tools/simpletest/remote.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -1,114 +1,114 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	base include file for SimpleTest
4
-     *	@package	SimpleTest
5
-     *	@subpackage	UnitTester
6
-     *	@version	$Id: remote.php 1398 2006-09-08 19:31:03Z xue $
7
-     */
2
+	/**
3
+	 *	base include file for SimpleTest
4
+	 *	@package	SimpleTest
5
+	 *	@subpackage	UnitTester
6
+	 *	@version	$Id: remote.php 1398 2006-09-08 19:31:03Z xue $
7
+	 */
8 8
 
9
-    /**#@+
9
+	/**#@+
10 10
      *	include other SimpleTest class files
11 11
      */
12
-    require_once(dirname(__FILE__) . '/browser.php');
13
-    require_once(dirname(__FILE__) . '/xml.php');
14
-    require_once(dirname(__FILE__) . '/test_case.php');
15
-    /**#@-*/
12
+	require_once(dirname(__FILE__) . '/browser.php');
13
+	require_once(dirname(__FILE__) . '/xml.php');
14
+	require_once(dirname(__FILE__) . '/test_case.php');
15
+	/**#@-*/
16 16
 
17
-    /**
18
-     *    Runs an XML formated test on a remote server.
17
+	/**
18
+	 *    Runs an XML formated test on a remote server.
19 19
 	 *	  @package SimpleTest
20 20
 	 *	  @subpackage UnitTester
21
-     */
22
-    class RemoteTestCase {
23
-        protected $_url;
24
-        protected $_dry_url;
25
-        protected $_size;
21
+	 */
22
+	class RemoteTestCase {
23
+		protected $_url;
24
+		protected $_dry_url;
25
+		protected $_size;
26 26
 
27
-        /**
28
-         *    Sets the location of the remote test.
29
-         *    @param string $url       Test location.
30
-         *    @param string $dry_url   Location for dry run.
31
-         *    @access public
32
-         */
33
-        function RemoteTestCase($url, $dry_url = false) {
34
-            $this->_url = $url;
35
-            $this->_dry_url = $dry_url ? $dry_url : $url;
36
-            $this->_size = false;
37
-        }
27
+		/**
28
+		 *    Sets the location of the remote test.
29
+		 *    @param string $url       Test location.
30
+		 *    @param string $dry_url   Location for dry run.
31
+		 *    @access public
32
+		 */
33
+		function RemoteTestCase($url, $dry_url = false) {
34
+			$this->_url = $url;
35
+			$this->_dry_url = $dry_url ? $dry_url : $url;
36
+			$this->_size = false;
37
+		}
38 38
 
39
-        /**
40
-         *    Accessor for the test name for subclasses.
41
-         *    @return string           Name of the test.
42
-         *    @access public
43
-         */
44
-        function getLabel() {
45
-            return $this->_url;
46
-        }
39
+		/**
40
+		 *    Accessor for the test name for subclasses.
41
+		 *    @return string           Name of the test.
42
+		 *    @access public
43
+		 */
44
+		function getLabel() {
45
+			return $this->_url;
46
+		}
47 47
 
48
-        /**
49
-         *    Runs the top level test for this class. Currently
50
-         *    reads the data as a single chunk. I'll fix this
51
-         *    once I have added iteration to the browser.
52
-         *    @param SimpleReporter $reporter    Target of test results.
53
-         *    @returns boolean                   True if no failures.
54
-         *    @access public
55
-         */
56
-        function run($reporter) {
57
-            $browser = $this->_createBrowser();
58
-            $xml = $browser->get($this->_url);
59
-            if (! $xml) {
60
-                trigger_error('Cannot read remote test URL [' . $this->_url . ']');
61
-                return false;
62
-            }
63
-            $parser = $this->_createParser($reporter);
64
-            if (! $parser->parse($xml)) {
65
-                trigger_error('Cannot parse incoming XML from [' . $this->_url . ']');
66
-                return false;
67
-            }
68
-            return true;
69
-        }
48
+		/**
49
+		 *    Runs the top level test for this class. Currently
50
+		 *    reads the data as a single chunk. I'll fix this
51
+		 *    once I have added iteration to the browser.
52
+		 *    @param SimpleReporter $reporter    Target of test results.
53
+		 *    @returns boolean                   True if no failures.
54
+		 *    @access public
55
+		 */
56
+		function run($reporter) {
57
+			$browser = $this->_createBrowser();
58
+			$xml = $browser->get($this->_url);
59
+			if (! $xml) {
60
+				trigger_error('Cannot read remote test URL [' . $this->_url . ']');
61
+				return false;
62
+			}
63
+			$parser = $this->_createParser($reporter);
64
+			if (! $parser->parse($xml)) {
65
+				trigger_error('Cannot parse incoming XML from [' . $this->_url . ']');
66
+				return false;
67
+			}
68
+			return true;
69
+		}
70 70
 
71
-        /**
72
-         *    Creates a new web browser object for fetching
73
-         *    the XML report.
74
-         *    @return SimpleBrowser           New browser.
75
-         *    @access protected
76
-         */
77
-        function &_createBrowser() {
78
-            return new SimpleBrowser();
79
-        }
71
+		/**
72
+		 *    Creates a new web browser object for fetching
73
+		 *    the XML report.
74
+		 *    @return SimpleBrowser           New browser.
75
+		 *    @access protected
76
+		 */
77
+		function &_createBrowser() {
78
+			return new SimpleBrowser();
79
+		}
80 80
 
81
-        /**
82
-         *    Creates the XML parser.
83
-         *    @param SimpleReporter $reporter    Target of test results.
84
-         *    @return SimpleTestXmlListener      XML reader.
85
-         *    @access protected
86
-         */
87
-        function &_createParser($reporter) {
88
-            return new SimpleTestXmlParser($reporter);
89
-        }
81
+		/**
82
+		 *    Creates the XML parser.
83
+		 *    @param SimpleReporter $reporter    Target of test results.
84
+		 *    @return SimpleTestXmlListener      XML reader.
85
+		 *    @access protected
86
+		 */
87
+		function &_createParser($reporter) {
88
+			return new SimpleTestXmlParser($reporter);
89
+		}
90 90
 
91
-        /**
92
-         *    Accessor for the number of subtests.
93
-         *    @return integer           Number of test cases.
94
-         *    @access public
95
-         */
96
-        function getSize() {
97
-            if ($this->_size === false) {
98
-                $browser = $this->_createBrowser();
99
-                $xml = $browser->get($this->_dry_url);
100
-                if (! $xml) {
101
-                    trigger_error('Cannot read remote test URL [' . $this->_dry_url . ']');
102
-                    return false;
103
-                }
104
-                $reporter = new SimpleReporter();
105
-                $parser = $this->_createParser($reporter);
106
-                if (! $parser->parse($xml)) {
107
-                    trigger_error('Cannot parse incoming XML from [' . $this->_dry_url . ']');
108
-                    return false;
109
-                }
110
-                $this->_size = $reporter->getTestCaseCount();
111
-            }
112
-            return $this->_size;
113
-        }
114
-    }
115 91
\ No newline at end of file
92
+		/**
93
+		 *    Accessor for the number of subtests.
94
+		 *    @return integer           Number of test cases.
95
+		 *    @access public
96
+		 */
97
+		function getSize() {
98
+			if ($this->_size === false) {
99
+				$browser = $this->_createBrowser();
100
+				$xml = $browser->get($this->_dry_url);
101
+				if (! $xml) {
102
+					trigger_error('Cannot read remote test URL [' . $this->_dry_url . ']');
103
+					return false;
104
+				}
105
+				$reporter = new SimpleReporter();
106
+				$parser = $this->_createParser($reporter);
107
+				if (! $parser->parse($xml)) {
108
+					trigger_error('Cannot parse incoming XML from [' . $this->_dry_url . ']');
109
+					return false;
110
+				}
111
+				$this->_size = $reporter->getTestCaseCount();
112
+			}
113
+			return $this->_size;
114
+		}
115
+	}
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test_tools/simpletest/options.php 1 patch
Indentation   +339 added lines, -339 removed lines patch added patch discarded remove patch
@@ -1,365 +1,365 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	base include file for SimpleTest
4
-     *	@package	SimpleTest
5
-     *	@version	$Id: options.php 1532 2006-12-01 12:28:55Z xue $
6
-     */
2
+	/**
3
+	 *	base include file for SimpleTest
4
+	 *	@package	SimpleTest
5
+	 *	@version	$Id: options.php 1532 2006-12-01 12:28:55Z xue $
6
+	 */
7 7
 
8
-    /**
9
-     *    Static global directives and options.
10
-     *	  @package	SimpleTest
11
-     */
12
-    class SimpleTestOptions {
8
+	/**
9
+	 *    Static global directives and options.
10
+	 *	  @package	SimpleTest
11
+	 */
12
+	class SimpleTestOptions {
13 13
 
14
-        /**
15
-         *    Reads the SimpleTest version from the release file.
16
-         *    @return string        Version string.
17
-         *    @static
18
-         *    @access public
19
-         */
20
-        static function getVersion() {
21
-            $content = file(dirname(__FILE__) . '/VERSION');
22
-            return trim($content[0]);
23
-        }
14
+		/**
15
+		 *    Reads the SimpleTest version from the release file.
16
+		 *    @return string        Version string.
17
+		 *    @static
18
+		 *    @access public
19
+		 */
20
+		static function getVersion() {
21
+			$content = file(dirname(__FILE__) . '/VERSION');
22
+			return trim($content[0]);
23
+		}
24 24
 
25
-        /**
26
-         *    Sets the name of a test case to ignore, usually
27
-         *    because the class is an abstract case that should
28
-         *    not be run.
29
-         *    @param string $class        Add a class to ignore.
30
-         *    @static
31
-         *    @access public
32
-         */
33
-        static function ignore($class) {
34
-            $registry =SimpleTestOptions::_getRegistry();
35
-            $registry['IgnoreList'][] = strtolower($class);
36
-        }
25
+		/**
26
+		 *    Sets the name of a test case to ignore, usually
27
+		 *    because the class is an abstract case that should
28
+		 *    not be run.
29
+		 *    @param string $class        Add a class to ignore.
30
+		 *    @static
31
+		 *    @access public
32
+		 */
33
+		static function ignore($class) {
34
+			$registry =SimpleTestOptions::_getRegistry();
35
+			$registry['IgnoreList'][] = strtolower($class);
36
+		}
37 37
 
38
-        /**
39
-         *    Test to see if a test case is in the ignore
40
-         *    list.
41
-         *    @param string $class        Class name to test.
42
-         *    @return boolean             True if should not be run.
43
-         *    @access public
44
-         *    @static
45
-         */
46
-        static function isIgnored($class) {
47
-            $registry =SimpleTestOptions::_getRegistry();
48
-            return in_array(strtolower($class), $registry['IgnoreList']);
49
-        }
38
+		/**
39
+		 *    Test to see if a test case is in the ignore
40
+		 *    list.
41
+		 *    @param string $class        Class name to test.
42
+		 *    @return boolean             True if should not be run.
43
+		 *    @access public
44
+		 *    @static
45
+		 */
46
+		static function isIgnored($class) {
47
+			$registry =SimpleTestOptions::_getRegistry();
48
+			return in_array(strtolower($class), $registry['IgnoreList']);
49
+		}
50 50
 
51
-        /**
52
-         *    The base class name is settable here. This is the
53
-         *    class that a new stub will inherited from.
54
-         *    To modify the generated stubs simply extend the
55
-         *    SimpleStub class and set it's name
56
-         *    with this method before any stubs are generated.
57
-         *    @param string $stub_base     Server stub class to use.
58
-         *    @static
59
-         *    @access public
60
-         */
61
-        static function setStubBaseClass($stub_base) {
62
-            $registry =SimpleTestOptions::_getRegistry();
63
-            $registry['StubBaseClass'] = $stub_base;
64
-        }
51
+		/**
52
+		 *    The base class name is settable here. This is the
53
+		 *    class that a new stub will inherited from.
54
+		 *    To modify the generated stubs simply extend the
55
+		 *    SimpleStub class and set it's name
56
+		 *    with this method before any stubs are generated.
57
+		 *    @param string $stub_base     Server stub class to use.
58
+		 *    @static
59
+		 *    @access public
60
+		 */
61
+		static function setStubBaseClass($stub_base) {
62
+			$registry =SimpleTestOptions::_getRegistry();
63
+			$registry['StubBaseClass'] = $stub_base;
64
+		}
65 65
 
66
-        /**
67
-         *    Accessor for the currently set stub base class.
68
-         *    @return string        Class name to inherit from.
69
-         *    @static
70
-         *    @access public
71
-         */
72
-        static function getStubBaseClass() {
73
-            $registry =SimpleTestOptions::_getRegistry();
74
-            return $registry['StubBaseClass'];
75
-        }
66
+		/**
67
+		 *    Accessor for the currently set stub base class.
68
+		 *    @return string        Class name to inherit from.
69
+		 *    @static
70
+		 *    @access public
71
+		 */
72
+		static function getStubBaseClass() {
73
+			$registry =SimpleTestOptions::_getRegistry();
74
+			return $registry['StubBaseClass'];
75
+		}
76 76
 
77
-        /**
78
-         *    The base class name is settable here. This is the
79
-         *    class that a new mock will inherited from.
80
-         *    To modify the generated mocks simply extend the
81
-         *    SimpleMock class and set it's name
82
-         *    with this method before any mocks are generated.
83
-         *    @param string $mock_base        Mock base class to use.
84
-         *    @static
85
-         *    @access public
86
-         */
87
-        static function setMockBaseClass($mock_base) {
88
-            $registry =SimpleTestOptions::_getRegistry();
89
-            $registry['MockBaseClass'] = $mock_base;
90
-        }
77
+		/**
78
+		 *    The base class name is settable here. This is the
79
+		 *    class that a new mock will inherited from.
80
+		 *    To modify the generated mocks simply extend the
81
+		 *    SimpleMock class and set it's name
82
+		 *    with this method before any mocks are generated.
83
+		 *    @param string $mock_base        Mock base class to use.
84
+		 *    @static
85
+		 *    @access public
86
+		 */
87
+		static function setMockBaseClass($mock_base) {
88
+			$registry =SimpleTestOptions::_getRegistry();
89
+			$registry['MockBaseClass'] = $mock_base;
90
+		}
91 91
 
92
-        /**
93
-         *    Accessor for the currently set mock base class.
94
-         *    @return string           Class name to inherit from.
95
-         *    @static
96
-         *    @access public
97
-         */
98
-        static function getMockBaseClass() {
99
-            $registry =SimpleTestOptions::_getRegistry();
100
-            return $registry['MockBaseClass'];
101
-        }
92
+		/**
93
+		 *    Accessor for the currently set mock base class.
94
+		 *    @return string           Class name to inherit from.
95
+		 *    @static
96
+		 *    @access public
97
+		 */
98
+		static function getMockBaseClass() {
99
+			$registry =SimpleTestOptions::_getRegistry();
100
+			return $registry['MockBaseClass'];
101
+		}
102 102
 
103
-        /**
104
-         *    Adds additional mock code.
105
-         *    @param string $code    Extra code that can be added
106
-         *                           to the partial mocks for
107
-         *                           extra functionality. Useful
108
-         *                           when a test tool has overridden
109
-         *                           the mock base classes.
110
-         *    @access public
111
-         */
112
-        static function addPartialMockCode($code = '') {
113
-            $registry =SimpleTestOptions::_getRegistry();
114
-            $registry['AdditionalPartialMockCode'] = $code;
115
-        }
103
+		/**
104
+		 *    Adds additional mock code.
105
+		 *    @param string $code    Extra code that can be added
106
+		 *                           to the partial mocks for
107
+		 *                           extra functionality. Useful
108
+		 *                           when a test tool has overridden
109
+		 *                           the mock base classes.
110
+		 *    @access public
111
+		 */
112
+		static function addPartialMockCode($code = '') {
113
+			$registry =SimpleTestOptions::_getRegistry();
114
+			$registry['AdditionalPartialMockCode'] = $code;
115
+		}
116 116
 
117
-        /**
118
-         *    Accessor for additional partial mock code.
119
-         *    @return string       Extra code.
120
-         *    @access public
121
-         */
122
-        function getPartialMockCode() {
123
-            $registry =SimpleTestOptions::_getRegistry();
124
-            return $registry['AdditionalPartialMockCode'];
125
-        }
117
+		/**
118
+		 *    Accessor for additional partial mock code.
119
+		 *    @return string       Extra code.
120
+		 *    @access public
121
+		 */
122
+		function getPartialMockCode() {
123
+			$registry =SimpleTestOptions::_getRegistry();
124
+			return $registry['AdditionalPartialMockCode'];
125
+		}
126 126
 
127
-        /**
128
-         *    Sets proxy to use on all requests for when
129
-         *    testing from behind a firewall. Set host
130
-         *    to false to disable. This will take effect
131
-         *    if there are no other proxy settings.
132
-         *    @param string $proxy     Proxy host as URL.
133
-         *    @param string $username  Proxy username for authentication.
134
-         *    @param string $password  Proxy password for authentication.
135
-         *    @access public
136
-         */
137
-        static function useProxy($proxy, $username = false, $password = false) {
138
-            $registry =SimpleTestOptions::_getRegistry();
139
-            $registry['DefaultProxy'] = $proxy;
140
-            $registry['DefaultProxyUsername'] = $username;
141
-            $registry['DefaultProxyPassword'] = $password;
142
-        }
127
+		/**
128
+		 *    Sets proxy to use on all requests for when
129
+		 *    testing from behind a firewall. Set host
130
+		 *    to false to disable. This will take effect
131
+		 *    if there are no other proxy settings.
132
+		 *    @param string $proxy     Proxy host as URL.
133
+		 *    @param string $username  Proxy username for authentication.
134
+		 *    @param string $password  Proxy password for authentication.
135
+		 *    @access public
136
+		 */
137
+		static function useProxy($proxy, $username = false, $password = false) {
138
+			$registry =SimpleTestOptions::_getRegistry();
139
+			$registry['DefaultProxy'] = $proxy;
140
+			$registry['DefaultProxyUsername'] = $username;
141
+			$registry['DefaultProxyPassword'] = $password;
142
+		}
143 143
 
144
-        /**
145
-         *    Accessor for default proxy host.
146
-         *    @return string       Proxy URL.
147
-         *    @access public
148
-         */
149
-        function getDefaultProxy() {
150
-            $registry =SimpleTestOptions::_getRegistry();
151
-            return $registry['DefaultProxy'];
152
-        }
144
+		/**
145
+		 *    Accessor for default proxy host.
146
+		 *    @return string       Proxy URL.
147
+		 *    @access public
148
+		 */
149
+		function getDefaultProxy() {
150
+			$registry =SimpleTestOptions::_getRegistry();
151
+			return $registry['DefaultProxy'];
152
+		}
153 153
 
154
-        /**
155
-         *    Accessor for default proxy username.
156
-         *    @return string    Proxy username for authentication.
157
-         *    @access public
158
-         */
159
-        function getDefaultProxyUsername() {
160
-            $registry =SimpleTestOptions::_getRegistry();
161
-            return $registry['DefaultProxyUsername'];
162
-        }
154
+		/**
155
+		 *    Accessor for default proxy username.
156
+		 *    @return string    Proxy username for authentication.
157
+		 *    @access public
158
+		 */
159
+		function getDefaultProxyUsername() {
160
+			$registry =SimpleTestOptions::_getRegistry();
161
+			return $registry['DefaultProxyUsername'];
162
+		}
163 163
 
164
-        /**
165
-         *    Accessor for default proxy password.
166
-         *    @return string    Proxy password for authentication.
167
-         *    @access public
168
-         */
169
-        function getDefaultProxyPassword() {
170
-            $registry =SimpleTestOptions::_getRegistry();
171
-            return $registry['DefaultProxyPassword'];
172
-        }
164
+		/**
165
+		 *    Accessor for default proxy password.
166
+		 *    @return string    Proxy password for authentication.
167
+		 *    @access public
168
+		 */
169
+		function getDefaultProxyPassword() {
170
+			$registry =SimpleTestOptions::_getRegistry();
171
+			return $registry['DefaultProxyPassword'];
172
+		}
173 173
 
174
-        /**
175
-         *    Accessor for global registry of options.
176
-         *    @return hash           All stored values.
177
-         *    @access private
178
-         *    @static
179
-         */
180
-        static function _getRegistry() {
181
-            static $registry = false;
182
-            if (! $registry) {
183
-                $registry = SimpleTestOptions::_getDefaults();
184
-            }
185
-            return $registry;
186
-        }
174
+		/**
175
+		 *    Accessor for global registry of options.
176
+		 *    @return hash           All stored values.
177
+		 *    @access private
178
+		 *    @static
179
+		 */
180
+		static function _getRegistry() {
181
+			static $registry = false;
182
+			if (! $registry) {
183
+				$registry = SimpleTestOptions::_getDefaults();
184
+			}
185
+			return $registry;
186
+		}
187 187
 
188
-        /**
189
-         *    Constant default values.
190
-         *    @return hash       All registry defaults.
191
-         *    @access private
192
-         *    @static
193
-         */
194
-        static function _getDefaults() {
195
-            return array(
196
-                    'StubBaseClass' => 'SimpleStub',
197
-                    'MockBaseClass' => 'SimpleMock',
198
-                    'IgnoreList' => array(),
199
-                    'AdditionalPartialMockCode' => '',
200
-                    'DefaultProxy' => false,
201
-                    'DefaultProxyUsername' => false,
202
-                    'DefaultProxyPassword' => false);
203
-        }
204
-    }
188
+		/**
189
+		 *    Constant default values.
190
+		 *    @return hash       All registry defaults.
191
+		 *    @access private
192
+		 *    @static
193
+		 */
194
+		static function _getDefaults() {
195
+			return array(
196
+					'StubBaseClass' => 'SimpleStub',
197
+					'MockBaseClass' => 'SimpleMock',
198
+					'IgnoreList' => array(),
199
+					'AdditionalPartialMockCode' => '',
200
+					'DefaultProxy' => false,
201
+					'DefaultProxyUsername' => false,
202
+					'DefaultProxyPassword' => false);
203
+		}
204
+	}
205 205
 
206
-    /**
207
-     *  Static methods for compatibility between different
208
-     *  PHP versions.
209
-     *  @package	SimpleTest
210
-     */
211
-    class SimpleTestCompatibility {
206
+	/**
207
+	 *  Static methods for compatibility between different
208
+	 *  PHP versions.
209
+	 *  @package	SimpleTest
210
+	 */
211
+	class SimpleTestCompatibility {
212 212
 
213
-        /**
214
-         *    Identity test. Drops back to equality + types for PHP5
215
-         *    objects as the === operator counts as the
216
-         *    stronger reference constraint.
217
-         *    @param mixed $first    Test subject.
218
-         *    @param mixed $second   Comparison object.
219
-         *    @access public
220
-         *    @static
221
-         */
222
-        static function isIdentical($first, $second) {
223
-            if ($first != $second) {
224
-                return false;
225
-            }
226
-            if (version_compare(phpversion(), '5') >= 0) {
227
-                return SimpleTestCompatibility::_isIdenticalType($first, $second);
228
-            }
229
-            return ($first === $second);
230
-        }
213
+		/**
214
+		 *    Identity test. Drops back to equality + types for PHP5
215
+		 *    objects as the === operator counts as the
216
+		 *    stronger reference constraint.
217
+		 *    @param mixed $first    Test subject.
218
+		 *    @param mixed $second   Comparison object.
219
+		 *    @access public
220
+		 *    @static
221
+		 */
222
+		static function isIdentical($first, $second) {
223
+			if ($first != $second) {
224
+				return false;
225
+			}
226
+			if (version_compare(phpversion(), '5') >= 0) {
227
+				return SimpleTestCompatibility::_isIdenticalType($first, $second);
228
+			}
229
+			return ($first === $second);
230
+		}
231 231
 
232
-        /**
233
-         *    Recursive type test.
234
-         *    @param mixed $first    Test subject.
235
-         *    @param mixed $second   Comparison object.
236
-         *    @access private
237
-         *    @static
238
-         */
239
-        static function _isIdenticalType($first, $second) {
240
-            if (gettype($first) != gettype($second)) {
241
-                return false;
242
-            }
243
-            if (is_object($first) && is_object($second)) {
244
-                if (get_class($first) != get_class($second)) {
245
-                    return false;
246
-                }
247
-                return SimpleTestCompatibility::_isArrayOfIdenticalTypes(
248
-                        get_object_vars($first),
249
-                        get_object_vars($second));
250
-            }
251
-            if (is_array($first) && is_array($second)) {
252
-                return SimpleTestCompatibility::_isArrayOfIdenticalTypes($first, $second);
253
-            }
254
-            return true;
255
-        }
232
+		/**
233
+		 *    Recursive type test.
234
+		 *    @param mixed $first    Test subject.
235
+		 *    @param mixed $second   Comparison object.
236
+		 *    @access private
237
+		 *    @static
238
+		 */
239
+		static function _isIdenticalType($first, $second) {
240
+			if (gettype($first) != gettype($second)) {
241
+				return false;
242
+			}
243
+			if (is_object($first) && is_object($second)) {
244
+				if (get_class($first) != get_class($second)) {
245
+					return false;
246
+				}
247
+				return SimpleTestCompatibility::_isArrayOfIdenticalTypes(
248
+						get_object_vars($first),
249
+						get_object_vars($second));
250
+			}
251
+			if (is_array($first) && is_array($second)) {
252
+				return SimpleTestCompatibility::_isArrayOfIdenticalTypes($first, $second);
253
+			}
254
+			return true;
255
+		}
256 256
 
257
-        /**
258
-         *    Recursive type test for each element of an array.
259
-         *    @param mixed $first    Test subject.
260
-         *    @param mixed $second   Comparison object.
261
-         *    @access private
262
-         *    @static
263
-         */
264
-        static function _isArrayOfIdenticalTypes($first, $second) {
265
-            if (array_keys($first) != array_keys($second)) {
266
-                return false;
267
-            }
268
-            foreach (array_keys($first) as $key) {
269
-                $is_identical = SimpleTestCompatibility::_isIdenticalType(
270
-                        $first[$key],
271
-                        $second[$key]);
272
-                if (! $is_identical) {
273
-                    return false;
274
-                }
275
-            }
276
-            return true;
277
-        }
257
+		/**
258
+		 *    Recursive type test for each element of an array.
259
+		 *    @param mixed $first    Test subject.
260
+		 *    @param mixed $second   Comparison object.
261
+		 *    @access private
262
+		 *    @static
263
+		 */
264
+		static function _isArrayOfIdenticalTypes($first, $second) {
265
+			if (array_keys($first) != array_keys($second)) {
266
+				return false;
267
+			}
268
+			foreach (array_keys($first) as $key) {
269
+				$is_identical = SimpleTestCompatibility::_isIdenticalType(
270
+						$first[$key],
271
+						$second[$key]);
272
+				if (! $is_identical) {
273
+					return false;
274
+				}
275
+			}
276
+			return true;
277
+		}
278 278
 
279
-        /**
280
-         *    Test for two variables being aliases.
281
-         *    @param mixed $first    Test subject.
282
-         *    @param mixed $second   Comparison object.
283
-         *    @access public
284
-         *    @static
285
-         */
286
-        static function isReference($first, $second) {
287
-            if (version_compare(phpversion(), '5', '>=')
288
-	    	    && is_object($first)) {
289
-	    	    return ($first === $second);
290
-	        }
291
-	        $temp = $first;
292
-            $first = uniqid("test");
293
-            $is_ref = ($first === $second);
294
-            $first = $temp;
295
-            return $is_ref;
296
-        }
279
+		/**
280
+		 *    Test for two variables being aliases.
281
+		 *    @param mixed $first    Test subject.
282
+		 *    @param mixed $second   Comparison object.
283
+		 *    @access public
284
+		 *    @static
285
+		 */
286
+		static function isReference($first, $second) {
287
+			if (version_compare(phpversion(), '5', '>=')
288
+				&& is_object($first)) {
289
+				return ($first === $second);
290
+			}
291
+			$temp = $first;
292
+			$first = uniqid("test");
293
+			$is_ref = ($first === $second);
294
+			$first = $temp;
295
+			return $is_ref;
296
+		}
297 297
 
298
-        /**
299
-         *    Test to see if an object is a member of a
300
-         *    class hiearchy.
301
-         *    @param object $object    Object to test.
302
-         *    @param string $class     Root name of hiearchy.
303
-         *    @access public
304
-         *    @static
305
-         */
306
-        static function isA($object, $class) {
307
-            if (version_compare(phpversion(), '5') >= 0) {
308
-                if (! class_exists($class, false)) {
309
-                    return false;
310
-                }
311
-                eval("\$is_a = \$object instanceof $class;");
312
-                return $is_a;
313
-            }
314
-            if (function_exists('is_a')) {
315
-                return is_a($object, $class);
316
-            }
317
-            return ((strtolower($class) == get_class($object))
318
-                    or (is_subclass_of($object, $class)));
319
-        }
298
+		/**
299
+		 *    Test to see if an object is a member of a
300
+		 *    class hiearchy.
301
+		 *    @param object $object    Object to test.
302
+		 *    @param string $class     Root name of hiearchy.
303
+		 *    @access public
304
+		 *    @static
305
+		 */
306
+		static function isA($object, $class) {
307
+			if (version_compare(phpversion(), '5') >= 0) {
308
+				if (! class_exists($class, false)) {
309
+					return false;
310
+				}
311
+				eval("\$is_a = \$object instanceof $class;");
312
+				return $is_a;
313
+			}
314
+			if (function_exists('is_a')) {
315
+				return is_a($object, $class);
316
+			}
317
+			return ((strtolower($class) == get_class($object))
318
+					or (is_subclass_of($object, $class)));
319
+		}
320 320
 
321
-        /**
322
-         *    Autoload safe version of class_exists().
323
-         *    @param string $class        Name of class to look for.
324
-         *    @return boolean             True if class is defined.
325
-         *    @access public
326
-         *    @static
327
-         */
328
-        static function classExists($class) {
329
-            if (version_compare(phpversion(), '5') >= 0) {
330
-                return class_exists($class, false);
331
-            } else {
332
-                return class_exists($class);
333
-            }
334
-        }
321
+		/**
322
+		 *    Autoload safe version of class_exists().
323
+		 *    @param string $class        Name of class to look for.
324
+		 *    @return boolean             True if class is defined.
325
+		 *    @access public
326
+		 *    @static
327
+		 */
328
+		static function classExists($class) {
329
+			if (version_compare(phpversion(), '5') >= 0) {
330
+				return class_exists($class, false);
331
+			} else {
332
+				return class_exists($class);
333
+			}
334
+		}
335 335
 
336
-        /**
337
-         *    Sets a socket timeout for each chunk.
338
-         *    @param resource $handle    Socket handle.
339
-         *    @param integer $timeout    Limit in seconds.
340
-         *    @access public
341
-         *    @static
342
-         */
343
-        static function setTimeout($handle, $timeout) {
344
-            if (function_exists('stream_set_timeout')) {
345
-                stream_set_timeout($handle, $timeout, 0);
346
-            } elseif (function_exists('socket_set_timeout')) {
347
-                socket_set_timeout($handle, $timeout, 0);
348
-            } elseif (function_exists('set_socket_timeout')) {
349
-                set_socket_timeout($handle, $timeout, 0);
350
-            }
351
-        }
336
+		/**
337
+		 *    Sets a socket timeout for each chunk.
338
+		 *    @param resource $handle    Socket handle.
339
+		 *    @param integer $timeout    Limit in seconds.
340
+		 *    @access public
341
+		 *    @static
342
+		 */
343
+		static function setTimeout($handle, $timeout) {
344
+			if (function_exists('stream_set_timeout')) {
345
+				stream_set_timeout($handle, $timeout, 0);
346
+			} elseif (function_exists('socket_set_timeout')) {
347
+				socket_set_timeout($handle, $timeout, 0);
348
+			} elseif (function_exists('set_socket_timeout')) {
349
+				set_socket_timeout($handle, $timeout, 0);
350
+			}
351
+		}
352 352
 
353
-        /**
354
-         *    Gets the current stack trace topmost first.
355
-         *    @return array        List of stack frames.
356
-         *    @access public
357
-         *    @static
358
-         */
359
-        static function getStackTrace() {
360
-            if (function_exists('debug_backtrace')) {
361
-                return array_reverse(debug_backtrace());
362
-            }
363
-            return array();
364
-        }
365
-    }
353
+		/**
354
+		 *    Gets the current stack trace topmost first.
355
+		 *    @return array        List of stack frames.
356
+		 *    @access public
357
+		 *    @static
358
+		 */
359
+		static function getStackTrace() {
360
+			if (function_exists('debug_backtrace')) {
361
+				return array_reverse(debug_backtrace());
362
+			}
363
+			return array();
364
+		}
365
+	}
Please login to merge, or discard this patch.
tests/test_tools/simpletest/reflection_php4.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -1,114 +1,114 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	base include file for SimpleTest
4
-     *	@package	SimpleTest
5
-     *	@subpackage	UnitTester
6
-     *	@version	$Id: reflection_php4.php 1398 2006-09-08 19:31:03Z xue $
7
-     */
2
+	/**
3
+	 *	base include file for SimpleTest
4
+	 *	@package	SimpleTest
5
+	 *	@subpackage	UnitTester
6
+	 *	@version	$Id: reflection_php4.php 1398 2006-09-08 19:31:03Z xue $
7
+	 */
8 8
 
9
-    /**
10
-     *    Version specific reflection API.
9
+	/**
10
+	 *    Version specific reflection API.
11 11
 	 *	  @package SimpleTest
12 12
 	 *	  @subpackage UnitTester
13
-     */
14
-    class SimpleReflection {
15
-        protected $_interface;
13
+	 */
14
+	class SimpleReflection {
15
+		protected $_interface;
16 16
 
17
-        /**
18
-         *    Stashes the class/interface.
19
-         *    @param string $interface    Class or interface
20
-         *                                to inspect.
21
-         */
22
-        function SimpleReflection($interface) {
23
-            $this->_interface = $interface;
24
-        }
17
+		/**
18
+		 *    Stashes the class/interface.
19
+		 *    @param string $interface    Class or interface
20
+		 *                                to inspect.
21
+		 */
22
+		function SimpleReflection($interface) {
23
+			$this->_interface = $interface;
24
+		}
25 25
 
26
-        /**
27
-         *    Checks that a class has been declared.
28
-         *    @return boolean        True if defined.
29
-         *    @access public
30
-         */
31
-        function classExists() {
32
-            return class_exists($this->_interface);
33
-        }
26
+		/**
27
+		 *    Checks that a class has been declared.
28
+		 *    @return boolean        True if defined.
29
+		 *    @access public
30
+		 */
31
+		function classExists() {
32
+			return class_exists($this->_interface);
33
+		}
34 34
 
35
-        /**
36
-         *    Needed to kill the autoload feature in PHP5
37
-         *    for classes created dynamically.
38
-         *    @return boolean        True if defined.
39
-         *    @access public
40
-         */
41
-        function classExistsSansAutoload() {
42
-            return class_exists($this->_interface);
43
-        }
35
+		/**
36
+		 *    Needed to kill the autoload feature in PHP5
37
+		 *    for classes created dynamically.
38
+		 *    @return boolean        True if defined.
39
+		 *    @access public
40
+		 */
41
+		function classExistsSansAutoload() {
42
+			return class_exists($this->_interface);
43
+		}
44 44
 
45
-        /**
46
-         *    Checks that a class or interface has been
47
-         *    declared.
48
-         *    @return boolean        True if defined.
49
-         *    @access public
50
-         */
51
-        function classOrInterfaceExists() {
52
-            return class_exists($this->_interface);
53
-        }
45
+		/**
46
+		 *    Checks that a class or interface has been
47
+		 *    declared.
48
+		 *    @return boolean        True if defined.
49
+		 *    @access public
50
+		 */
51
+		function classOrInterfaceExists() {
52
+			return class_exists($this->_interface);
53
+		}
54 54
 
55
-        /**
56
-         *    Needed to kill the autoload feature in PHP5
57
-         *    for classes created dynamically.
58
-         *    @return boolean        True if defined.
59
-         *    @access public
60
-         */
61
-        function classOrInterfaceExistsSansAutoload() {
62
-            return class_exists($this->_interface);
63
-        }
55
+		/**
56
+		 *    Needed to kill the autoload feature in PHP5
57
+		 *    for classes created dynamically.
58
+		 *    @return boolean        True if defined.
59
+		 *    @access public
60
+		 */
61
+		function classOrInterfaceExistsSansAutoload() {
62
+			return class_exists($this->_interface);
63
+		}
64 64
 
65
-        /**
66
-         *    Gets the list of methods on a class or
67
-         *    interface.
68
-         *    @returns array          List of method names.
69
-         *    @access public
70
-         */
71
-        function getMethods() {
72
-            return get_class_methods($this->_interface);
73
-        }
65
+		/**
66
+		 *    Gets the list of methods on a class or
67
+		 *    interface.
68
+		 *    @returns array          List of method names.
69
+		 *    @access public
70
+		 */
71
+		function getMethods() {
72
+			return get_class_methods($this->_interface);
73
+		}
74 74
 
75
-        /**
76
-         *    Gets the list of interfaces from a class. If the
77
-         *	  class name is actually an interface then just that
78
-         *	  interface is returned.
79
-         *    @returns array          List of interfaces.
80
-         *    @access public
81
-         */
82
-        function getInterfaces() {
83
-            return array();
84
-        }
75
+		/**
76
+		 *    Gets the list of interfaces from a class. If the
77
+		 *	  class name is actually an interface then just that
78
+		 *	  interface is returned.
79
+		 *    @returns array          List of interfaces.
80
+		 *    @access public
81
+		 */
82
+		function getInterfaces() {
83
+			return array();
84
+		}
85 85
 
86
-        /**
87
-         *    Finds the parent class name.
88
-         *    @returns string      Parent class name.
89
-         *    @access public
90
-         */
91
-        function getParent() {
92
-            return strtolower(get_parent_class($this->_interface));
93
-        }
86
+		/**
87
+		 *    Finds the parent class name.
88
+		 *    @returns string      Parent class name.
89
+		 *    @access public
90
+		 */
91
+		function getParent() {
92
+			return strtolower(get_parent_class($this->_interface));
93
+		}
94 94
 
95
-        /**
96
-         *    Determines if the class is abstract, which for PHP 4
97
-         *    will never be the case.
98
-         *    @returns boolean      True if abstract.
99
-         *    @access public
100
-         */
101
-        function isAbstract() {
102
-            return false;
103
-        }
95
+		/**
96
+		 *    Determines if the class is abstract, which for PHP 4
97
+		 *    will never be the case.
98
+		 *    @returns boolean      True if abstract.
99
+		 *    @access public
100
+		 */
101
+		function isAbstract() {
102
+			return false;
103
+		}
104 104
 
105
-        /**
106
-         *	  Gets the source code matching the declaration
107
-         *	  of a method.
108
-         * 	  @param string $method		  Method name.
109
-         *    @access public
110
-         */
111
-        function getSignature($method) {
112
-        	return "function $method()";
113
-        }
114
-    }
115 105
\ No newline at end of file
106
+		/**
107
+		 *	  Gets the source code matching the declaration
108
+		 *	  of a method.
109
+		 * 	  @param string $method		  Method name.
110
+		 *    @access public
111
+		 */
112
+		function getSignature($method) {
113
+			return "function $method()";
114
+		}
115
+	}
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test_tools/simpletest/parser.php 1 patch
Indentation   +757 added lines, -757 removed lines patch added patch discarded remove patch
@@ -1,772 +1,772 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	base include file for SimpleTest
4
-     *	@package	SimpleTest
5
-     *	@subpackage	MockObjects
6
-     *	@version	$Id: parser.php 1532 2006-12-01 12:28:55Z xue $
7
-     */
8
-
9
-    /**#@+
2
+	/**
3
+	 *	base include file for SimpleTest
4
+	 *	@package	SimpleTest
5
+	 *	@subpackage	MockObjects
6
+	 *	@version	$Id: parser.php 1532 2006-12-01 12:28:55Z xue $
7
+	 */
8
+
9
+	/**#@+
10 10
      * Lexer mode stack constants
11 11
      */
12
-    if (! defined('LEXER_ENTER')) {
13
-        define('LEXER_ENTER', 1);
14
-    }
15
-    if (! defined('LEXER_MATCHED')) {
16
-        define('LEXER_MATCHED', 2);
17
-    }
18
-    if (! defined('LEXER_UNMATCHED')) {
19
-        define('LEXER_UNMATCHED', 3);
20
-    }
21
-    if (! defined('LEXER_EXIT')) {
22
-        define('LEXER_EXIT', 4);
23
-    }
24
-    if (! defined('LEXER_SPECIAL')) {
25
-        define('LEXER_SPECIAL', 5);
26
-    }
27
-    /**#@-*/
28
-
29
-    /**
30
-     *    Compounded regular expression. Any of
31
-     *    the contained patterns could match and
32
-     *    when one does, it's label is returned.
12
+	if (! defined('LEXER_ENTER')) {
13
+		define('LEXER_ENTER', 1);
14
+	}
15
+	if (! defined('LEXER_MATCHED')) {
16
+		define('LEXER_MATCHED', 2);
17
+	}
18
+	if (! defined('LEXER_UNMATCHED')) {
19
+		define('LEXER_UNMATCHED', 3);
20
+	}
21
+	if (! defined('LEXER_EXIT')) {
22
+		define('LEXER_EXIT', 4);
23
+	}
24
+	if (! defined('LEXER_SPECIAL')) {
25
+		define('LEXER_SPECIAL', 5);
26
+	}
27
+	/**#@-*/
28
+
29
+	/**
30
+	 *    Compounded regular expression. Any of
31
+	 *    the contained patterns could match and
32
+	 *    when one does, it's label is returned.
33 33
 	 *    @package SimpleTest
34 34
 	 *    @subpackage WebTester
35
-     */
36
-    class ParallelRegex {
37
-        protected $_patterns;
38
-        protected $_labels;
39
-        protected $_regex;
40
-        protected $_case;
41
-
42
-        /**
43
-         *    Constructor. Starts with no patterns.
44
-         *    @param boolean $case    True for case sensitive, false
45
-         *                            for insensitive.
46
-         *    @access public
47
-         */
48
-        function ParallelRegex($case) {
49
-            $this->_case = $case;
50
-            $this->_patterns = array();
51
-            $this->_labels = array();
52
-            $this->_regex = null;
53
-        }
54
-
55
-        /**
56
-         *    Adds a pattern with an optional label.
57
-         *    @param string $pattern      Perl style regex, but ( and )
58
-         *                                lose the usual meaning.
59
-         *    @param string $label        Label of regex to be returned
60
-         *                                on a match.
61
-         *    @access public
62
-         */
63
-        function addPattern($pattern, $label = true) {
64
-            $count = count($this->_patterns);
65
-            $this->_patterns[$count] = $pattern;
66
-            $this->_labels[$count] = $label;
67
-            $this->_regex = null;
68
-        }
69
-
70
-        /**
71
-         *    Attempts to match all patterns at once against
72
-         *    a string.
73
-         *    @param string $subject      String to match against.
74
-         *    @param string $match        First matched portion of
75
-         *                                subject.
76
-         *    @return boolean             True on success.
77
-         *    @access public
78
-         */
79
-        function match($subject, $match) {
80
-            if (count($this->_patterns) == 0) {
81
-                return false;
82
-            }
83
-            if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) {
84
-                $match = '';
85
-                return false;
86
-            }
87
-            $match = $matches[0];
88
-            for ($i = 1; $i < count($matches); $i++) {
89
-                if ($matches[$i]) {
90
-                    return $this->_labels[$i - 1];
91
-                }
92
-            }
93
-            return true;
94
-        }
95
-
96
-        /**
97
-         *    Compounds the patterns into a single
98
-         *    regular expression separated with the
99
-         *    "or" operator. Caches the regex.
100
-         *    Will automatically escape (, ) and / tokens.
101
-         *    @param array $patterns    List of patterns in order.
102
-         *    @access private
103
-         */
104
-        function _getCompoundedRegex() {
105
-            if ($this->_regex == null) {
106
-                for ($i = 0, $count = count($this->_patterns); $i < $count; $i++) {
107
-                    $this->_patterns[$i] = '(' . str_replace(
108
-                            array('/', '(', ')'),
109
-                            array('\/', '\(', '\)'),
110
-                            $this->_patterns[$i]) . ')';
111
-                }
112
-                $this->_regex = "/" . implode("|", $this->_patterns) . "/" . $this->_getPerlMatchingFlags();
113
-            }
114
-            return $this->_regex;
115
-        }
116
-
117
-        /**
118
-         *    Accessor for perl regex mode flags to use.
119
-         *    @return string       Perl regex flags.
120
-         *    @access private
121
-         */
122
-        function _getPerlMatchingFlags() {
123
-            return ($this->_case ? "msS" : "msSi");
124
-        }
125
-    }
126
-
127
-    /**
128
-     *    States for a stack machine.
35
+	 */
36
+	class ParallelRegex {
37
+		protected $_patterns;
38
+		protected $_labels;
39
+		protected $_regex;
40
+		protected $_case;
41
+
42
+		/**
43
+		 *    Constructor. Starts with no patterns.
44
+		 *    @param boolean $case    True for case sensitive, false
45
+		 *                            for insensitive.
46
+		 *    @access public
47
+		 */
48
+		function ParallelRegex($case) {
49
+			$this->_case = $case;
50
+			$this->_patterns = array();
51
+			$this->_labels = array();
52
+			$this->_regex = null;
53
+		}
54
+
55
+		/**
56
+		 *    Adds a pattern with an optional label.
57
+		 *    @param string $pattern      Perl style regex, but ( and )
58
+		 *                                lose the usual meaning.
59
+		 *    @param string $label        Label of regex to be returned
60
+		 *                                on a match.
61
+		 *    @access public
62
+		 */
63
+		function addPattern($pattern, $label = true) {
64
+			$count = count($this->_patterns);
65
+			$this->_patterns[$count] = $pattern;
66
+			$this->_labels[$count] = $label;
67
+			$this->_regex = null;
68
+		}
69
+
70
+		/**
71
+		 *    Attempts to match all patterns at once against
72
+		 *    a string.
73
+		 *    @param string $subject      String to match against.
74
+		 *    @param string $match        First matched portion of
75
+		 *                                subject.
76
+		 *    @return boolean             True on success.
77
+		 *    @access public
78
+		 */
79
+		function match($subject, $match) {
80
+			if (count($this->_patterns) == 0) {
81
+				return false;
82
+			}
83
+			if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) {
84
+				$match = '';
85
+				return false;
86
+			}
87
+			$match = $matches[0];
88
+			for ($i = 1; $i < count($matches); $i++) {
89
+				if ($matches[$i]) {
90
+					return $this->_labels[$i - 1];
91
+				}
92
+			}
93
+			return true;
94
+		}
95
+
96
+		/**
97
+		 *    Compounds the patterns into a single
98
+		 *    regular expression separated with the
99
+		 *    "or" operator. Caches the regex.
100
+		 *    Will automatically escape (, ) and / tokens.
101
+		 *    @param array $patterns    List of patterns in order.
102
+		 *    @access private
103
+		 */
104
+		function _getCompoundedRegex() {
105
+			if ($this->_regex == null) {
106
+				for ($i = 0, $count = count($this->_patterns); $i < $count; $i++) {
107
+					$this->_patterns[$i] = '(' . str_replace(
108
+							array('/', '(', ')'),
109
+							array('\/', '\(', '\)'),
110
+							$this->_patterns[$i]) . ')';
111
+				}
112
+				$this->_regex = "/" . implode("|", $this->_patterns) . "/" . $this->_getPerlMatchingFlags();
113
+			}
114
+			return $this->_regex;
115
+		}
116
+
117
+		/**
118
+		 *    Accessor for perl regex mode flags to use.
119
+		 *    @return string       Perl regex flags.
120
+		 *    @access private
121
+		 */
122
+		function _getPerlMatchingFlags() {
123
+			return ($this->_case ? "msS" : "msSi");
124
+		}
125
+	}
126
+
127
+	/**
128
+	 *    States for a stack machine.
129 129
 	 *    @package SimpleTest
130 130
 	 *    @subpackage WebTester
131
-     */
132
-    class SimpleStateStack {
133
-        protected $_stack;
134
-
135
-        /**
136
-         *    Constructor. Starts in named state.
137
-         *    @param string $start        Starting state name.
138
-         *    @access public
139
-         */
140
-        function SimpleStateStack($start) {
141
-            $this->_stack = array($start);
142
-        }
143
-
144
-        /**
145
-         *    Accessor for current state.
146
-         *    @return string       State.
147
-         *    @access public
148
-         */
149
-        function getCurrent() {
150
-            return $this->_stack[count($this->_stack) - 1];
151
-        }
152
-
153
-        /**
154
-         *    Adds a state to the stack and sets it
155
-         *    to be the current state.
156
-         *    @param string $state        New state.
157
-         *    @access public
158
-         */
159
-        function enter($state) {
160
-            array_push($this->_stack, $state);
161
-        }
162
-
163
-        /**
164
-         *    Leaves the current state and reverts
165
-         *    to the previous one.
166
-         *    @return boolean    False if we drop off
167
-         *                       the bottom of the list.
168
-         *    @access public
169
-         */
170
-        function leave() {
171
-            if (count($this->_stack) == 1) {
172
-                return false;
173
-            }
174
-            array_pop($this->_stack);
175
-            return true;
176
-        }
177
-    }
178
-
179
-    /**
180
-     *    Accepts text and breaks it into tokens.
181
-     *    Some optimisation to make the sure the
182
-     *    content is only scanned by the PHP regex
183
-     *    parser once. Lexer modes must not start
184
-     *    with leading underscores.
131
+	 */
132
+	class SimpleStateStack {
133
+		protected $_stack;
134
+
135
+		/**
136
+		 *    Constructor. Starts in named state.
137
+		 *    @param string $start        Starting state name.
138
+		 *    @access public
139
+		 */
140
+		function SimpleStateStack($start) {
141
+			$this->_stack = array($start);
142
+		}
143
+
144
+		/**
145
+		 *    Accessor for current state.
146
+		 *    @return string       State.
147
+		 *    @access public
148
+		 */
149
+		function getCurrent() {
150
+			return $this->_stack[count($this->_stack) - 1];
151
+		}
152
+
153
+		/**
154
+		 *    Adds a state to the stack and sets it
155
+		 *    to be the current state.
156
+		 *    @param string $state        New state.
157
+		 *    @access public
158
+		 */
159
+		function enter($state) {
160
+			array_push($this->_stack, $state);
161
+		}
162
+
163
+		/**
164
+		 *    Leaves the current state and reverts
165
+		 *    to the previous one.
166
+		 *    @return boolean    False if we drop off
167
+		 *                       the bottom of the list.
168
+		 *    @access public
169
+		 */
170
+		function leave() {
171
+			if (count($this->_stack) == 1) {
172
+				return false;
173
+			}
174
+			array_pop($this->_stack);
175
+			return true;
176
+		}
177
+	}
178
+
179
+	/**
180
+	 *    Accepts text and breaks it into tokens.
181
+	 *    Some optimisation to make the sure the
182
+	 *    content is only scanned by the PHP regex
183
+	 *    parser once. Lexer modes must not start
184
+	 *    with leading underscores.
185 185
 	 *    @package SimpleTest
186 186
 	 *    @subpackage WebTester
187
-     */
188
-    class SimpleLexer {
189
-        protected $_regexes;
190
-        protected $_parser;
191
-        protected $_mode;
192
-        protected $_mode_handlers;
193
-        protected $_case;
194
-
195
-        /**
196
-         *    Sets up the lexer in case insensitive matching
197
-         *    by default.
198
-         *    @param SimpleSaxParser $parser  Handling strategy by
199
-         *                                    reference.
200
-         *    @param string $start            Starting handler.
201
-         *    @param boolean $case            True for case sensitive.
202
-         *    @access public
203
-         */
204
-        function SimpleLexer($parser, $start = "accept", $case = false) {
205
-            $this->_case = $case;
206
-            $this->_regexes = array();
207
-            $this->_parser = $parser;
208
-            $this->_mode = new SimpleStateStack($start);
209
-            $this->_mode_handlers = array($start => $start);
210
-        }
211
-
212
-        /**
213
-         *    Adds a token search pattern for a particular
214
-         *    parsing mode. The pattern does not change the
215
-         *    current mode.
216
-         *    @param string $pattern      Perl style regex, but ( and )
217
-         *                                lose the usual meaning.
218
-         *    @param string $mode         Should only apply this
219
-         *                                pattern when dealing with
220
-         *                                this type of input.
221
-         *    @access public
222
-         */
223
-        function addPattern($pattern, $mode = "accept") {
224
-            if (! isset($this->_regexes[$mode])) {
225
-                $this->_regexes[$mode] = new ParallelRegex($this->_case);
226
-            }
227
-            $this->_regexes[$mode]->addPattern($pattern);
228
-            if (! isset($this->_mode_handlers[$mode])) {
229
-                $this->_mode_handlers[$mode] = $mode;
230
-            }
231
-        }
232
-
233
-        /**
234
-         *    Adds a pattern that will enter a new parsing
235
-         *    mode. Useful for entering parenthesis, strings,
236
-         *    tags, etc.
237
-         *    @param string $pattern      Perl style regex, but ( and )
238
-         *                                lose the usual meaning.
239
-         *    @param string $mode         Should only apply this
240
-         *                                pattern when dealing with
241
-         *                                this type of input.
242
-         *    @param string $new_mode     Change parsing to this new
243
-         *                                nested mode.
244
-         *    @access public
245
-         */
246
-        function addEntryPattern($pattern, $mode, $new_mode) {
247
-            if (! isset($this->_regexes[$mode])) {
248
-                $this->_regexes[$mode] = new ParallelRegex($this->_case);
249
-            }
250
-            $this->_regexes[$mode]->addPattern($pattern, $new_mode);
251
-            if (! isset($this->_mode_handlers[$new_mode])) {
252
-                $this->_mode_handlers[$new_mode] = $new_mode;
253
-            }
254
-        }
255
-
256
-        /**
257
-         *    Adds a pattern that will exit the current mode
258
-         *    and re-enter the previous one.
259
-         *    @param string $pattern      Perl style regex, but ( and )
260
-         *                                lose the usual meaning.
261
-         *    @param string $mode         Mode to leave.
262
-         *    @access public
263
-         */
264
-        function addExitPattern($pattern, $mode) {
265
-            if (! isset($this->_regexes[$mode])) {
266
-                $this->_regexes[$mode] = new ParallelRegex($this->_case);
267
-            }
268
-            $this->_regexes[$mode]->addPattern($pattern, "__exit");
269
-            if (! isset($this->_mode_handlers[$mode])) {
270
-                $this->_mode_handlers[$mode] = $mode;
271
-            }
272
-        }
273
-
274
-        /**
275
-         *    Adds a pattern that has a special mode. Acts as an entry
276
-         *    and exit pattern in one go, effectively calling a special
277
-         *    parser handler for this token only.
278
-         *    @param string $pattern      Perl style regex, but ( and )
279
-         *                                lose the usual meaning.
280
-         *    @param string $mode         Should only apply this
281
-         *                                pattern when dealing with
282
-         *                                this type of input.
283
-         *    @param string $special      Use this mode for this one token.
284
-         *    @access public
285
-         */
286
-        function addSpecialPattern($pattern, $mode, $special) {
287
-            if (! isset($this->_regexes[$mode])) {
288
-                $this->_regexes[$mode] = new ParallelRegex($this->_case);
289
-            }
290
-            $this->_regexes[$mode]->addPattern($pattern, "_$special");
291
-            if (! isset($this->_mode_handlers[$special])) {
292
-                $this->_mode_handlers[$special] = $special;
293
-            }
294
-        }
295
-
296
-        /**
297
-         *    Adds a mapping from a mode to another handler.
298
-         *    @param string $mode        Mode to be remapped.
299
-         *    @param string $handler     New target handler.
300
-         *    @access public
301
-         */
302
-        function mapHandler($mode, $handler) {
303
-            $this->_mode_handlers[$mode] = $handler;
304
-        }
305
-
306
-        /**
307
-         *    Splits the page text into tokens. Will fail
308
-         *    if the handlers report an error or if no
309
-         *    content is consumed. If successful then each
310
-         *    unparsed and parsed token invokes a call to the
311
-         *    held listener.
312
-         *    @param string $raw        Raw HTML text.
313
-         *    @return boolean           True on success, else false.
314
-         *    @access public
315
-         */
316
-        function parse($raw) {
317
-            if (! isset($this->_parser)) {
318
-                return false;
319
-            }
320
-            $length = strlen($raw);
321
-            while (is_array($parsed = $this->_reduce($raw))) {
322
-                list($raw, $unmatched, $matched, $mode) = $parsed;
323
-                if (! $this->_dispatchTokens($unmatched, $matched, $mode)) {
324
-                    return false;
325
-                }
326
-                if ($raw === '') {
327
-                    return true;
328
-                }
329
-                if (strlen($raw) == $length) {
330
-                    return false;
331
-                }
332
-                $length = strlen($raw);
333
-            }
334
-            if (! $parsed) {
335
-                return false;
336
-            }
337
-            return $this->_invokeParser($raw, LEXER_UNMATCHED);
338
-        }
339
-
340
-        /**
341
-         *    Sends the matched token and any leading unmatched
342
-         *    text to the parser changing the lexer to a new
343
-         *    mode if one is listed.
344
-         *    @param string $unmatched    Unmatched leading portion.
345
-         *    @param string $matched      Actual token match.
346
-         *    @param string $mode         Mode after match. A boolean
347
-         *                                false mode causes no change.
348
-         *    @return boolean             False if there was any error
349
-         *                                from the parser.
350
-         *    @access private
351
-         */
352
-        function _dispatchTokens($unmatched, $matched, $mode = false) {
353
-            if (! $this->_invokeParser($unmatched, LEXER_UNMATCHED)) {
354
-                return false;
355
-            }
356
-            if (is_bool($mode)) {
357
-                return $this->_invokeParser($matched, LEXER_MATCHED);
358
-            }
359
-            if ($this->_isModeEnd($mode)) {
360
-                if (! $this->_invokeParser($matched, LEXER_EXIT)) {
361
-                    return false;
362
-                }
363
-                return $this->_mode->leave();
364
-            }
365
-            if ($this->_isSpecialMode($mode)) {
366
-                $this->_mode->enter($this->_decodeSpecial($mode));
367
-                if (! $this->_invokeParser($matched, LEXER_SPECIAL)) {
368
-                    return false;
369
-                }
370
-                return $this->_mode->leave();
371
-            }
372
-            $this->_mode->enter($mode);
373
-            return $this->_invokeParser($matched, LEXER_ENTER);
374
-        }
375
-
376
-        /**
377
-         *    Tests to see if the new mode is actually to leave
378
-         *    the current mode and pop an item from the matching
379
-         *    mode stack.
380
-         *    @param string $mode    Mode to test.
381
-         *    @return boolean        True if this is the exit mode.
382
-         *    @access private
383
-         */
384
-        function _isModeEnd($mode) {
385
-            return ($mode === "__exit");
386
-        }
387
-
388
-        /**
389
-         *    Test to see if the mode is one where this mode
390
-         *    is entered for this token only and automatically
391
-         *    leaves immediately afterwoods.
392
-         *    @param string $mode    Mode to test.
393
-         *    @return boolean        True if this is the exit mode.
394
-         *    @access private
395
-         */
396
-        function _isSpecialMode($mode) {
397
-            return (strncmp($mode, "_", 1) == 0);
398
-        }
399
-
400
-        /**
401
-         *    Strips the magic underscore marking single token
402
-         *    modes.
403
-         *    @param string $mode    Mode to decode.
404
-         *    @return string         Underlying mode name.
405
-         *    @access private
406
-         */
407
-        function _decodeSpecial($mode) {
408
-            return substr($mode, 1);
409
-        }
410
-
411
-        /**
412
-         *    Calls the parser method named after the current
413
-         *    mode. Empty content will be ignored. The lexer
414
-         *    has a parser handler for each mode in the lexer.
415
-         *    @param string $content        Text parsed.
416
-         *    @param boolean $is_match      Token is recognised rather
417
-         *                                  than unparsed data.
418
-         *    @access private
419
-         */
420
-        function _invokeParser($content, $is_match) {
421
-            if (($content === '') || ($content === false)) {
422
-                return true;
423
-            }
424
-            $handler = $this->_mode_handlers[$this->_mode->getCurrent()];
425
-            return $this->_parser->$handler($content, $is_match);
426
-        }
427
-
428
-        /**
429
-         *    Tries to match a chunk of text and if successful
430
-         *    removes the recognised chunk and any leading
431
-         *    unparsed data. Empty strings will not be matched.
432
-         *    @param string $raw         The subject to parse. This is the
433
-         *                               content that will be eaten.
434
-         *    @return array/boolean      Three item list of unparsed
435
-         *                               content followed by the
436
-         *                               recognised token and finally the
437
-         *                               action the parser is to take.
438
-         *                               True if no match, false if there
439
-         *                               is a parsing error.
440
-         *    @access private
441
-         */
442
-        function _reduce($raw) {
443
-            if ($action = $this->_regexes[$this->_mode->getCurrent()]->match($raw, $match)) {
444
-                $unparsed_character_count = strpos($raw, $match);
445
-                $unparsed = substr($raw, 0, $unparsed_character_count);
446
-                $raw = substr($raw, $unparsed_character_count + strlen($match));
447
-                return array($raw, $unparsed, $match, $action);
448
-            }
449
-            return true;
450
-        }
451
-    }
452
-
453
-    /**
454
-     *    Breas HTML into SAX events.
187
+	 */
188
+	class SimpleLexer {
189
+		protected $_regexes;
190
+		protected $_parser;
191
+		protected $_mode;
192
+		protected $_mode_handlers;
193
+		protected $_case;
194
+
195
+		/**
196
+		 *    Sets up the lexer in case insensitive matching
197
+		 *    by default.
198
+		 *    @param SimpleSaxParser $parser  Handling strategy by
199
+		 *                                    reference.
200
+		 *    @param string $start            Starting handler.
201
+		 *    @param boolean $case            True for case sensitive.
202
+		 *    @access public
203
+		 */
204
+		function SimpleLexer($parser, $start = "accept", $case = false) {
205
+			$this->_case = $case;
206
+			$this->_regexes = array();
207
+			$this->_parser = $parser;
208
+			$this->_mode = new SimpleStateStack($start);
209
+			$this->_mode_handlers = array($start => $start);
210
+		}
211
+
212
+		/**
213
+		 *    Adds a token search pattern for a particular
214
+		 *    parsing mode. The pattern does not change the
215
+		 *    current mode.
216
+		 *    @param string $pattern      Perl style regex, but ( and )
217
+		 *                                lose the usual meaning.
218
+		 *    @param string $mode         Should only apply this
219
+		 *                                pattern when dealing with
220
+		 *                                this type of input.
221
+		 *    @access public
222
+		 */
223
+		function addPattern($pattern, $mode = "accept") {
224
+			if (! isset($this->_regexes[$mode])) {
225
+				$this->_regexes[$mode] = new ParallelRegex($this->_case);
226
+			}
227
+			$this->_regexes[$mode]->addPattern($pattern);
228
+			if (! isset($this->_mode_handlers[$mode])) {
229
+				$this->_mode_handlers[$mode] = $mode;
230
+			}
231
+		}
232
+
233
+		/**
234
+		 *    Adds a pattern that will enter a new parsing
235
+		 *    mode. Useful for entering parenthesis, strings,
236
+		 *    tags, etc.
237
+		 *    @param string $pattern      Perl style regex, but ( and )
238
+		 *                                lose the usual meaning.
239
+		 *    @param string $mode         Should only apply this
240
+		 *                                pattern when dealing with
241
+		 *                                this type of input.
242
+		 *    @param string $new_mode     Change parsing to this new
243
+		 *                                nested mode.
244
+		 *    @access public
245
+		 */
246
+		function addEntryPattern($pattern, $mode, $new_mode) {
247
+			if (! isset($this->_regexes[$mode])) {
248
+				$this->_regexes[$mode] = new ParallelRegex($this->_case);
249
+			}
250
+			$this->_regexes[$mode]->addPattern($pattern, $new_mode);
251
+			if (! isset($this->_mode_handlers[$new_mode])) {
252
+				$this->_mode_handlers[$new_mode] = $new_mode;
253
+			}
254
+		}
255
+
256
+		/**
257
+		 *    Adds a pattern that will exit the current mode
258
+		 *    and re-enter the previous one.
259
+		 *    @param string $pattern      Perl style regex, but ( and )
260
+		 *                                lose the usual meaning.
261
+		 *    @param string $mode         Mode to leave.
262
+		 *    @access public
263
+		 */
264
+		function addExitPattern($pattern, $mode) {
265
+			if (! isset($this->_regexes[$mode])) {
266
+				$this->_regexes[$mode] = new ParallelRegex($this->_case);
267
+			}
268
+			$this->_regexes[$mode]->addPattern($pattern, "__exit");
269
+			if (! isset($this->_mode_handlers[$mode])) {
270
+				$this->_mode_handlers[$mode] = $mode;
271
+			}
272
+		}
273
+
274
+		/**
275
+		 *    Adds a pattern that has a special mode. Acts as an entry
276
+		 *    and exit pattern in one go, effectively calling a special
277
+		 *    parser handler for this token only.
278
+		 *    @param string $pattern      Perl style regex, but ( and )
279
+		 *                                lose the usual meaning.
280
+		 *    @param string $mode         Should only apply this
281
+		 *                                pattern when dealing with
282
+		 *                                this type of input.
283
+		 *    @param string $special      Use this mode for this one token.
284
+		 *    @access public
285
+		 */
286
+		function addSpecialPattern($pattern, $mode, $special) {
287
+			if (! isset($this->_regexes[$mode])) {
288
+				$this->_regexes[$mode] = new ParallelRegex($this->_case);
289
+			}
290
+			$this->_regexes[$mode]->addPattern($pattern, "_$special");
291
+			if (! isset($this->_mode_handlers[$special])) {
292
+				$this->_mode_handlers[$special] = $special;
293
+			}
294
+		}
295
+
296
+		/**
297
+		 *    Adds a mapping from a mode to another handler.
298
+		 *    @param string $mode        Mode to be remapped.
299
+		 *    @param string $handler     New target handler.
300
+		 *    @access public
301
+		 */
302
+		function mapHandler($mode, $handler) {
303
+			$this->_mode_handlers[$mode] = $handler;
304
+		}
305
+
306
+		/**
307
+		 *    Splits the page text into tokens. Will fail
308
+		 *    if the handlers report an error or if no
309
+		 *    content is consumed. If successful then each
310
+		 *    unparsed and parsed token invokes a call to the
311
+		 *    held listener.
312
+		 *    @param string $raw        Raw HTML text.
313
+		 *    @return boolean           True on success, else false.
314
+		 *    @access public
315
+		 */
316
+		function parse($raw) {
317
+			if (! isset($this->_parser)) {
318
+				return false;
319
+			}
320
+			$length = strlen($raw);
321
+			while (is_array($parsed = $this->_reduce($raw))) {
322
+				list($raw, $unmatched, $matched, $mode) = $parsed;
323
+				if (! $this->_dispatchTokens($unmatched, $matched, $mode)) {
324
+					return false;
325
+				}
326
+				if ($raw === '') {
327
+					return true;
328
+				}
329
+				if (strlen($raw) == $length) {
330
+					return false;
331
+				}
332
+				$length = strlen($raw);
333
+			}
334
+			if (! $parsed) {
335
+				return false;
336
+			}
337
+			return $this->_invokeParser($raw, LEXER_UNMATCHED);
338
+		}
339
+
340
+		/**
341
+		 *    Sends the matched token and any leading unmatched
342
+		 *    text to the parser changing the lexer to a new
343
+		 *    mode if one is listed.
344
+		 *    @param string $unmatched    Unmatched leading portion.
345
+		 *    @param string $matched      Actual token match.
346
+		 *    @param string $mode         Mode after match. A boolean
347
+		 *                                false mode causes no change.
348
+		 *    @return boolean             False if there was any error
349
+		 *                                from the parser.
350
+		 *    @access private
351
+		 */
352
+		function _dispatchTokens($unmatched, $matched, $mode = false) {
353
+			if (! $this->_invokeParser($unmatched, LEXER_UNMATCHED)) {
354
+				return false;
355
+			}
356
+			if (is_bool($mode)) {
357
+				return $this->_invokeParser($matched, LEXER_MATCHED);
358
+			}
359
+			if ($this->_isModeEnd($mode)) {
360
+				if (! $this->_invokeParser($matched, LEXER_EXIT)) {
361
+					return false;
362
+				}
363
+				return $this->_mode->leave();
364
+			}
365
+			if ($this->_isSpecialMode($mode)) {
366
+				$this->_mode->enter($this->_decodeSpecial($mode));
367
+				if (! $this->_invokeParser($matched, LEXER_SPECIAL)) {
368
+					return false;
369
+				}
370
+				return $this->_mode->leave();
371
+			}
372
+			$this->_mode->enter($mode);
373
+			return $this->_invokeParser($matched, LEXER_ENTER);
374
+		}
375
+
376
+		/**
377
+		 *    Tests to see if the new mode is actually to leave
378
+		 *    the current mode and pop an item from the matching
379
+		 *    mode stack.
380
+		 *    @param string $mode    Mode to test.
381
+		 *    @return boolean        True if this is the exit mode.
382
+		 *    @access private
383
+		 */
384
+		function _isModeEnd($mode) {
385
+			return ($mode === "__exit");
386
+		}
387
+
388
+		/**
389
+		 *    Test to see if the mode is one where this mode
390
+		 *    is entered for this token only and automatically
391
+		 *    leaves immediately afterwoods.
392
+		 *    @param string $mode    Mode to test.
393
+		 *    @return boolean        True if this is the exit mode.
394
+		 *    @access private
395
+		 */
396
+		function _isSpecialMode($mode) {
397
+			return (strncmp($mode, "_", 1) == 0);
398
+		}
399
+
400
+		/**
401
+		 *    Strips the magic underscore marking single token
402
+		 *    modes.
403
+		 *    @param string $mode    Mode to decode.
404
+		 *    @return string         Underlying mode name.
405
+		 *    @access private
406
+		 */
407
+		function _decodeSpecial($mode) {
408
+			return substr($mode, 1);
409
+		}
410
+
411
+		/**
412
+		 *    Calls the parser method named after the current
413
+		 *    mode. Empty content will be ignored. The lexer
414
+		 *    has a parser handler for each mode in the lexer.
415
+		 *    @param string $content        Text parsed.
416
+		 *    @param boolean $is_match      Token is recognised rather
417
+		 *                                  than unparsed data.
418
+		 *    @access private
419
+		 */
420
+		function _invokeParser($content, $is_match) {
421
+			if (($content === '') || ($content === false)) {
422
+				return true;
423
+			}
424
+			$handler = $this->_mode_handlers[$this->_mode->getCurrent()];
425
+			return $this->_parser->$handler($content, $is_match);
426
+		}
427
+
428
+		/**
429
+		 *    Tries to match a chunk of text and if successful
430
+		 *    removes the recognised chunk and any leading
431
+		 *    unparsed data. Empty strings will not be matched.
432
+		 *    @param string $raw         The subject to parse. This is the
433
+		 *                               content that will be eaten.
434
+		 *    @return array/boolean      Three item list of unparsed
435
+		 *                               content followed by the
436
+		 *                               recognised token and finally the
437
+		 *                               action the parser is to take.
438
+		 *                               True if no match, false if there
439
+		 *                               is a parsing error.
440
+		 *    @access private
441
+		 */
442
+		function _reduce($raw) {
443
+			if ($action = $this->_regexes[$this->_mode->getCurrent()]->match($raw, $match)) {
444
+				$unparsed_character_count = strpos($raw, $match);
445
+				$unparsed = substr($raw, 0, $unparsed_character_count);
446
+				$raw = substr($raw, $unparsed_character_count + strlen($match));
447
+				return array($raw, $unparsed, $match, $action);
448
+			}
449
+			return true;
450
+		}
451
+	}
452
+
453
+	/**
454
+	 *    Breas HTML into SAX events.
455 455
 	 *    @package SimpleTest
456 456
 	 *    @subpackage WebTester
457
-     */
458
-    class SimpleHtmlLexer extends SimpleLexer {
459
-
460
-        /**
461
-         *    Sets up the lexer with case insensitive matching
462
-         *    and adds the HTML handlers.
463
-         *    @param SimpleSaxParser $parser  Handling strategy by
464
-         *                                    reference.
465
-         *    @access public
466
-         */
467
-        function SimpleHtmlLexer($parser) {
468
-            $this->SimpleLexer($parser, 'text');
469
-            $this->mapHandler('text', 'acceptTextToken');
470
-            $this->_addSkipping();
471
-            foreach ($this->_getParsedTags() as $tag) {
472
-                $this->_addTag($tag);
473
-            }
474
-            $this->_addInTagTokens();
475
-        }
476
-
477
-        /**
478
-         *    List of parsed tags. Others are ignored.
479
-         *    @return array        List of searched for tags.
480
-         *    @access private
481
-         */
482
-        function _getParsedTags() {
483
-            return array('a', 'title', 'form', 'input', 'button', 'textarea', 'select',
484
-                    'option', 'frameset', 'frame', 'label');
485
-        }
486
-
487
-        /**
488
-         *    The lexer has to skip certain sections such
489
-         *    as server code, client code and styles.
490
-         *    @access private
491
-         */
492
-        function _addSkipping() {
493
-            $this->mapHandler('css', 'ignore');
494
-            $this->addEntryPattern('<style', 'text', 'css');
495
-            $this->addExitPattern('</style>', 'css');
496
-            $this->mapHandler('js', 'ignore');
497
-            $this->addEntryPattern('<script', 'text', 'js');
498
-            $this->addExitPattern('</script>', 'js');
499
-            $this->mapHandler('comment', 'ignore');
500
-            $this->addEntryPattern('<!--', 'text', 'comment');
501
-            $this->addExitPattern('-->', 'comment');
502
-        }
503
-
504
-        /**
505
-         *    Pattern matches to start and end a tag.
506
-         *    @param string $tag          Name of tag to scan for.
507
-         *    @access private
508
-         */
509
-        function _addTag($tag) {
510
-            $this->addSpecialPattern("</$tag>", 'text', 'acceptEndToken');
511
-            $this->addEntryPattern("<$tag", 'text', 'tag');
512
-        }
513
-
514
-        /**
515
-         *    Pattern matches to parse the inside of a tag
516
-         *    including the attributes and their quoting.
517
-         *    @access private
518
-         */
519
-        function _addInTagTokens() {
520
-            $this->mapHandler('tag', 'acceptStartToken');
521
-            $this->addSpecialPattern('\s+', 'tag', 'ignore');
522
-            $this->_addAttributeTokens();
523
-            $this->addExitPattern('/>', 'tag');
524
-            $this->addExitPattern('>', 'tag');
525
-        }
526
-
527
-        /**
528
-         *    Matches attributes that are either single quoted,
529
-         *    double quoted or unquoted.
530
-         *    @access private
531
-         */
532
-        function _addAttributeTokens() {
533
-            $this->mapHandler('dq_attribute', 'acceptAttributeToken');
534
-            $this->addEntryPattern('=\s*"', 'tag', 'dq_attribute');
535
-            $this->addPattern("\\\\\"", 'dq_attribute');
536
-            $this->addExitPattern('"', 'dq_attribute');
537
-            $this->mapHandler('sq_attribute', 'acceptAttributeToken');
538
-            $this->addEntryPattern("=\s*'", 'tag', 'sq_attribute');
539
-            $this->addPattern("\\\\'", 'sq_attribute');
540
-            $this->addExitPattern("'", 'sq_attribute');
541
-            $this->mapHandler('uq_attribute', 'acceptAttributeToken');
542
-            $this->addSpecialPattern('=\s*[^>\s]*', 'tag', 'uq_attribute');
543
-        }
544
-    }
545
-
546
-    /**
547
-     *    Converts HTML tokens into selected SAX events.
457
+	 */
458
+	class SimpleHtmlLexer extends SimpleLexer {
459
+
460
+		/**
461
+		 *    Sets up the lexer with case insensitive matching
462
+		 *    and adds the HTML handlers.
463
+		 *    @param SimpleSaxParser $parser  Handling strategy by
464
+		 *                                    reference.
465
+		 *    @access public
466
+		 */
467
+		function SimpleHtmlLexer($parser) {
468
+			$this->SimpleLexer($parser, 'text');
469
+			$this->mapHandler('text', 'acceptTextToken');
470
+			$this->_addSkipping();
471
+			foreach ($this->_getParsedTags() as $tag) {
472
+				$this->_addTag($tag);
473
+			}
474
+			$this->_addInTagTokens();
475
+		}
476
+
477
+		/**
478
+		 *    List of parsed tags. Others are ignored.
479
+		 *    @return array        List of searched for tags.
480
+		 *    @access private
481
+		 */
482
+		function _getParsedTags() {
483
+			return array('a', 'title', 'form', 'input', 'button', 'textarea', 'select',
484
+					'option', 'frameset', 'frame', 'label');
485
+		}
486
+
487
+		/**
488
+		 *    The lexer has to skip certain sections such
489
+		 *    as server code, client code and styles.
490
+		 *    @access private
491
+		 */
492
+		function _addSkipping() {
493
+			$this->mapHandler('css', 'ignore');
494
+			$this->addEntryPattern('<style', 'text', 'css');
495
+			$this->addExitPattern('</style>', 'css');
496
+			$this->mapHandler('js', 'ignore');
497
+			$this->addEntryPattern('<script', 'text', 'js');
498
+			$this->addExitPattern('</script>', 'js');
499
+			$this->mapHandler('comment', 'ignore');
500
+			$this->addEntryPattern('<!--', 'text', 'comment');
501
+			$this->addExitPattern('-->', 'comment');
502
+		}
503
+
504
+		/**
505
+		 *    Pattern matches to start and end a tag.
506
+		 *    @param string $tag          Name of tag to scan for.
507
+		 *    @access private
508
+		 */
509
+		function _addTag($tag) {
510
+			$this->addSpecialPattern("</$tag>", 'text', 'acceptEndToken');
511
+			$this->addEntryPattern("<$tag", 'text', 'tag');
512
+		}
513
+
514
+		/**
515
+		 *    Pattern matches to parse the inside of a tag
516
+		 *    including the attributes and their quoting.
517
+		 *    @access private
518
+		 */
519
+		function _addInTagTokens() {
520
+			$this->mapHandler('tag', 'acceptStartToken');
521
+			$this->addSpecialPattern('\s+', 'tag', 'ignore');
522
+			$this->_addAttributeTokens();
523
+			$this->addExitPattern('/>', 'tag');
524
+			$this->addExitPattern('>', 'tag');
525
+		}
526
+
527
+		/**
528
+		 *    Matches attributes that are either single quoted,
529
+		 *    double quoted or unquoted.
530
+		 *    @access private
531
+		 */
532
+		function _addAttributeTokens() {
533
+			$this->mapHandler('dq_attribute', 'acceptAttributeToken');
534
+			$this->addEntryPattern('=\s*"', 'tag', 'dq_attribute');
535
+			$this->addPattern("\\\\\"", 'dq_attribute');
536
+			$this->addExitPattern('"', 'dq_attribute');
537
+			$this->mapHandler('sq_attribute', 'acceptAttributeToken');
538
+			$this->addEntryPattern("=\s*'", 'tag', 'sq_attribute');
539
+			$this->addPattern("\\\\'", 'sq_attribute');
540
+			$this->addExitPattern("'", 'sq_attribute');
541
+			$this->mapHandler('uq_attribute', 'acceptAttributeToken');
542
+			$this->addSpecialPattern('=\s*[^>\s]*', 'tag', 'uq_attribute');
543
+		}
544
+	}
545
+
546
+	/**
547
+	 *    Converts HTML tokens into selected SAX events.
548 548
 	 *    @package SimpleTest
549 549
 	 *    @subpackage WebTester
550
-     */
551
-    class SimpleHtmlSaxParser {
552
-        protected $_lexer;
553
-        protected $_listener;
554
-        protected $_tag;
555
-        protected $_attributes;
556
-        protected $_current_attribute;
557
-
558
-        /**
559
-         *    Sets the listener.
560
-         *    @param SimpleSaxListener $listener    SAX event handler.
561
-         *    @access public
562
-         */
563
-        function SimpleHtmlSaxParser($listener) {
564
-            $this->_listener = $listener;
565
-            $this->_lexer = $this->createLexer($this);
566
-            $this->_tag = '';
567
-            $this->_attributes = array();
568
-            $this->_current_attribute = '';
569
-        }
570
-
571
-        /**
572
-         *    Runs the content through the lexer which
573
-         *    should call back to the acceptors.
574
-         *    @param string $raw      Page text to parse.
575
-         *    @return boolean         False if parse error.
576
-         *    @access public
577
-         */
578
-        function parse($raw) {
579
-            return $this->_lexer->parse($raw);
580
-        }
581
-
582
-        /**
583
-         *    Sets up the matching lexer. Starts in 'text' mode.
584
-         *    @param SimpleSaxParser $parser    Event generator, usually $self.
585
-         *    @return SimpleLexer               Lexer suitable for this parser.
586
-         *    @access public
587
-         *    @static
588
-         */
589
-        static function &createLexer($parser) {
590
-            $lexer = new SimpleHtmlLexer($parser);
591
-            return $lexer;
592
-        }
593
-
594
-        /**
595
-         *    Accepts a token from the tag mode. If the
596
-         *    starting element completes then the element
597
-         *    is dispatched and the current attributes
598
-         *    set back to empty. The element or attribute
599
-         *    name is converted to lower case.
600
-         *    @param string $token     Incoming characters.
601
-         *    @param integer $event    Lexer event type.
602
-         *    @return boolean          False if parse error.
603
-         *    @access public
604
-         */
605
-        function acceptStartToken($token, $event) {
606
-            if ($event == LEXER_ENTER) {
607
-                $this->_tag = strtolower(substr($token, 1));
608
-                return true;
609
-            }
610
-            if ($event == LEXER_EXIT) {
611
-                $success = $this->_listener->startElement(
612
-                        $this->_tag,
613
-                        $this->_attributes);
614
-                $this->_tag = '';
615
-                $this->_attributes = array();
616
-                return $success;
617
-            }
618
-            if ($token != '=') {
619
-                $this->_current_attribute = strtolower(SimpleHtmlSaxParser::decodeHtml($token));
620
-                $this->_attributes[$this->_current_attribute] = '';
621
-            }
622
-            return true;
623
-        }
624
-
625
-        /**
626
-         *    Accepts a token from the end tag mode.
627
-         *    The element name is converted to lower case.
628
-         *    @param string $token     Incoming characters.
629
-         *    @param integer $event    Lexer event type.
630
-         *    @return boolean          False if parse error.
631
-         *    @access public
632
-         */
633
-        function acceptEndToken($token, $event) {
634
-            if (! preg_match('/<\/(.*)>/', $token, $matches)) {
635
-                return false;
636
-            }
637
-            return $this->_listener->endElement(strtolower($matches[1]));
638
-        }
639
-
640
-        /**
641
-         *    Part of the tag data.
642
-         *    @param string $token     Incoming characters.
643
-         *    @param integer $event    Lexer event type.
644
-         *    @return boolean          False if parse error.
645
-         *    @access public
646
-         */
647
-        function acceptAttributeToken($token, $event) {
648
-            if ($event == LEXER_UNMATCHED) {
649
-                $this->_attributes[$this->_current_attribute] .=
650
-                        SimpleHtmlSaxParser::decodeHtml($token);
651
-            }
652
-            if ($event == LEXER_SPECIAL) {
653
-                $this->_attributes[$this->_current_attribute] .=
654
-                        preg_replace('/^=\s*/' , '', SimpleHtmlSaxParser::decodeHtml($token));
655
-            }
656
-            return true;
657
-        }
658
-
659
-        /**
660
-         *    A character entity.
661
-         *    @param string $token    Incoming characters.
662
-         *    @param integer $event   Lexer event type.
663
-         *    @return boolean         False if parse error.
664
-         *    @access public
665
-         */
666
-        function acceptEntityToken($token, $event) {
667
-        }
668
-
669
-        /**
670
-         *    Character data between tags regarded as
671
-         *    important.
672
-         *    @param string $token     Incoming characters.
673
-         *    @param integer $event    Lexer event type.
674
-         *    @return boolean          False if parse error.
675
-         *    @access public
676
-         */
677
-        function acceptTextToken($token, $event) {
678
-            return $this->_listener->addContent($token);
679
-        }
680
-
681
-        /**
682
-         *    Incoming data to be ignored.
683
-         *    @param string $token     Incoming characters.
684
-         *    @param integer $event    Lexer event type.
685
-         *    @return boolean          False if parse error.
686
-         *    @access public
687
-         */
688
-        function ignore($token, $event) {
689
-            return true;
690
-        }
691
-
692
-        /**
693
-         *    Decodes any HTML entities.
694
-         *    @param string $html    Incoming HTML.
695
-         *    @return string         Outgoing plain text.
696
-         *    @access public
697
-         *    @static
698
-         */
699
-        static function decodeHtml($html) {
700
-            static $translations;
701
-            if (! isset($translations)) {
702
-                $translations = array_flip(get_html_translation_table(HTML_ENTITIES));
703
-            }
704
-            return strtr($html, $translations);
705
-        }
706
-
707
-        /**
708
-         *    Turns HTML into text browser visible text. Images
709
-         *    are converted to their alt text and tags are supressed.
710
-         *    Entities are converted to their visible representation.
711
-         *    @param string $html        HTML to convert.
712
-         *    @return string             Plain text.
713
-         *    @access public
714
-         *    @static
715
-         */
716
-        static function normalise($html) {
717
-            $text = preg_replace('|<!--.*?-->|', '', $html);
718
-            $text = preg_replace('|<img.*?alt\s*=\s*"(.*?)".*?>|', ' \1 ', $text);
719
-            $text = preg_replace('|<img.*?alt\s*=\s*\'(.*?)\'.*?>|', ' \1 ', $text);
720
-            $text = preg_replace('|<img.*?alt\s*=\s*([a-zA-Z_]+).*?>|', ' \1 ', $text);
721
-            $text = preg_replace('|<.*?>|', '', $text);
722
-            $text = SimpleHtmlSaxParser::decodeHtml($text);
723
-            $text = preg_replace('|\s+|', ' ', $text);
724
-            return trim($text);
725
-        }
726
-    }
727
-
728
-    /**
729
-     *    SAX event handler.
550
+	 */
551
+	class SimpleHtmlSaxParser {
552
+		protected $_lexer;
553
+		protected $_listener;
554
+		protected $_tag;
555
+		protected $_attributes;
556
+		protected $_current_attribute;
557
+
558
+		/**
559
+		 *    Sets the listener.
560
+		 *    @param SimpleSaxListener $listener    SAX event handler.
561
+		 *    @access public
562
+		 */
563
+		function SimpleHtmlSaxParser($listener) {
564
+			$this->_listener = $listener;
565
+			$this->_lexer = $this->createLexer($this);
566
+			$this->_tag = '';
567
+			$this->_attributes = array();
568
+			$this->_current_attribute = '';
569
+		}
570
+
571
+		/**
572
+		 *    Runs the content through the lexer which
573
+		 *    should call back to the acceptors.
574
+		 *    @param string $raw      Page text to parse.
575
+		 *    @return boolean         False if parse error.
576
+		 *    @access public
577
+		 */
578
+		function parse($raw) {
579
+			return $this->_lexer->parse($raw);
580
+		}
581
+
582
+		/**
583
+		 *    Sets up the matching lexer. Starts in 'text' mode.
584
+		 *    @param SimpleSaxParser $parser    Event generator, usually $self.
585
+		 *    @return SimpleLexer               Lexer suitable for this parser.
586
+		 *    @access public
587
+		 *    @static
588
+		 */
589
+		static function &createLexer($parser) {
590
+			$lexer = new SimpleHtmlLexer($parser);
591
+			return $lexer;
592
+		}
593
+
594
+		/**
595
+		 *    Accepts a token from the tag mode. If the
596
+		 *    starting element completes then the element
597
+		 *    is dispatched and the current attributes
598
+		 *    set back to empty. The element or attribute
599
+		 *    name is converted to lower case.
600
+		 *    @param string $token     Incoming characters.
601
+		 *    @param integer $event    Lexer event type.
602
+		 *    @return boolean          False if parse error.
603
+		 *    @access public
604
+		 */
605
+		function acceptStartToken($token, $event) {
606
+			if ($event == LEXER_ENTER) {
607
+				$this->_tag = strtolower(substr($token, 1));
608
+				return true;
609
+			}
610
+			if ($event == LEXER_EXIT) {
611
+				$success = $this->_listener->startElement(
612
+						$this->_tag,
613
+						$this->_attributes);
614
+				$this->_tag = '';
615
+				$this->_attributes = array();
616
+				return $success;
617
+			}
618
+			if ($token != '=') {
619
+				$this->_current_attribute = strtolower(SimpleHtmlSaxParser::decodeHtml($token));
620
+				$this->_attributes[$this->_current_attribute] = '';
621
+			}
622
+			return true;
623
+		}
624
+
625
+		/**
626
+		 *    Accepts a token from the end tag mode.
627
+		 *    The element name is converted to lower case.
628
+		 *    @param string $token     Incoming characters.
629
+		 *    @param integer $event    Lexer event type.
630
+		 *    @return boolean          False if parse error.
631
+		 *    @access public
632
+		 */
633
+		function acceptEndToken($token, $event) {
634
+			if (! preg_match('/<\/(.*)>/', $token, $matches)) {
635
+				return false;
636
+			}
637
+			return $this->_listener->endElement(strtolower($matches[1]));
638
+		}
639
+
640
+		/**
641
+		 *    Part of the tag data.
642
+		 *    @param string $token     Incoming characters.
643
+		 *    @param integer $event    Lexer event type.
644
+		 *    @return boolean          False if parse error.
645
+		 *    @access public
646
+		 */
647
+		function acceptAttributeToken($token, $event) {
648
+			if ($event == LEXER_UNMATCHED) {
649
+				$this->_attributes[$this->_current_attribute] .=
650
+						SimpleHtmlSaxParser::decodeHtml($token);
651
+			}
652
+			if ($event == LEXER_SPECIAL) {
653
+				$this->_attributes[$this->_current_attribute] .=
654
+						preg_replace('/^=\s*/' , '', SimpleHtmlSaxParser::decodeHtml($token));
655
+			}
656
+			return true;
657
+		}
658
+
659
+		/**
660
+		 *    A character entity.
661
+		 *    @param string $token    Incoming characters.
662
+		 *    @param integer $event   Lexer event type.
663
+		 *    @return boolean         False if parse error.
664
+		 *    @access public
665
+		 */
666
+		function acceptEntityToken($token, $event) {
667
+		}
668
+
669
+		/**
670
+		 *    Character data between tags regarded as
671
+		 *    important.
672
+		 *    @param string $token     Incoming characters.
673
+		 *    @param integer $event    Lexer event type.
674
+		 *    @return boolean          False if parse error.
675
+		 *    @access public
676
+		 */
677
+		function acceptTextToken($token, $event) {
678
+			return $this->_listener->addContent($token);
679
+		}
680
+
681
+		/**
682
+		 *    Incoming data to be ignored.
683
+		 *    @param string $token     Incoming characters.
684
+		 *    @param integer $event    Lexer event type.
685
+		 *    @return boolean          False if parse error.
686
+		 *    @access public
687
+		 */
688
+		function ignore($token, $event) {
689
+			return true;
690
+		}
691
+
692
+		/**
693
+		 *    Decodes any HTML entities.
694
+		 *    @param string $html    Incoming HTML.
695
+		 *    @return string         Outgoing plain text.
696
+		 *    @access public
697
+		 *    @static
698
+		 */
699
+		static function decodeHtml($html) {
700
+			static $translations;
701
+			if (! isset($translations)) {
702
+				$translations = array_flip(get_html_translation_table(HTML_ENTITIES));
703
+			}
704
+			return strtr($html, $translations);
705
+		}
706
+
707
+		/**
708
+		 *    Turns HTML into text browser visible text. Images
709
+		 *    are converted to their alt text and tags are supressed.
710
+		 *    Entities are converted to their visible representation.
711
+		 *    @param string $html        HTML to convert.
712
+		 *    @return string             Plain text.
713
+		 *    @access public
714
+		 *    @static
715
+		 */
716
+		static function normalise($html) {
717
+			$text = preg_replace('|<!--.*?-->|', '', $html);
718
+			$text = preg_replace('|<img.*?alt\s*=\s*"(.*?)".*?>|', ' \1 ', $text);
719
+			$text = preg_replace('|<img.*?alt\s*=\s*\'(.*?)\'.*?>|', ' \1 ', $text);
720
+			$text = preg_replace('|<img.*?alt\s*=\s*([a-zA-Z_]+).*?>|', ' \1 ', $text);
721
+			$text = preg_replace('|<.*?>|', '', $text);
722
+			$text = SimpleHtmlSaxParser::decodeHtml($text);
723
+			$text = preg_replace('|\s+|', ' ', $text);
724
+			return trim($text);
725
+		}
726
+	}
727
+
728
+	/**
729
+	 *    SAX event handler.
730 730
 	 *    @package SimpleTest
731 731
 	 *    @subpackage WebTester
732
-     *    @abstract
733
-     */
734
-    class SimpleSaxListener {
735
-
736
-        /**
737
-         *    Sets the document to write to.
738
-         *    @access public
739
-         */
740
-        function SimpleSaxListener() {
741
-        }
742
-
743
-        /**
744
-         *    Start of element event.
745
-         *    @param string $name        Element name.
746
-         *    @param hash $attributes    Name value pairs.
747
-         *                               Attributes without content
748
-         *                               are marked as true.
749
-         *    @return boolean            False on parse error.
750
-         *    @access public
751
-         */
752
-        function startElement($name, $attributes) {
753
-        }
754
-
755
-        /**
756
-         *    End of element event.
757
-         *    @param string $name        Element name.
758
-         *    @return boolean            False on parse error.
759
-         *    @access public
760
-         */
761
-        function endElement($name) {
762
-        }
763
-
764
-        /**
765
-         *    Unparsed, but relevant data.
766
-         *    @param string $text        May include unparsed tags.
767
-         *    @return boolean            False on parse error.
768
-         *    @access public
769
-         */
770
-        function addContent($text) {
771
-        }
772
-    }
773 732
\ No newline at end of file
733
+	 *    @abstract
734
+	 */
735
+	class SimpleSaxListener {
736
+
737
+		/**
738
+		 *    Sets the document to write to.
739
+		 *    @access public
740
+		 */
741
+		function SimpleSaxListener() {
742
+		}
743
+
744
+		/**
745
+		 *    Start of element event.
746
+		 *    @param string $name        Element name.
747
+		 *    @param hash $attributes    Name value pairs.
748
+		 *                               Attributes without content
749
+		 *                               are marked as true.
750
+		 *    @return boolean            False on parse error.
751
+		 *    @access public
752
+		 */
753
+		function startElement($name, $attributes) {
754
+		}
755
+
756
+		/**
757
+		 *    End of element event.
758
+		 *    @param string $name        Element name.
759
+		 *    @return boolean            False on parse error.
760
+		 *    @access public
761
+		 */
762
+		function endElement($name) {
763
+		}
764
+
765
+		/**
766
+		 *    Unparsed, but relevant data.
767
+		 *    @param string $text        May include unparsed tags.
768
+		 *    @return boolean            False on parse error.
769
+		 *    @access public
770
+		 */
771
+		function addContent($text) {
772
+		}
773
+	}
774 774
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test_tools/simpletest/invoker.php 1 patch
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1,138 +1,138 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	Base include file for SimpleTest
4
-     *	@package	SimpleTest
5
-     *	@subpackage	UnitTester
6
-     *	@version	$Id: invoker.php 1398 2006-09-08 19:31:03Z xue $
7
-     */
2
+	/**
3
+	 *	Base include file for SimpleTest
4
+	 *	@package	SimpleTest
5
+	 *	@subpackage	UnitTester
6
+	 *	@version	$Id: invoker.php 1398 2006-09-08 19:31:03Z xue $
7
+	 */
8 8
 
9
-    /**#@+
9
+	/**#@+
10 10
      * Includes SimpleTest files and defined the root constant
11 11
      * for dependent libraries.
12 12
      */
13
-    require_once(dirname(__FILE__) . '/errors.php');
14
-    require_once(dirname(__FILE__) . '/compatibility.php');
15
-    require_once(dirname(__FILE__) . '/scorer.php');
16
-    require_once(dirname(__FILE__) . '/expectation.php');
17
-    require_once(dirname(__FILE__) . '/dumper.php');
18
-    if (! defined('SIMPLE_TEST')) {
19
-        define('SIMPLE_TEST', dirname(__FILE__) . '/');
20
-    }
21
-    /**#@-*/
13
+	require_once(dirname(__FILE__) . '/errors.php');
14
+	require_once(dirname(__FILE__) . '/compatibility.php');
15
+	require_once(dirname(__FILE__) . '/scorer.php');
16
+	require_once(dirname(__FILE__) . '/expectation.php');
17
+	require_once(dirname(__FILE__) . '/dumper.php');
18
+	if (! defined('SIMPLE_TEST')) {
19
+		define('SIMPLE_TEST', dirname(__FILE__) . '/');
20
+	}
21
+	/**#@-*/
22 22
 
23
-    /**
24
-     *    This is called by the class runner to run a
25
-     *    single test method. Will also run the setUp()
26
-     *    and tearDown() methods.
23
+	/**
24
+	 *    This is called by the class runner to run a
25
+	 *    single test method. Will also run the setUp()
26
+	 *    and tearDown() methods.
27 27
 	 *	  @package SimpleTest
28 28
 	 *	  @subpackage UnitTester
29
-     */
30
-    class SimpleInvoker {
31
-        protected $_test_case;
29
+	 */
30
+	class SimpleInvoker {
31
+		protected $_test_case;
32 32
 
33
-        /**
34
-         *    Stashes the test case for later.
35
-         *    @param SimpleTestCase $test_case  Test case to run.
36
-         */
37
-        function SimpleInvoker($test_case) {
38
-            $this->_test_case = $test_case;
39
-        }
33
+		/**
34
+		 *    Stashes the test case for later.
35
+		 *    @param SimpleTestCase $test_case  Test case to run.
36
+		 */
37
+		function SimpleInvoker($test_case) {
38
+			$this->_test_case = $test_case;
39
+		}
40 40
 
41
-        /**
42
-         *    Accessor for test case being run.
43
-         *    @return SimpleTestCase    Test case.
44
-         *    @access public
45
-         */
46
-        function &getTestCase() {
47
-            return $this->_test_case;
48
-        }
41
+		/**
42
+		 *    Accessor for test case being run.
43
+		 *    @return SimpleTestCase    Test case.
44
+		 *    @access public
45
+		 */
46
+		function &getTestCase() {
47
+			return $this->_test_case;
48
+		}
49 49
 
50
-        /**
51
-         *    Runs test level set up. Used for changing
52
-         *    the mechanics of base test cases.
53
-         *    @param string $method    Test method to call.
54
-         *    @access public
55
-         */
56
-        function before($method) {
57
-            $this->_test_case->before($method);
58
-        }
50
+		/**
51
+		 *    Runs test level set up. Used for changing
52
+		 *    the mechanics of base test cases.
53
+		 *    @param string $method    Test method to call.
54
+		 *    @access public
55
+		 */
56
+		function before($method) {
57
+			$this->_test_case->before($method);
58
+		}
59 59
 
60
-        /**
61
-         *    Invokes a test method and buffered with setUp()
62
-         *    and tearDown() calls.
63
-         *    @param string $method    Test method to call.
64
-         *    @access public
65
-         */
66
-        function invoke($method) {
67
-            $this->_test_case->setUp();
68
-            $this->_test_case->$method();
69
-            $this->_test_case->tearDown();
70
-        }
60
+		/**
61
+		 *    Invokes a test method and buffered with setUp()
62
+		 *    and tearDown() calls.
63
+		 *    @param string $method    Test method to call.
64
+		 *    @access public
65
+		 */
66
+		function invoke($method) {
67
+			$this->_test_case->setUp();
68
+			$this->_test_case->$method();
69
+			$this->_test_case->tearDown();
70
+		}
71 71
 
72
-        /**
73
-         *    Runs test level clean up. Used for changing
74
-         *    the mechanics of base test cases.
75
-         *    @param string $method    Test method to call.
76
-         *    @access public
77
-         */
78
-        function after($method) {
79
-            $this->_test_case->after($method);
80
-        }
81
-    }
72
+		/**
73
+		 *    Runs test level clean up. Used for changing
74
+		 *    the mechanics of base test cases.
75
+		 *    @param string $method    Test method to call.
76
+		 *    @access public
77
+		 */
78
+		function after($method) {
79
+			$this->_test_case->after($method);
80
+		}
81
+	}
82 82
 
83
-    /**
84
-     *    Do nothing decorator. Just passes the invocation
85
-     *    straight through.
83
+	/**
84
+	 *    Do nothing decorator. Just passes the invocation
85
+	 *    straight through.
86 86
 	 *	  @package SimpleTest
87 87
 	 *	  @subpackage UnitTester
88
-     */
89
-    class SimpleInvokerDecorator {
90
-        protected $_invoker;
88
+	 */
89
+	class SimpleInvokerDecorator {
90
+		protected $_invoker;
91 91
 
92
-        /**
93
-         *    Stores the invoker to wrap.
94
-         *    @param SimpleInvoker $invoker  Test method runner.
95
-         */
96
-        function SimpleInvokerDecorator($invoker) {
97
-            $this->_invoker = $invoker;
98
-        }
92
+		/**
93
+		 *    Stores the invoker to wrap.
94
+		 *    @param SimpleInvoker $invoker  Test method runner.
95
+		 */
96
+		function SimpleInvokerDecorator($invoker) {
97
+			$this->_invoker = $invoker;
98
+		}
99 99
 
100
-        /**
101
-         *    Accessor for test case being run.
102
-         *    @return SimpleTestCase    Test case.
103
-         *    @access public
104
-         */
105
-        function &getTestCase() {
106
-            return $this->_invoker->getTestCase();
107
-        }
100
+		/**
101
+		 *    Accessor for test case being run.
102
+		 *    @return SimpleTestCase    Test case.
103
+		 *    @access public
104
+		 */
105
+		function &getTestCase() {
106
+			return $this->_invoker->getTestCase();
107
+		}
108 108
 
109
-        /**
110
-         *    Runs test level set up. Used for changing
111
-         *    the mechanics of base test cases.
112
-         *    @param string $method    Test method to call.
113
-         *    @access public
114
-         */
115
-        function before($method) {
116
-            $this->_invoker->before($method);
117
-        }
109
+		/**
110
+		 *    Runs test level set up. Used for changing
111
+		 *    the mechanics of base test cases.
112
+		 *    @param string $method    Test method to call.
113
+		 *    @access public
114
+		 */
115
+		function before($method) {
116
+			$this->_invoker->before($method);
117
+		}
118 118
 
119
-        /**
120
-         *    Invokes a test method and buffered with setUp()
121
-         *    and tearDown() calls.
122
-         *    @param string $method    Test method to call.
123
-         *    @access public
124
-         */
125
-        function invoke($method) {
126
-            $this->_invoker->invoke($method);
127
-        }
119
+		/**
120
+		 *    Invokes a test method and buffered with setUp()
121
+		 *    and tearDown() calls.
122
+		 *    @param string $method    Test method to call.
123
+		 *    @access public
124
+		 */
125
+		function invoke($method) {
126
+			$this->_invoker->invoke($method);
127
+		}
128 128
 
129
-        /**
130
-         *    Runs test level clean up. Used for changing
131
-         *    the mechanics of base test cases.
132
-         *    @param string $method    Test method to call.
133
-         *    @access public
134
-         */
135
-        function after($method) {
136
-            $this->_invoker->after($method);
137
-        }
138
-    }
129
+		/**
130
+		 *    Runs test level clean up. Used for changing
131
+		 *    the mechanics of base test cases.
132
+		 *    @param string $method    Test method to call.
133
+		 *    @access public
134
+		 */
135
+		function after($method) {
136
+			$this->_invoker->after($method);
137
+		}
138
+	}
Please login to merge, or discard this patch.
tests/test_tools/simpletest/browser.php 1 patch
Indentation   +1049 added lines, -1049 removed lines patch added patch discarded remove patch
@@ -1,1056 +1,1056 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	Base include file for SimpleTest
4
-     *	@package	SimpleTest
5
-     *	@subpackage	WebTester
6
-     *	@version	$Id: browser.php 1398 2006-09-08 19:31:03Z xue $
7
-     */
8
-
9
-    /**#@+
2
+	/**
3
+	 *	Base include file for SimpleTest
4
+	 *	@package	SimpleTest
5
+	 *	@subpackage	WebTester
6
+	 *	@version	$Id: browser.php 1398 2006-09-08 19:31:03Z xue $
7
+	 */
8
+
9
+	/**#@+
10 10
      *	include other SimpleTest class files
11 11
      */
12
-    require_once(dirname(__FILE__) . '/simpletest.php');
13
-    require_once(dirname(__FILE__) . '/http.php');
14
-    require_once(dirname(__FILE__) . '/encoding.php');
15
-    require_once(dirname(__FILE__) . '/page.php');
16
-    require_once(dirname(__FILE__) . '/selector.php');
17
-    require_once(dirname(__FILE__) . '/frames.php');
18
-    require_once(dirname(__FILE__) . '/user_agent.php');
19
-    /**#@-*/
20
-
21
-    if (!defined('DEFAULT_MAX_NESTED_FRAMES')) {
22
-        define('DEFAULT_MAX_NESTED_FRAMES', 3);
23
-    }
24
-
25
-    /**
26
-     *    Browser history list.
12
+	require_once(dirname(__FILE__) . '/simpletest.php');
13
+	require_once(dirname(__FILE__) . '/http.php');
14
+	require_once(dirname(__FILE__) . '/encoding.php');
15
+	require_once(dirname(__FILE__) . '/page.php');
16
+	require_once(dirname(__FILE__) . '/selector.php');
17
+	require_once(dirname(__FILE__) . '/frames.php');
18
+	require_once(dirname(__FILE__) . '/user_agent.php');
19
+	/**#@-*/
20
+
21
+	if (!defined('DEFAULT_MAX_NESTED_FRAMES')) {
22
+		define('DEFAULT_MAX_NESTED_FRAMES', 3);
23
+	}
24
+
25
+	/**
26
+	 *    Browser history list.
27 27
 	 *    @package SimpleTest
28 28
 	 *    @subpackage WebTester
29
-     */
30
-    class SimpleBrowserHistory {
31
-        protected $_sequence;
32
-        protected $_position;
33
-
34
-        /**
35
-         *    Starts empty.
36
-         *    @access public
37
-         */
38
-        function SimpleBrowserHistory() {
39
-            $this->_sequence = array();
40
-            $this->_position = -1;
41
-        }
42
-
43
-        /**
44
-         *    Test for no entries yet.
45
-         *    @return boolean        True if empty.
46
-         *    @access private
47
-         */
48
-        function _isEmpty() {
49
-            return ($this->_position == -1);
50
-        }
51
-
52
-        /**
53
-         *    Test for being at the beginning.
54
-         *    @return boolean        True if first.
55
-         *    @access private
56
-         */
57
-        function _atBeginning() {
58
-            return ($this->_position == 0) && ! $this->_isEmpty();
59
-        }
60
-
61
-        /**
62
-         *    Test for being at the last entry.
63
-         *    @return boolean        True if last.
64
-         *    @access private
65
-         */
66
-        function _atEnd() {
67
-            return ($this->_position + 1 >= count($this->_sequence)) && ! $this->_isEmpty();
68
-        }
69
-
70
-        /**
71
-         *    Adds a successfully fetched page to the history.
72
-         *    @param SimpleUrl $url                 URL of fetch.
73
-         *    @param SimpleEncoding $parameters     Any post data with the fetch.
74
-         *    @access public
75
-         */
76
-        function recordEntry($url, $parameters) {
77
-            $this->_dropFuture();
78
-            array_push(
79
-                    $this->_sequence,
80
-                    array('url' => $url, 'parameters' => $parameters));
81
-            $this->_position++;
82
-        }
83
-
84
-        /**
85
-         *    Last fully qualified URL for current history
86
-         *    position.
87
-         *    @return SimpleUrl        URL for this position.
88
-         *    @access public
89
-         */
90
-        function getUrl() {
91
-            if ($this->_isEmpty()) {
92
-                return false;
93
-            }
94
-            return $this->_sequence[$this->_position]['url'];
95
-        }
96
-
97
-        /**
98
-         *    Parameters of last fetch from current history
99
-         *    position.
100
-         *    @return SimpleFormEncoding    Post parameters.
101
-         *    @access public
102
-         */
103
-        function getParameters() {
104
-            if ($this->_isEmpty()) {
105
-                return false;
106
-            }
107
-            return $this->_sequence[$this->_position]['parameters'];
108
-        }
109
-
110
-        /**
111
-         *    Step back one place in the history. Stops at
112
-         *    the first page.
113
-         *    @return boolean     True if any previous entries.
114
-         *    @access public
115
-         */
116
-        function back() {
117
-            if ($this->_isEmpty() || $this->_atBeginning()) {
118
-                return false;
119
-            }
120
-            $this->_position--;
121
-            return true;
122
-        }
123
-
124
-        /**
125
-         *    Step forward one place. If already at the
126
-         *    latest entry then nothing will happen.
127
-         *    @return boolean     True if any future entries.
128
-         *    @access public
129
-         */
130
-        function forward() {
131
-            if ($this->_isEmpty() || $this->_atEnd()) {
132
-                return false;
133
-            }
134
-            $this->_position++;
135
-            return true;
136
-        }
137
-
138
-        /**
139
-         *    Ditches all future entries beyond the current
140
-         *    point.
141
-         *    @access private
142
-         */
143
-        function _dropFuture() {
144
-            if ($this->_isEmpty()) {
145
-                return;
146
-            }
147
-            while (! $this->_atEnd()) {
148
-                array_pop($this->_sequence);
149
-            }
150
-        }
151
-    }
152
-
153
-    /**
154
-     *    Simulated web browser. This is an aggregate of
155
-     *    the user agent, the HTML parsing, request history
156
-     *    and the last header set.
29
+	 */
30
+	class SimpleBrowserHistory {
31
+		protected $_sequence;
32
+		protected $_position;
33
+
34
+		/**
35
+		 *    Starts empty.
36
+		 *    @access public
37
+		 */
38
+		function SimpleBrowserHistory() {
39
+			$this->_sequence = array();
40
+			$this->_position = -1;
41
+		}
42
+
43
+		/**
44
+		 *    Test for no entries yet.
45
+		 *    @return boolean        True if empty.
46
+		 *    @access private
47
+		 */
48
+		function _isEmpty() {
49
+			return ($this->_position == -1);
50
+		}
51
+
52
+		/**
53
+		 *    Test for being at the beginning.
54
+		 *    @return boolean        True if first.
55
+		 *    @access private
56
+		 */
57
+		function _atBeginning() {
58
+			return ($this->_position == 0) && ! $this->_isEmpty();
59
+		}
60
+
61
+		/**
62
+		 *    Test for being at the last entry.
63
+		 *    @return boolean        True if last.
64
+		 *    @access private
65
+		 */
66
+		function _atEnd() {
67
+			return ($this->_position + 1 >= count($this->_sequence)) && ! $this->_isEmpty();
68
+		}
69
+
70
+		/**
71
+		 *    Adds a successfully fetched page to the history.
72
+		 *    @param SimpleUrl $url                 URL of fetch.
73
+		 *    @param SimpleEncoding $parameters     Any post data with the fetch.
74
+		 *    @access public
75
+		 */
76
+		function recordEntry($url, $parameters) {
77
+			$this->_dropFuture();
78
+			array_push(
79
+					$this->_sequence,
80
+					array('url' => $url, 'parameters' => $parameters));
81
+			$this->_position++;
82
+		}
83
+
84
+		/**
85
+		 *    Last fully qualified URL for current history
86
+		 *    position.
87
+		 *    @return SimpleUrl        URL for this position.
88
+		 *    @access public
89
+		 */
90
+		function getUrl() {
91
+			if ($this->_isEmpty()) {
92
+				return false;
93
+			}
94
+			return $this->_sequence[$this->_position]['url'];
95
+		}
96
+
97
+		/**
98
+		 *    Parameters of last fetch from current history
99
+		 *    position.
100
+		 *    @return SimpleFormEncoding    Post parameters.
101
+		 *    @access public
102
+		 */
103
+		function getParameters() {
104
+			if ($this->_isEmpty()) {
105
+				return false;
106
+			}
107
+			return $this->_sequence[$this->_position]['parameters'];
108
+		}
109
+
110
+		/**
111
+		 *    Step back one place in the history. Stops at
112
+		 *    the first page.
113
+		 *    @return boolean     True if any previous entries.
114
+		 *    @access public
115
+		 */
116
+		function back() {
117
+			if ($this->_isEmpty() || $this->_atBeginning()) {
118
+				return false;
119
+			}
120
+			$this->_position--;
121
+			return true;
122
+		}
123
+
124
+		/**
125
+		 *    Step forward one place. If already at the
126
+		 *    latest entry then nothing will happen.
127
+		 *    @return boolean     True if any future entries.
128
+		 *    @access public
129
+		 */
130
+		function forward() {
131
+			if ($this->_isEmpty() || $this->_atEnd()) {
132
+				return false;
133
+			}
134
+			$this->_position++;
135
+			return true;
136
+		}
137
+
138
+		/**
139
+		 *    Ditches all future entries beyond the current
140
+		 *    point.
141
+		 *    @access private
142
+		 */
143
+		function _dropFuture() {
144
+			if ($this->_isEmpty()) {
145
+				return;
146
+			}
147
+			while (! $this->_atEnd()) {
148
+				array_pop($this->_sequence);
149
+			}
150
+		}
151
+	}
152
+
153
+	/**
154
+	 *    Simulated web browser. This is an aggregate of
155
+	 *    the user agent, the HTML parsing, request history
156
+	 *    and the last header set.
157 157
 	 *    @package SimpleTest
158 158
 	 *    @subpackage WebTester
159
-     */
160
-    class SimpleBrowser {
161
-        protected $_user_agent;
162
-        protected $_page;
163
-        protected $_history;
164
-        protected $_ignore_frames;
165
-        protected $_maximum_nested_frames;
166
-
167
-        /**
168
-         *    Starts with a fresh browser with no
169
-         *    cookie or any other state information. The
170
-         *    exception is that a default proxy will be
171
-         *    set up if specified in the options.
172
-         *    @access public
173
-         */
174
-        function SimpleBrowser() {
175
-            $this->_user_agent = $this->_createUserAgent();
176
-            $this->_user_agent->useProxy(
177
-                    SimpleTest::getDefaultProxy(),
178
-                    SimpleTest::getDefaultProxyUsername(),
179
-                    SimpleTest::getDefaultProxyPassword());
180
-            $this->_page = new SimplePage();
181
-            $this->_history = $this->_createHistory();
182
-            $this->_ignore_frames = false;
183
-            $this->_maximum_nested_frames = DEFAULT_MAX_NESTED_FRAMES;
184
-        }
185
-
186
-        /**
187
-         *    Creates the underlying user agent.
188
-         *    @return SimpleFetcher    Content fetcher.
189
-         *    @access protected
190
-         */
191
-        function &_createUserAgent() {
192
-            $user_agent = new SimpleUserAgent();
193
-            return $user_agent;
194
-        }
195
-
196
-        /**
197
-         *    Creates a new empty history list.
198
-         *    @return SimpleBrowserHistory    New list.
199
-         *    @access protected
200
-         */
201
-        function &_createHistory() {
202
-            $history = new SimpleBrowserHistory();
203
-            return $history;
204
-        }
205
-
206
-        /**
207
-         *    Disables frames support. Frames will not be fetched
208
-         *    and the frameset page will be used instead.
209
-         *    @access public
210
-         */
211
-        function ignoreFrames() {
212
-            $this->_ignore_frames = true;
213
-        }
214
-
215
-        /**
216
-         *    Enables frames support. Frames will be fetched from
217
-         *    now on.
218
-         *    @access public
219
-         */
220
-        function useFrames() {
221
-            $this->_ignore_frames = false;
222
-        }
223
-
224
-        /**
225
-         *    Switches off cookie sending and recieving.
226
-         *    @access public
227
-         */
228
-        function ignoreCookies() {
229
-            $this->_user_agent->ignoreCookies();
230
-        }
231
-
232
-        /**
233
-         *    Switches back on the cookie sending and recieving.
234
-         *    @access public
235
-         */
236
-        function useCookies() {
237
-            $this->_user_agent->useCookies();
238
-        }
239
-
240
-        /**
241
-         *    Parses the raw content into a page. Will load further
242
-         *    frame pages unless frames are disabled.
243
-         *    @param SimpleHttpResponse $response    Response from fetch.
244
-         *    @param integer $depth                  Nested frameset depth.
245
-         *    @return SimplePage                     Parsed HTML.
246
-         *    @access private
247
-         */
248
-        function &_parse($response, $depth = 0) {
249
-            $page = $this->_buildPage($response);
250
-            if ($this->_ignore_frames || ! $page->hasFrames() || ($depth > $this->_maximum_nested_frames)) {
251
-                return $page;
252
-            }
253
-            $frameset = new SimpleFrameset($page);
254
-            foreach ($page->getFrameset() as $key => $url) {
255
-                $frame = $this->_fetch($url, new SimpleGetEncoding(), $depth + 1);
256
-                $frameset->addFrame($frame, $key);
257
-            }
258
-            return $frameset;
259
-        }
260
-
261
-        /**
262
-         *    Assembles the parsing machinery and actually parses
263
-         *    a single page. Frees all of the builder memory and so
264
-         *    unjams the PHP memory management.
265
-         *    @param SimpleHttpResponse $response    Response from fetch.
266
-         *    @return SimplePage                     Parsed top level page.
267
-         *    @access protected
268
-         */
269
-        function &_buildPage($response) {
270
-            $builder = new SimplePageBuilder();
271
-            $page = $builder->parse($response);
272
-            $builder->free();
273
-            unset($builder);
274
-            return $page;
275
-        }
276
-
277
-        /**
278
-         *    Fetches a page. Jointly recursive with the _parse()
279
-         *    method as it descends a frameset.
280
-         *    @param string/SimpleUrl $url          Target to fetch.
281
-         *    @param SimpleEncoding $encoding       GET/POST parameters.
282
-         *    @param integer $depth                 Nested frameset depth protection.
283
-         *    @return SimplePage                    Parsed page.
284
-         *    @access private
285
-         */
286
-        function &_fetch($url, $encoding, $depth = 0) {
287
-            $response = $this->_user_agent->fetchResponse($url, $encoding);
288
-            if ($response->isError()) {
289
-                $page = new SimplePage($response);
290
-            } else {
291
-                $page = $this->_parse($response, $depth);
292
-            }
293
-            return $page;
294
-        }
295
-
296
-        /**
297
-         *    Fetches a page or a single frame if that is the current
298
-         *    focus.
299
-         *    @param SimpleUrl $url                   Target to fetch.
300
-         *    @param SimpleEncoding $parameters       GET/POST parameters.
301
-         *    @return string                          Raw content of page.
302
-         *    @access private
303
-         */
304
-        function _load($url, $parameters) {
305
-            $frame = $url->getTarget();
306
-            if (! $frame || ! $this->_page->hasFrames() || (strtolower($frame) == '_top')) {
307
-                return $this->_loadPage($url, $parameters);
308
-            }
309
-            return $this->_loadFrame(array($frame), $url, $parameters);
310
-        }
311
-
312
-        /**
313
-         *    Fetches a page and makes it the current page/frame.
314
-         *    @param string/SimpleUrl $url            Target to fetch as string.
315
-         *    @param SimplePostEncoding $parameters   POST parameters.
316
-         *    @return string                          Raw content of page.
317
-         *    @access private
318
-         */
319
-        function _loadPage($url, $parameters) {
320
-            $this->_page = $this->_fetch($url, $parameters);
321
-            $this->_history->recordEntry(
322
-                    $this->_page->getUrl(),
323
-                    $this->_page->getRequestData());
324
-            return $this->_page->getRaw();
325
-        }
326
-
327
-        /**
328
-         *    Fetches a frame into the existing frameset replacing the
329
-         *    original.
330
-         *    @param array $frames                    List of names to drill down.
331
-         *    @param string/SimpleUrl $url            Target to fetch as string.
332
-         *    @param SimpleFormEncoding $parameters   POST parameters.
333
-         *    @return string                          Raw content of page.
334
-         *    @access private
335
-         */
336
-        function _loadFrame($frames, $url, $parameters) {
337
-            $page = $this->_fetch($url, $parameters);
338
-            $this->_page->setFrame($frames, $page);
339
-        }
340
-
341
-        /**
342
-         *    Removes expired and temporary cookies as if
343
-         *    the browser was closed and re-opened.
344
-         *    @param string/integer $date   Time when session restarted.
345
-         *                                  If omitted then all persistent
346
-         *                                  cookies are kept.
347
-         *    @access public
348
-         */
349
-        function restart($date = false) {
350
-            $this->_user_agent->restart($date);
351
-        }
352
-
353
-        /**
354
-         *    Adds a header to every fetch.
355
-         *    @param string $header       Header line to add to every
356
-         *                                request until cleared.
357
-         *    @access public
358
-         */
359
-        function addHeader($header) {
360
-            $this->_user_agent->addHeader($header);
361
-        }
362
-
363
-        /**
364
-         *    Ages the cookies by the specified time.
365
-         *    @param integer $interval    Amount in seconds.
366
-         *    @access public
367
-         */
368
-        function ageCookies($interval) {
369
-            $this->_user_agent->ageCookies($interval);
370
-        }
371
-
372
-        /**
373
-         *    Sets an additional cookie. If a cookie has
374
-         *    the same name and path it is replaced.
375
-         *    @param string $name       Cookie key.
376
-         *    @param string $value      Value of cookie.
377
-         *    @param string $host       Host upon which the cookie is valid.
378
-         *    @param string $path       Cookie path if not host wide.
379
-         *    @param string $expiry     Expiry date.
380
-         *    @access public
381
-         */
382
-        function setCookie($name, $value, $host = false, $path = '/', $expiry = false) {
383
-            $this->_user_agent->setCookie($name, $value, $host, $path, $expiry);
384
-        }
385
-
386
-        /**
387
-         *    Reads the most specific cookie value from the
388
-         *    browser cookies.
389
-         *    @param string $host        Host to search.
390
-         *    @param string $path        Applicable path.
391
-         *    @param string $name        Name of cookie to read.
392
-         *    @return string             False if not present, else the
393
-         *                               value as a string.
394
-         *    @access public
395
-         */
396
-        function getCookieValue($host, $path, $name) {
397
-            return $this->_user_agent->getCookieValue($host, $path, $name);
398
-        }
399
-
400
-        /**
401
-         *    Reads the current cookies for the current URL.
402
-         *    @param string $name   Key of cookie to find.
403
-         *    @return string        Null if there is no current URL, false
404
-         *                          if the cookie is not set.
405
-         *    @access public
406
-         */
407
-        function getCurrentCookieValue($name) {
408
-            return $this->_user_agent->getBaseCookieValue($name, $this->_page->getUrl());
409
-        }
410
-
411
-        /**
412
-         *    Sets the maximum number of redirects before
413
-         *    a page will be loaded anyway.
414
-         *    @param integer $max        Most hops allowed.
415
-         *    @access public
416
-         */
417
-        function setMaximumRedirects($max) {
418
-            $this->_user_agent->setMaximumRedirects($max);
419
-        }
420
-
421
-        /**
422
-         *    Sets the maximum number of nesting of framed pages
423
-         *    within a framed page to prevent loops.
424
-         *    @param integer $max        Highest depth allowed.
425
-         *    @access public
426
-         */
427
-        function setMaximumNestedFrames($max) {
428
-            $this->_maximum_nested_frames = $max;
429
-        }
430
-
431
-        /**
432
-         *    Sets the socket timeout for opening a connection.
433
-         *    @param integer $timeout      Maximum time in seconds.
434
-         *    @access public
435
-         */
436
-        function setConnectionTimeout($timeout) {
437
-            $this->_user_agent->setConnectionTimeout($timeout);
438
-        }
439
-
440
-        /**
441
-         *    Sets proxy to use on all requests for when
442
-         *    testing from behind a firewall. Set URL
443
-         *    to false to disable.
444
-         *    @param string $proxy        Proxy URL.
445
-         *    @param string $username     Proxy username for authentication.
446
-         *    @param string $password     Proxy password for authentication.
447
-         *    @access public
448
-         */
449
-        function useProxy($proxy, $username = false, $password = false) {
450
-            $this->_user_agent->useProxy($proxy, $username, $password);
451
-        }
452
-
453
-        /**
454
-         *    Fetches the page content with a HEAD request.
455
-         *    Will affect cookies, but will not change the base URL.
456
-         *    @param string/SimpleUrl $url                Target to fetch as string.
457
-         *    @param hash/SimpleHeadEncoding $parameters  Additional parameters for
458
-         *                                                HEAD request.
459
-         *    @return boolean                             True if successful.
460
-         *    @access public
461
-         */
462
-        function head($url, $parameters = false) {
463
-            if (! is_object($url)) {
464
-                $url = new SimpleUrl($url);
465
-            }
466
-            if ($this->getUrl()) {
467
-                $url = $url->makeAbsolute($this->getUrl());
468
-            }
469
-            $response = $this->_user_agent->fetchResponse($url, new SimpleHeadEncoding($parameters));
470
-            return ! $response->isError();
471
-        }
472
-
473
-        /**
474
-         *    Fetches the page content with a simple GET request.
475
-         *    @param string/SimpleUrl $url                Target to fetch.
476
-         *    @param hash/SimpleFormEncoding $parameters  Additional parameters for
477
-         *                                                GET request.
478
-         *    @return string                              Content of page or false.
479
-         *    @access public
480
-         */
481
-        function get($url, $parameters = false) {
482
-            if (! is_object($url)) {
483
-                $url = new SimpleUrl($url);
484
-            }
485
-            if ($this->getUrl()) {
486
-                $url = $url->makeAbsolute($this->getUrl());
487
-            }
488
-            return $this->_load($url, new SimpleGetEncoding($parameters));
489
-        }
490
-
491
-        /**
492
-         *    Fetches the page content with a POST request.
493
-         *    @param string/SimpleUrl $url                Target to fetch as string.
494
-         *    @param hash/SimpleFormEncoding $parameters  POST parameters.
495
-         *    @return string                              Content of page.
496
-         *    @access public
497
-         */
498
-        function post($url, $parameters = false) {
499
-            if (! is_object($url)) {
500
-                $url = new SimpleUrl($url);
501
-            }
502
-            if ($this->getUrl()) {
503
-                $url = $url->makeAbsolute($this->getUrl());
504
-            }
505
-            return $this->_load($url, new SimplePostEncoding($parameters));
506
-        }
507
-
508
-        /**
509
-         *    Equivalent to hitting the retry button on the
510
-         *    browser. Will attempt to repeat the page fetch. If
511
-         *    there is no history to repeat it will give false.
512
-         *    @return string/boolean   Content if fetch succeeded
513
-         *                             else false.
514
-         *    @access public
515
-         */
516
-        function retry() {
517
-            $frames = $this->_page->getFrameFocus();
518
-            if (count($frames) > 0) {
519
-                $this->_loadFrame(
520
-                        $frames,
521
-                        $this->_page->getUrl(),
522
-                        $this->_page->getRequestData());
523
-                return $this->_page->getRaw();
524
-            }
525
-            if ($url = $this->_history->getUrl()) {
526
-                $this->_page = $this->_fetch($url, $this->_history->getParameters());
527
-                return $this->_page->getRaw();
528
-            }
529
-            return false;
530
-        }
531
-
532
-        /**
533
-         *    Equivalent to hitting the back button on the
534
-         *    browser. The browser history is unchanged on
535
-         *    failure. The page content is refetched as there
536
-         *    is no concept of content caching in SimpleTest.
537
-         *    @return boolean     True if history entry and
538
-         *                        fetch succeeded
539
-         *    @access public
540
-         */
541
-        function back() {
542
-            if (! $this->_history->back()) {
543
-                return false;
544
-            }
545
-            $content = $this->retry();
546
-            if (! $content) {
547
-                $this->_history->forward();
548
-            }
549
-            return $content;
550
-        }
551
-
552
-        /**
553
-         *    Equivalent to hitting the forward button on the
554
-         *    browser. The browser history is unchanged on
555
-         *    failure. The page content is refetched as there
556
-         *    is no concept of content caching in SimpleTest.
557
-         *    @return boolean     True if history entry and
558
-         *                        fetch succeeded
559
-         *    @access public
560
-         */
561
-        function forward() {
562
-            if (! $this->_history->forward()) {
563
-                return false;
564
-            }
565
-            $content = $this->retry();
566
-            if (! $content) {
567
-                $this->_history->back();
568
-            }
569
-            return $content;
570
-        }
571
-
572
-        /**
573
-         *    Retries a request after setting the authentication
574
-         *    for the current realm.
575
-         *    @param string $username    Username for realm.
576
-         *    @param string $password    Password for realm.
577
-         *    @return boolean            True if successful fetch. Note
578
-         *                               that authentication may still have
579
-         *                               failed.
580
-         *    @access public
581
-         */
582
-        function authenticate($username, $password) {
583
-            if (! $this->_page->getRealm()) {
584
-                return false;
585
-            }
586
-            $url = $this->_page->getUrl();
587
-            if (! $url) {
588
-                return false;
589
-            }
590
-            $this->_user_agent->setIdentity(
591
-                    $url->getHost(),
592
-                    $this->_page->getRealm(),
593
-                    $username,
594
-                    $password);
595
-            return $this->retry();
596
-        }
597
-
598
-        /**
599
-         *    Accessor for a breakdown of the frameset.
600
-         *    @return array   Hash tree of frames by name
601
-         *                    or index if no name.
602
-         *    @access public
603
-         */
604
-        function getFrames() {
605
-            return $this->_page->getFrames();
606
-        }
607
-
608
-        /**
609
-         *    Accessor for current frame focus. Will be
610
-         *    false if no frame has focus.
611
-         *    @return integer/string/boolean    Label if any, otherwise
612
-         *                                      the position in the frameset
613
-         *                                      or false if none.
614
-         *    @access public
615
-         */
616
-        function getFrameFocus() {
617
-            return $this->_page->getFrameFocus();
618
-        }
619
-
620
-        /**
621
-         *    Sets the focus by index. The integer index starts from 1.
622
-         *    @param integer $choice    Chosen frame.
623
-         *    @return boolean           True if frame exists.
624
-         *    @access public
625
-         */
626
-        function setFrameFocusByIndex($choice) {
627
-            return $this->_page->setFrameFocusByIndex($choice);
628
-        }
629
-
630
-        /**
631
-         *    Sets the focus by name.
632
-         *    @param string $name    Chosen frame.
633
-         *    @return boolean        True if frame exists.
634
-         *    @access public
635
-         */
636
-        function setFrameFocus($name) {
637
-            return $this->_page->setFrameFocus($name);
638
-        }
639
-
640
-        /**
641
-         *    Clears the frame focus. All frames will be searched
642
-         *    for content.
643
-         *    @access public
644
-         */
645
-        function clearFrameFocus() {
646
-            return $this->_page->clearFrameFocus();
647
-        }
648
-
649
-        /**
650
-         *    Accessor for last error.
651
-         *    @return string        Error from last response.
652
-         *    @access public
653
-         */
654
-        function getTransportError() {
655
-            return $this->_page->getTransportError();
656
-        }
657
-
658
-        /**
659
-         *    Accessor for current MIME type.
660
-         *    @return string    MIME type as string; e.g. 'text/html'
661
-         *    @access public
662
-         */
663
-        function getMimeType() {
664
-            return $this->_page->getMimeType();
665
-        }
666
-
667
-        /**
668
-         *    Accessor for last response code.
669
-         *    @return integer    Last HTTP response code received.
670
-         *    @access public
671
-         */
672
-        function getResponseCode() {
673
-            return $this->_page->getResponseCode();
674
-        }
675
-
676
-        /**
677
-         *    Accessor for last Authentication type. Only valid
678
-         *    straight after a challenge (401).
679
-         *    @return string    Description of challenge type.
680
-         *    @access public
681
-         */
682
-        function getAuthentication() {
683
-            return $this->_page->getAuthentication();
684
-        }
685
-
686
-        /**
687
-         *    Accessor for last Authentication realm. Only valid
688
-         *    straight after a challenge (401).
689
-         *    @return string    Name of security realm.
690
-         *    @access public
691
-         */
692
-        function getRealm() {
693
-            return $this->_page->getRealm();
694
-        }
695
-
696
-        /**
697
-         *    Accessor for current URL of page or frame if
698
-         *    focused.
699
-         *    @return string    Location of current page or frame as
700
-         *                      a string.
701
-         */
702
-        function getUrl() {
703
-            $url = $this->_page->getUrl();
704
-            return $url ? $url->asString() : false;
705
-        }
706
-
707
-        /**
708
-         *    Accessor for raw bytes sent down the wire.
709
-         *    @return string      Original text sent.
710
-         *    @access public
711
-         */
712
-        function getRequest() {
713
-            return $this->_page->getRequest();
714
-        }
715
-
716
-        /**
717
-         *    Accessor for raw header information.
718
-         *    @return string      Header block.
719
-         *    @access public
720
-         */
721
-        function getHeaders() {
722
-            return $this->_page->getHeaders();
723
-        }
724
-
725
-        /**
726
-         *    Accessor for raw page information.
727
-         *    @return string      Original text content of web page.
728
-         *    @access public
729
-         */
730
-        function getContent() {
731
-            return $this->_page->getRaw();
732
-        }
733
-
734
-        /**
735
-         *    Accessor for plain text version of the page.
736
-         *    @return string      Normalised text representation.
737
-         *    @access public
738
-         */
739
-        function getContentAsText() {
740
-            return $this->_page->getText();
741
-        }
742
-
743
-        /**
744
-         *    Accessor for parsed title.
745
-         *    @return string     Title or false if no title is present.
746
-         *    @access public
747
-         */
748
-        function getTitle() {
749
-            return $this->_page->getTitle();
750
-        }
751
-
752
-        /**
753
-         *    Accessor for a list of all fixed links in current page.
754
-         *    @return array   List of urls with scheme of
755
-         *                    http or https and hostname.
756
-         *    @access public
757
-         */
758
-        function getAbsoluteUrls() {
759
-            return $this->_page->getAbsoluteUrls();
760
-        }
761
-
762
-        /**
763
-         *    Accessor for a list of all relative links.
764
-         *    @return array      List of urls without hostname.
765
-         *    @access public
766
-         */
767
-        function getRelativeUrls() {
768
-            return $this->_page->getRelativeUrls();
769
-        }
770
-
771
-        /**
772
-         *    Sets all form fields with that name.
773
-         *    @param string $label   Name or label of field in forms.
774
-         *    @param string $value   New value of field.
775
-         *    @return boolean        True if field exists, otherwise false.
776
-         *    @access public
777
-         */
778
-        function setField($label, $value) {
779
-            return $this->_page->setField(new SimpleByLabelOrName($label), $value);
780
-        }
781
-
782
-        /**
783
-         *    Sets all form fields with that name. Will use label if
784
-         *    one is available (not yet implemented).
785
-         *    @param string $name    Name of field in forms.
786
-         *    @param string $value   New value of field.
787
-         *    @return boolean        True if field exists, otherwise false.
788
-         *    @access public
789
-         */
790
-        function setFieldByName($name, $value) {
791
-            return $this->_page->setField(new SimpleByName($name), $value);
792
-        }
793
-
794
-        /**
795
-         *    Sets all form fields with that id attribute.
796
-         *    @param string/integer $id   Id of field in forms.
797
-         *    @param string $value        New value of field.
798
-         *    @return boolean             True if field exists, otherwise false.
799
-         *    @access public
800
-         */
801
-        function setFieldById($id, $value) {
802
-            return $this->_page->setField(new SimpleById($id), $value);
803
-        }
804
-
805
-        /**
806
-         *    Accessor for a form element value within the page.
807
-         *    Finds the first match.
808
-         *    @param string $label       Field label.
809
-         *    @return string/boolean     A value if the field is
810
-         *                               present, false if unchecked
811
-         *                               and null if missing.
812
-         *    @access public
813
-         */
814
-        function getField($label) {
815
-            return $this->_page->getField(new SimpleByLabelOrName($label));
816
-        }
817
-
818
-        /**
819
-         *    Accessor for a form element value within the page.
820
-         *    Finds the first match.
821
-         *    @param string $name        Field name.
822
-         *    @return string/boolean     A string if the field is
823
-         *                               present, false if unchecked
824
-         *                               and null if missing.
825
-         *    @access public
826
-         */
827
-        function getFieldByName($name) {
828
-            return $this->_page->getField(new SimpleByName($name));
829
-        }
830
-
831
-        /**
832
-         *    Accessor for a form element value within the page.
833
-         *    @param string/integer $id  Id of field in forms.
834
-         *    @return string/boolean     A string if the field is
835
-         *                               present, false if unchecked
836
-         *                               and null if missing.
837
-         *    @access public
838
-         */
839
-        function getFieldById($id) {
840
-            return $this->_page->getField(new SimpleById($id));
841
-        }
842
-
843
-        /**
844
-         *    Clicks the submit button by label. The owning
845
-         *    form will be submitted by this.
846
-         *    @param string $label    Button label. An unlabeled
847
-         *                            button can be triggered by 'Submit'.
848
-         *    @param hash $additional Additional form data.
849
-         *    @return string/boolean  Page on success.
850
-         *    @access public
851
-         */
852
-        function clickSubmit($label = 'Submit', $additional = false) {
853
-            if (! ($form = $this->_page->getFormBySubmit(new SimpleByLabel($label)))) {
854
-                return false;
855
-            }
856
-            $success = $this->_load(
857
-                    $form->getAction(),
858
-                    $form->submitButton(new SimpleByLabel($label), $additional));
859
-            return ($success ? $this->getContent() : $success);
860
-        }
861
-
862
-        /**
863
-         *    Clicks the submit button by name attribute. The owning
864
-         *    form will be submitted by this.
865
-         *    @param string $name     Button name.
866
-         *    @param hash $additional Additional form data.
867
-         *    @return string/boolean  Page on success.
868
-         *    @access public
869
-         */
870
-        function clickSubmitByName($name, $additional = false) {
871
-            if (! ($form = $this->_page->getFormBySubmit(new SimpleByName($name)))) {
872
-                return false;
873
-            }
874
-            $success = $this->_load(
875
-                    $form->getAction(),
876
-                    $form->submitButton(new SimpleByName($name), $additional));
877
-            return ($success ? $this->getContent() : $success);
878
-        }
879
-
880
-        /**
881
-         *    Clicks the submit button by ID attribute of the button
882
-         *    itself. The owning form will be submitted by this.
883
-         *    @param string $id       Button ID.
884
-         *    @param hash $additional Additional form data.
885
-         *    @return string/boolean  Page on success.
886
-         *    @access public
887
-         */
888
-        function clickSubmitById($id, $additional = false) {
889
-            if (! ($form = $this->_page->getFormBySubmit(new SimpleById($id)))) {
890
-                return false;
891
-            }
892
-            $success = $this->_load(
893
-                    $form->getAction(),
894
-                    $form->submitButton(new SimpleById($id), $additional));
895
-            return ($success ? $this->getContent() : $success);
896
-        }
897
-
898
-        /**
899
-         *    Clicks the submit image by some kind of label. Usually
900
-         *    the alt tag or the nearest equivalent. The owning
901
-         *    form will be submitted by this. Clicking outside of
902
-         *    the boundary of the coordinates will result in
903
-         *    a failure.
904
-         *    @param string $label    ID attribute of button.
905
-         *    @param integer $x       X-coordinate of imaginary click.
906
-         *    @param integer $y       Y-coordinate of imaginary click.
907
-         *    @param hash $additional Additional form data.
908
-         *    @return string/boolean  Page on success.
909
-         *    @access public
910
-         */
911
-        function clickImage($label, $x = 1, $y = 1, $additional = false) {
912
-            if (! ($form = $this->_page->getFormByImage(new SimpleByLabel($label)))) {
913
-                return false;
914
-            }
915
-            $success = $this->_load(
916
-                    $form->getAction(),
917
-                    $form->submitImage(new SimpleByLabel($label), $x, $y, $additional));
918
-            return ($success ? $this->getContent() : $success);
919
-        }
920
-
921
-        /**
922
-         *    Clicks the submit image by the name. Usually
923
-         *    the alt tag or the nearest equivalent. The owning
924
-         *    form will be submitted by this. Clicking outside of
925
-         *    the boundary of the coordinates will result in
926
-         *    a failure.
927
-         *    @param string $name     Name attribute of button.
928
-         *    @param integer $x       X-coordinate of imaginary click.
929
-         *    @param integer $y       Y-coordinate of imaginary click.
930
-         *    @param hash $additional Additional form data.
931
-         *    @return string/boolean  Page on success.
932
-         *    @access public
933
-         */
934
-        function clickImageByName($name, $x = 1, $y = 1, $additional = false) {
935
-            if (! ($form = $this->_page->getFormByImage(new SimpleByName($name)))) {
936
-                return false;
937
-            }
938
-            $success = $this->_load(
939
-                    $form->getAction(),
940
-                    $form->submitImage(new SimpleByName($name), $x, $y, $additional));
941
-            return ($success ? $this->getContent() : $success);
942
-        }
943
-
944
-        /**
945
-         *    Clicks the submit image by ID attribute. The owning
946
-         *    form will be submitted by this. Clicking outside of
947
-         *    the boundary of the coordinates will result in
948
-         *    a failure.
949
-         *    @param integer/string $id    ID attribute of button.
950
-         *    @param integer $x            X-coordinate of imaginary click.
951
-         *    @param integer $y            Y-coordinate of imaginary click.
952
-         *    @param hash $additional      Additional form data.
953
-         *    @return string/boolean       Page on success.
954
-         *    @access public
955
-         */
956
-        function clickImageById($id, $x = 1, $y = 1, $additional = false) {
957
-            if (! ($form = $this->_page->getFormByImage(new SimpleById($id)))) {
958
-                return false;
959
-            }
960
-            $success = $this->_load(
961
-                    $form->getAction(),
962
-                    $form->submitImage(new SimpleById($id), $x, $y, $additional));
963
-            return ($success ? $this->getContent() : $success);
964
-        }
965
-
966
-        /**
967
-         *    Submits a form by the ID.
968
-         *    @param string $id       The form ID. No submit button value
969
-         *                            will be sent.
970
-         *    @return string/boolean  Page on success.
971
-         *    @access public
972
-         */
973
-        function submitFormById($id) {
974
-            if (! ($form = $this->_page->getFormById($id))) {
975
-                return false;
976
-            }
977
-            $success = $this->_load(
978
-                    $form->getAction(),
979
-                    $form->submit());
980
-            return ($success ? $this->getContent() : $success);
981
-        }
982
-
983
-        /**
984
-         *    Follows a link by label. Will click the first link
985
-         *    found with this link text by default, or a later
986
-         *    one if an index is given. The match ignores case and
987
-         *    white space issues.
988
-         *    @param string $label     Text between the anchor tags.
989
-         *    @param integer $index    Link position counting from zero.
990
-         *    @return string/boolean   Page on success.
991
-         *    @access public
992
-         */
993
-        function clickLink($label, $index = 0) {
994
-            $urls = $this->_page->getUrlsByLabel($label);
995
-            if (count($urls) == 0) {
996
-                return false;
997
-            }
998
-            if (count($urls) < $index + 1) {
999
-                return false;
1000
-            }
1001
-            $this->_load($urls[$index], new SimpleGetEncoding());
1002
-            return $this->getContent();
1003
-        }
1004
-
1005
-        /**
1006
-         *    Tests to see if a link is present by label.
1007
-         *    @param string $label     Text of value attribute.
1008
-         *    @return boolean          True if link present.
1009
-         *    @access public
1010
-         */
1011
-        function isLink($label) {
1012
-            return (count($this->_page->getUrlsByLabel($label)) > 0);
1013
-        }
1014
-
1015
-        /**
1016
-         *    Follows a link by id attribute.
1017
-         *    @param string $id        ID attribute value.
1018
-         *    @return string/boolean   Page on success.
1019
-         *    @access public
1020
-         */
1021
-        function clickLinkById($id) {
1022
-            if (! ($url = $this->_page->getUrlById($id))) {
1023
-                return false;
1024
-            }
1025
-            $this->_load($url, new SimpleGetEncoding());
1026
-            return $this->getContent();
1027
-        }
1028
-
1029
-        /**
1030
-         *    Tests to see if a link is present by ID attribute.
1031
-         *    @param string $id     Text of id attribute.
1032
-         *    @return boolean       True if link present.
1033
-         *    @access public
1034
-         */
1035
-        function isLinkById($id) {
1036
-            return (boolean)$this->_page->getUrlById($id);
1037
-        }
1038
-
1039
-        /**
1040
-         *    Clicks a visible text item. Will first try buttons,
1041
-         *    then links and then images.
1042
-         *    @param string $label        Visible text or alt text.
1043
-         *    @return string/boolean      Raw page or false.
1044
-         *    @access public
1045
-         */
1046
-        function click($label) {
1047
-            $raw = $this->clickSubmit($label);
1048
-            if (! $raw) {
1049
-                $raw = $this->clickLink($label);
1050
-            }
1051
-            if (! $raw) {
1052
-                $raw = $this->clickImage($label);
1053
-            }
1054
-            return $raw;
1055
-        }
1056
-    }
1057 159
\ No newline at end of file
160
+	 */
161
+	class SimpleBrowser {
162
+		protected $_user_agent;
163
+		protected $_page;
164
+		protected $_history;
165
+		protected $_ignore_frames;
166
+		protected $_maximum_nested_frames;
167
+
168
+		/**
169
+		 *    Starts with a fresh browser with no
170
+		 *    cookie or any other state information. The
171
+		 *    exception is that a default proxy will be
172
+		 *    set up if specified in the options.
173
+		 *    @access public
174
+		 */
175
+		function SimpleBrowser() {
176
+			$this->_user_agent = $this->_createUserAgent();
177
+			$this->_user_agent->useProxy(
178
+					SimpleTest::getDefaultProxy(),
179
+					SimpleTest::getDefaultProxyUsername(),
180
+					SimpleTest::getDefaultProxyPassword());
181
+			$this->_page = new SimplePage();
182
+			$this->_history = $this->_createHistory();
183
+			$this->_ignore_frames = false;
184
+			$this->_maximum_nested_frames = DEFAULT_MAX_NESTED_FRAMES;
185
+		}
186
+
187
+		/**
188
+		 *    Creates the underlying user agent.
189
+		 *    @return SimpleFetcher    Content fetcher.
190
+		 *    @access protected
191
+		 */
192
+		function &_createUserAgent() {
193
+			$user_agent = new SimpleUserAgent();
194
+			return $user_agent;
195
+		}
196
+
197
+		/**
198
+		 *    Creates a new empty history list.
199
+		 *    @return SimpleBrowserHistory    New list.
200
+		 *    @access protected
201
+		 */
202
+		function &_createHistory() {
203
+			$history = new SimpleBrowserHistory();
204
+			return $history;
205
+		}
206
+
207
+		/**
208
+		 *    Disables frames support. Frames will not be fetched
209
+		 *    and the frameset page will be used instead.
210
+		 *    @access public
211
+		 */
212
+		function ignoreFrames() {
213
+			$this->_ignore_frames = true;
214
+		}
215
+
216
+		/**
217
+		 *    Enables frames support. Frames will be fetched from
218
+		 *    now on.
219
+		 *    @access public
220
+		 */
221
+		function useFrames() {
222
+			$this->_ignore_frames = false;
223
+		}
224
+
225
+		/**
226
+		 *    Switches off cookie sending and recieving.
227
+		 *    @access public
228
+		 */
229
+		function ignoreCookies() {
230
+			$this->_user_agent->ignoreCookies();
231
+		}
232
+
233
+		/**
234
+		 *    Switches back on the cookie sending and recieving.
235
+		 *    @access public
236
+		 */
237
+		function useCookies() {
238
+			$this->_user_agent->useCookies();
239
+		}
240
+
241
+		/**
242
+		 *    Parses the raw content into a page. Will load further
243
+		 *    frame pages unless frames are disabled.
244
+		 *    @param SimpleHttpResponse $response    Response from fetch.
245
+		 *    @param integer $depth                  Nested frameset depth.
246
+		 *    @return SimplePage                     Parsed HTML.
247
+		 *    @access private
248
+		 */
249
+		function &_parse($response, $depth = 0) {
250
+			$page = $this->_buildPage($response);
251
+			if ($this->_ignore_frames || ! $page->hasFrames() || ($depth > $this->_maximum_nested_frames)) {
252
+				return $page;
253
+			}
254
+			$frameset = new SimpleFrameset($page);
255
+			foreach ($page->getFrameset() as $key => $url) {
256
+				$frame = $this->_fetch($url, new SimpleGetEncoding(), $depth + 1);
257
+				$frameset->addFrame($frame, $key);
258
+			}
259
+			return $frameset;
260
+		}
261
+
262
+		/**
263
+		 *    Assembles the parsing machinery and actually parses
264
+		 *    a single page. Frees all of the builder memory and so
265
+		 *    unjams the PHP memory management.
266
+		 *    @param SimpleHttpResponse $response    Response from fetch.
267
+		 *    @return SimplePage                     Parsed top level page.
268
+		 *    @access protected
269
+		 */
270
+		function &_buildPage($response) {
271
+			$builder = new SimplePageBuilder();
272
+			$page = $builder->parse($response);
273
+			$builder->free();
274
+			unset($builder);
275
+			return $page;
276
+		}
277
+
278
+		/**
279
+		 *    Fetches a page. Jointly recursive with the _parse()
280
+		 *    method as it descends a frameset.
281
+		 *    @param string/SimpleUrl $url          Target to fetch.
282
+		 *    @param SimpleEncoding $encoding       GET/POST parameters.
283
+		 *    @param integer $depth                 Nested frameset depth protection.
284
+		 *    @return SimplePage                    Parsed page.
285
+		 *    @access private
286
+		 */
287
+		function &_fetch($url, $encoding, $depth = 0) {
288
+			$response = $this->_user_agent->fetchResponse($url, $encoding);
289
+			if ($response->isError()) {
290
+				$page = new SimplePage($response);
291
+			} else {
292
+				$page = $this->_parse($response, $depth);
293
+			}
294
+			return $page;
295
+		}
296
+
297
+		/**
298
+		 *    Fetches a page or a single frame if that is the current
299
+		 *    focus.
300
+		 *    @param SimpleUrl $url                   Target to fetch.
301
+		 *    @param SimpleEncoding $parameters       GET/POST parameters.
302
+		 *    @return string                          Raw content of page.
303
+		 *    @access private
304
+		 */
305
+		function _load($url, $parameters) {
306
+			$frame = $url->getTarget();
307
+			if (! $frame || ! $this->_page->hasFrames() || (strtolower($frame) == '_top')) {
308
+				return $this->_loadPage($url, $parameters);
309
+			}
310
+			return $this->_loadFrame(array($frame), $url, $parameters);
311
+		}
312
+
313
+		/**
314
+		 *    Fetches a page and makes it the current page/frame.
315
+		 *    @param string/SimpleUrl $url            Target to fetch as string.
316
+		 *    @param SimplePostEncoding $parameters   POST parameters.
317
+		 *    @return string                          Raw content of page.
318
+		 *    @access private
319
+		 */
320
+		function _loadPage($url, $parameters) {
321
+			$this->_page = $this->_fetch($url, $parameters);
322
+			$this->_history->recordEntry(
323
+					$this->_page->getUrl(),
324
+					$this->_page->getRequestData());
325
+			return $this->_page->getRaw();
326
+		}
327
+
328
+		/**
329
+		 *    Fetches a frame into the existing frameset replacing the
330
+		 *    original.
331
+		 *    @param array $frames                    List of names to drill down.
332
+		 *    @param string/SimpleUrl $url            Target to fetch as string.
333
+		 *    @param SimpleFormEncoding $parameters   POST parameters.
334
+		 *    @return string                          Raw content of page.
335
+		 *    @access private
336
+		 */
337
+		function _loadFrame($frames, $url, $parameters) {
338
+			$page = $this->_fetch($url, $parameters);
339
+			$this->_page->setFrame($frames, $page);
340
+		}
341
+
342
+		/**
343
+		 *    Removes expired and temporary cookies as if
344
+		 *    the browser was closed and re-opened.
345
+		 *    @param string/integer $date   Time when session restarted.
346
+		 *                                  If omitted then all persistent
347
+		 *                                  cookies are kept.
348
+		 *    @access public
349
+		 */
350
+		function restart($date = false) {
351
+			$this->_user_agent->restart($date);
352
+		}
353
+
354
+		/**
355
+		 *    Adds a header to every fetch.
356
+		 *    @param string $header       Header line to add to every
357
+		 *                                request until cleared.
358
+		 *    @access public
359
+		 */
360
+		function addHeader($header) {
361
+			$this->_user_agent->addHeader($header);
362
+		}
363
+
364
+		/**
365
+		 *    Ages the cookies by the specified time.
366
+		 *    @param integer $interval    Amount in seconds.
367
+		 *    @access public
368
+		 */
369
+		function ageCookies($interval) {
370
+			$this->_user_agent->ageCookies($interval);
371
+		}
372
+
373
+		/**
374
+		 *    Sets an additional cookie. If a cookie has
375
+		 *    the same name and path it is replaced.
376
+		 *    @param string $name       Cookie key.
377
+		 *    @param string $value      Value of cookie.
378
+		 *    @param string $host       Host upon which the cookie is valid.
379
+		 *    @param string $path       Cookie path if not host wide.
380
+		 *    @param string $expiry     Expiry date.
381
+		 *    @access public
382
+		 */
383
+		function setCookie($name, $value, $host = false, $path = '/', $expiry = false) {
384
+			$this->_user_agent->setCookie($name, $value, $host, $path, $expiry);
385
+		}
386
+
387
+		/**
388
+		 *    Reads the most specific cookie value from the
389
+		 *    browser cookies.
390
+		 *    @param string $host        Host to search.
391
+		 *    @param string $path        Applicable path.
392
+		 *    @param string $name        Name of cookie to read.
393
+		 *    @return string             False if not present, else the
394
+		 *                               value as a string.
395
+		 *    @access public
396
+		 */
397
+		function getCookieValue($host, $path, $name) {
398
+			return $this->_user_agent->getCookieValue($host, $path, $name);
399
+		}
400
+
401
+		/**
402
+		 *    Reads the current cookies for the current URL.
403
+		 *    @param string $name   Key of cookie to find.
404
+		 *    @return string        Null if there is no current URL, false
405
+		 *                          if the cookie is not set.
406
+		 *    @access public
407
+		 */
408
+		function getCurrentCookieValue($name) {
409
+			return $this->_user_agent->getBaseCookieValue($name, $this->_page->getUrl());
410
+		}
411
+
412
+		/**
413
+		 *    Sets the maximum number of redirects before
414
+		 *    a page will be loaded anyway.
415
+		 *    @param integer $max        Most hops allowed.
416
+		 *    @access public
417
+		 */
418
+		function setMaximumRedirects($max) {
419
+			$this->_user_agent->setMaximumRedirects($max);
420
+		}
421
+
422
+		/**
423
+		 *    Sets the maximum number of nesting of framed pages
424
+		 *    within a framed page to prevent loops.
425
+		 *    @param integer $max        Highest depth allowed.
426
+		 *    @access public
427
+		 */
428
+		function setMaximumNestedFrames($max) {
429
+			$this->_maximum_nested_frames = $max;
430
+		}
431
+
432
+		/**
433
+		 *    Sets the socket timeout for opening a connection.
434
+		 *    @param integer $timeout      Maximum time in seconds.
435
+		 *    @access public
436
+		 */
437
+		function setConnectionTimeout($timeout) {
438
+			$this->_user_agent->setConnectionTimeout($timeout);
439
+		}
440
+
441
+		/**
442
+		 *    Sets proxy to use on all requests for when
443
+		 *    testing from behind a firewall. Set URL
444
+		 *    to false to disable.
445
+		 *    @param string $proxy        Proxy URL.
446
+		 *    @param string $username     Proxy username for authentication.
447
+		 *    @param string $password     Proxy password for authentication.
448
+		 *    @access public
449
+		 */
450
+		function useProxy($proxy, $username = false, $password = false) {
451
+			$this->_user_agent->useProxy($proxy, $username, $password);
452
+		}
453
+
454
+		/**
455
+		 *    Fetches the page content with a HEAD request.
456
+		 *    Will affect cookies, but will not change the base URL.
457
+		 *    @param string/SimpleUrl $url                Target to fetch as string.
458
+		 *    @param hash/SimpleHeadEncoding $parameters  Additional parameters for
459
+		 *                                                HEAD request.
460
+		 *    @return boolean                             True if successful.
461
+		 *    @access public
462
+		 */
463
+		function head($url, $parameters = false) {
464
+			if (! is_object($url)) {
465
+				$url = new SimpleUrl($url);
466
+			}
467
+			if ($this->getUrl()) {
468
+				$url = $url->makeAbsolute($this->getUrl());
469
+			}
470
+			$response = $this->_user_agent->fetchResponse($url, new SimpleHeadEncoding($parameters));
471
+			return ! $response->isError();
472
+		}
473
+
474
+		/**
475
+		 *    Fetches the page content with a simple GET request.
476
+		 *    @param string/SimpleUrl $url                Target to fetch.
477
+		 *    @param hash/SimpleFormEncoding $parameters  Additional parameters for
478
+		 *                                                GET request.
479
+		 *    @return string                              Content of page or false.
480
+		 *    @access public
481
+		 */
482
+		function get($url, $parameters = false) {
483
+			if (! is_object($url)) {
484
+				$url = new SimpleUrl($url);
485
+			}
486
+			if ($this->getUrl()) {
487
+				$url = $url->makeAbsolute($this->getUrl());
488
+			}
489
+			return $this->_load($url, new SimpleGetEncoding($parameters));
490
+		}
491
+
492
+		/**
493
+		 *    Fetches the page content with a POST request.
494
+		 *    @param string/SimpleUrl $url                Target to fetch as string.
495
+		 *    @param hash/SimpleFormEncoding $parameters  POST parameters.
496
+		 *    @return string                              Content of page.
497
+		 *    @access public
498
+		 */
499
+		function post($url, $parameters = false) {
500
+			if (! is_object($url)) {
501
+				$url = new SimpleUrl($url);
502
+			}
503
+			if ($this->getUrl()) {
504
+				$url = $url->makeAbsolute($this->getUrl());
505
+			}
506
+			return $this->_load($url, new SimplePostEncoding($parameters));
507
+		}
508
+
509
+		/**
510
+		 *    Equivalent to hitting the retry button on the
511
+		 *    browser. Will attempt to repeat the page fetch. If
512
+		 *    there is no history to repeat it will give false.
513
+		 *    @return string/boolean   Content if fetch succeeded
514
+		 *                             else false.
515
+		 *    @access public
516
+		 */
517
+		function retry() {
518
+			$frames = $this->_page->getFrameFocus();
519
+			if (count($frames) > 0) {
520
+				$this->_loadFrame(
521
+						$frames,
522
+						$this->_page->getUrl(),
523
+						$this->_page->getRequestData());
524
+				return $this->_page->getRaw();
525
+			}
526
+			if ($url = $this->_history->getUrl()) {
527
+				$this->_page = $this->_fetch($url, $this->_history->getParameters());
528
+				return $this->_page->getRaw();
529
+			}
530
+			return false;
531
+		}
532
+
533
+		/**
534
+		 *    Equivalent to hitting the back button on the
535
+		 *    browser. The browser history is unchanged on
536
+		 *    failure. The page content is refetched as there
537
+		 *    is no concept of content caching in SimpleTest.
538
+		 *    @return boolean     True if history entry and
539
+		 *                        fetch succeeded
540
+		 *    @access public
541
+		 */
542
+		function back() {
543
+			if (! $this->_history->back()) {
544
+				return false;
545
+			}
546
+			$content = $this->retry();
547
+			if (! $content) {
548
+				$this->_history->forward();
549
+			}
550
+			return $content;
551
+		}
552
+
553
+		/**
554
+		 *    Equivalent to hitting the forward button on the
555
+		 *    browser. The browser history is unchanged on
556
+		 *    failure. The page content is refetched as there
557
+		 *    is no concept of content caching in SimpleTest.
558
+		 *    @return boolean     True if history entry and
559
+		 *                        fetch succeeded
560
+		 *    @access public
561
+		 */
562
+		function forward() {
563
+			if (! $this->_history->forward()) {
564
+				return false;
565
+			}
566
+			$content = $this->retry();
567
+			if (! $content) {
568
+				$this->_history->back();
569
+			}
570
+			return $content;
571
+		}
572
+
573
+		/**
574
+		 *    Retries a request after setting the authentication
575
+		 *    for the current realm.
576
+		 *    @param string $username    Username for realm.
577
+		 *    @param string $password    Password for realm.
578
+		 *    @return boolean            True if successful fetch. Note
579
+		 *                               that authentication may still have
580
+		 *                               failed.
581
+		 *    @access public
582
+		 */
583
+		function authenticate($username, $password) {
584
+			if (! $this->_page->getRealm()) {
585
+				return false;
586
+			}
587
+			$url = $this->_page->getUrl();
588
+			if (! $url) {
589
+				return false;
590
+			}
591
+			$this->_user_agent->setIdentity(
592
+					$url->getHost(),
593
+					$this->_page->getRealm(),
594
+					$username,
595
+					$password);
596
+			return $this->retry();
597
+		}
598
+
599
+		/**
600
+		 *    Accessor for a breakdown of the frameset.
601
+		 *    @return array   Hash tree of frames by name
602
+		 *                    or index if no name.
603
+		 *    @access public
604
+		 */
605
+		function getFrames() {
606
+			return $this->_page->getFrames();
607
+		}
608
+
609
+		/**
610
+		 *    Accessor for current frame focus. Will be
611
+		 *    false if no frame has focus.
612
+		 *    @return integer/string/boolean    Label if any, otherwise
613
+		 *                                      the position in the frameset
614
+		 *                                      or false if none.
615
+		 *    @access public
616
+		 */
617
+		function getFrameFocus() {
618
+			return $this->_page->getFrameFocus();
619
+		}
620
+
621
+		/**
622
+		 *    Sets the focus by index. The integer index starts from 1.
623
+		 *    @param integer $choice    Chosen frame.
624
+		 *    @return boolean           True if frame exists.
625
+		 *    @access public
626
+		 */
627
+		function setFrameFocusByIndex($choice) {
628
+			return $this->_page->setFrameFocusByIndex($choice);
629
+		}
630
+
631
+		/**
632
+		 *    Sets the focus by name.
633
+		 *    @param string $name    Chosen frame.
634
+		 *    @return boolean        True if frame exists.
635
+		 *    @access public
636
+		 */
637
+		function setFrameFocus($name) {
638
+			return $this->_page->setFrameFocus($name);
639
+		}
640
+
641
+		/**
642
+		 *    Clears the frame focus. All frames will be searched
643
+		 *    for content.
644
+		 *    @access public
645
+		 */
646
+		function clearFrameFocus() {
647
+			return $this->_page->clearFrameFocus();
648
+		}
649
+
650
+		/**
651
+		 *    Accessor for last error.
652
+		 *    @return string        Error from last response.
653
+		 *    @access public
654
+		 */
655
+		function getTransportError() {
656
+			return $this->_page->getTransportError();
657
+		}
658
+
659
+		/**
660
+		 *    Accessor for current MIME type.
661
+		 *    @return string    MIME type as string; e.g. 'text/html'
662
+		 *    @access public
663
+		 */
664
+		function getMimeType() {
665
+			return $this->_page->getMimeType();
666
+		}
667
+
668
+		/**
669
+		 *    Accessor for last response code.
670
+		 *    @return integer    Last HTTP response code received.
671
+		 *    @access public
672
+		 */
673
+		function getResponseCode() {
674
+			return $this->_page->getResponseCode();
675
+		}
676
+
677
+		/**
678
+		 *    Accessor for last Authentication type. Only valid
679
+		 *    straight after a challenge (401).
680
+		 *    @return string    Description of challenge type.
681
+		 *    @access public
682
+		 */
683
+		function getAuthentication() {
684
+			return $this->_page->getAuthentication();
685
+		}
686
+
687
+		/**
688
+		 *    Accessor for last Authentication realm. Only valid
689
+		 *    straight after a challenge (401).
690
+		 *    @return string    Name of security realm.
691
+		 *    @access public
692
+		 */
693
+		function getRealm() {
694
+			return $this->_page->getRealm();
695
+		}
696
+
697
+		/**
698
+		 *    Accessor for current URL of page or frame if
699
+		 *    focused.
700
+		 *    @return string    Location of current page or frame as
701
+		 *                      a string.
702
+		 */
703
+		function getUrl() {
704
+			$url = $this->_page->getUrl();
705
+			return $url ? $url->asString() : false;
706
+		}
707
+
708
+		/**
709
+		 *    Accessor for raw bytes sent down the wire.
710
+		 *    @return string      Original text sent.
711
+		 *    @access public
712
+		 */
713
+		function getRequest() {
714
+			return $this->_page->getRequest();
715
+		}
716
+
717
+		/**
718
+		 *    Accessor for raw header information.
719
+		 *    @return string      Header block.
720
+		 *    @access public
721
+		 */
722
+		function getHeaders() {
723
+			return $this->_page->getHeaders();
724
+		}
725
+
726
+		/**
727
+		 *    Accessor for raw page information.
728
+		 *    @return string      Original text content of web page.
729
+		 *    @access public
730
+		 */
731
+		function getContent() {
732
+			return $this->_page->getRaw();
733
+		}
734
+
735
+		/**
736
+		 *    Accessor for plain text version of the page.
737
+		 *    @return string      Normalised text representation.
738
+		 *    @access public
739
+		 */
740
+		function getContentAsText() {
741
+			return $this->_page->getText();
742
+		}
743
+
744
+		/**
745
+		 *    Accessor for parsed title.
746
+		 *    @return string     Title or false if no title is present.
747
+		 *    @access public
748
+		 */
749
+		function getTitle() {
750
+			return $this->_page->getTitle();
751
+		}
752
+
753
+		/**
754
+		 *    Accessor for a list of all fixed links in current page.
755
+		 *    @return array   List of urls with scheme of
756
+		 *                    http or https and hostname.
757
+		 *    @access public
758
+		 */
759
+		function getAbsoluteUrls() {
760
+			return $this->_page->getAbsoluteUrls();
761
+		}
762
+
763
+		/**
764
+		 *    Accessor for a list of all relative links.
765
+		 *    @return array      List of urls without hostname.
766
+		 *    @access public
767
+		 */
768
+		function getRelativeUrls() {
769
+			return $this->_page->getRelativeUrls();
770
+		}
771
+
772
+		/**
773
+		 *    Sets all form fields with that name.
774
+		 *    @param string $label   Name or label of field in forms.
775
+		 *    @param string $value   New value of field.
776
+		 *    @return boolean        True if field exists, otherwise false.
777
+		 *    @access public
778
+		 */
779
+		function setField($label, $value) {
780
+			return $this->_page->setField(new SimpleByLabelOrName($label), $value);
781
+		}
782
+
783
+		/**
784
+		 *    Sets all form fields with that name. Will use label if
785
+		 *    one is available (not yet implemented).
786
+		 *    @param string $name    Name of field in forms.
787
+		 *    @param string $value   New value of field.
788
+		 *    @return boolean        True if field exists, otherwise false.
789
+		 *    @access public
790
+		 */
791
+		function setFieldByName($name, $value) {
792
+			return $this->_page->setField(new SimpleByName($name), $value);
793
+		}
794
+
795
+		/**
796
+		 *    Sets all form fields with that id attribute.
797
+		 *    @param string/integer $id   Id of field in forms.
798
+		 *    @param string $value        New value of field.
799
+		 *    @return boolean             True if field exists, otherwise false.
800
+		 *    @access public
801
+		 */
802
+		function setFieldById($id, $value) {
803
+			return $this->_page->setField(new SimpleById($id), $value);
804
+		}
805
+
806
+		/**
807
+		 *    Accessor for a form element value within the page.
808
+		 *    Finds the first match.
809
+		 *    @param string $label       Field label.
810
+		 *    @return string/boolean     A value if the field is
811
+		 *                               present, false if unchecked
812
+		 *                               and null if missing.
813
+		 *    @access public
814
+		 */
815
+		function getField($label) {
816
+			return $this->_page->getField(new SimpleByLabelOrName($label));
817
+		}
818
+
819
+		/**
820
+		 *    Accessor for a form element value within the page.
821
+		 *    Finds the first match.
822
+		 *    @param string $name        Field name.
823
+		 *    @return string/boolean     A string if the field is
824
+		 *                               present, false if unchecked
825
+		 *                               and null if missing.
826
+		 *    @access public
827
+		 */
828
+		function getFieldByName($name) {
829
+			return $this->_page->getField(new SimpleByName($name));
830
+		}
831
+
832
+		/**
833
+		 *    Accessor for a form element value within the page.
834
+		 *    @param string/integer $id  Id of field in forms.
835
+		 *    @return string/boolean     A string if the field is
836
+		 *                               present, false if unchecked
837
+		 *                               and null if missing.
838
+		 *    @access public
839
+		 */
840
+		function getFieldById($id) {
841
+			return $this->_page->getField(new SimpleById($id));
842
+		}
843
+
844
+		/**
845
+		 *    Clicks the submit button by label. The owning
846
+		 *    form will be submitted by this.
847
+		 *    @param string $label    Button label. An unlabeled
848
+		 *                            button can be triggered by 'Submit'.
849
+		 *    @param hash $additional Additional form data.
850
+		 *    @return string/boolean  Page on success.
851
+		 *    @access public
852
+		 */
853
+		function clickSubmit($label = 'Submit', $additional = false) {
854
+			if (! ($form = $this->_page->getFormBySubmit(new SimpleByLabel($label)))) {
855
+				return false;
856
+			}
857
+			$success = $this->_load(
858
+					$form->getAction(),
859
+					$form->submitButton(new SimpleByLabel($label), $additional));
860
+			return ($success ? $this->getContent() : $success);
861
+		}
862
+
863
+		/**
864
+		 *    Clicks the submit button by name attribute. The owning
865
+		 *    form will be submitted by this.
866
+		 *    @param string $name     Button name.
867
+		 *    @param hash $additional Additional form data.
868
+		 *    @return string/boolean  Page on success.
869
+		 *    @access public
870
+		 */
871
+		function clickSubmitByName($name, $additional = false) {
872
+			if (! ($form = $this->_page->getFormBySubmit(new SimpleByName($name)))) {
873
+				return false;
874
+			}
875
+			$success = $this->_load(
876
+					$form->getAction(),
877
+					$form->submitButton(new SimpleByName($name), $additional));
878
+			return ($success ? $this->getContent() : $success);
879
+		}
880
+
881
+		/**
882
+		 *    Clicks the submit button by ID attribute of the button
883
+		 *    itself. The owning form will be submitted by this.
884
+		 *    @param string $id       Button ID.
885
+		 *    @param hash $additional Additional form data.
886
+		 *    @return string/boolean  Page on success.
887
+		 *    @access public
888
+		 */
889
+		function clickSubmitById($id, $additional = false) {
890
+			if (! ($form = $this->_page->getFormBySubmit(new SimpleById($id)))) {
891
+				return false;
892
+			}
893
+			$success = $this->_load(
894
+					$form->getAction(),
895
+					$form->submitButton(new SimpleById($id), $additional));
896
+			return ($success ? $this->getContent() : $success);
897
+		}
898
+
899
+		/**
900
+		 *    Clicks the submit image by some kind of label. Usually
901
+		 *    the alt tag or the nearest equivalent. The owning
902
+		 *    form will be submitted by this. Clicking outside of
903
+		 *    the boundary of the coordinates will result in
904
+		 *    a failure.
905
+		 *    @param string $label    ID attribute of button.
906
+		 *    @param integer $x       X-coordinate of imaginary click.
907
+		 *    @param integer $y       Y-coordinate of imaginary click.
908
+		 *    @param hash $additional Additional form data.
909
+		 *    @return string/boolean  Page on success.
910
+		 *    @access public
911
+		 */
912
+		function clickImage($label, $x = 1, $y = 1, $additional = false) {
913
+			if (! ($form = $this->_page->getFormByImage(new SimpleByLabel($label)))) {
914
+				return false;
915
+			}
916
+			$success = $this->_load(
917
+					$form->getAction(),
918
+					$form->submitImage(new SimpleByLabel($label), $x, $y, $additional));
919
+			return ($success ? $this->getContent() : $success);
920
+		}
921
+
922
+		/**
923
+		 *    Clicks the submit image by the name. Usually
924
+		 *    the alt tag or the nearest equivalent. The owning
925
+		 *    form will be submitted by this. Clicking outside of
926
+		 *    the boundary of the coordinates will result in
927
+		 *    a failure.
928
+		 *    @param string $name     Name attribute of button.
929
+		 *    @param integer $x       X-coordinate of imaginary click.
930
+		 *    @param integer $y       Y-coordinate of imaginary click.
931
+		 *    @param hash $additional Additional form data.
932
+		 *    @return string/boolean  Page on success.
933
+		 *    @access public
934
+		 */
935
+		function clickImageByName($name, $x = 1, $y = 1, $additional = false) {
936
+			if (! ($form = $this->_page->getFormByImage(new SimpleByName($name)))) {
937
+				return false;
938
+			}
939
+			$success = $this->_load(
940
+					$form->getAction(),
941
+					$form->submitImage(new SimpleByName($name), $x, $y, $additional));
942
+			return ($success ? $this->getContent() : $success);
943
+		}
944
+
945
+		/**
946
+		 *    Clicks the submit image by ID attribute. The owning
947
+		 *    form will be submitted by this. Clicking outside of
948
+		 *    the boundary of the coordinates will result in
949
+		 *    a failure.
950
+		 *    @param integer/string $id    ID attribute of button.
951
+		 *    @param integer $x            X-coordinate of imaginary click.
952
+		 *    @param integer $y            Y-coordinate of imaginary click.
953
+		 *    @param hash $additional      Additional form data.
954
+		 *    @return string/boolean       Page on success.
955
+		 *    @access public
956
+		 */
957
+		function clickImageById($id, $x = 1, $y = 1, $additional = false) {
958
+			if (! ($form = $this->_page->getFormByImage(new SimpleById($id)))) {
959
+				return false;
960
+			}
961
+			$success = $this->_load(
962
+					$form->getAction(),
963
+					$form->submitImage(new SimpleById($id), $x, $y, $additional));
964
+			return ($success ? $this->getContent() : $success);
965
+		}
966
+
967
+		/**
968
+		 *    Submits a form by the ID.
969
+		 *    @param string $id       The form ID. No submit button value
970
+		 *                            will be sent.
971
+		 *    @return string/boolean  Page on success.
972
+		 *    @access public
973
+		 */
974
+		function submitFormById($id) {
975
+			if (! ($form = $this->_page->getFormById($id))) {
976
+				return false;
977
+			}
978
+			$success = $this->_load(
979
+					$form->getAction(),
980
+					$form->submit());
981
+			return ($success ? $this->getContent() : $success);
982
+		}
983
+
984
+		/**
985
+		 *    Follows a link by label. Will click the first link
986
+		 *    found with this link text by default, or a later
987
+		 *    one if an index is given. The match ignores case and
988
+		 *    white space issues.
989
+		 *    @param string $label     Text between the anchor tags.
990
+		 *    @param integer $index    Link position counting from zero.
991
+		 *    @return string/boolean   Page on success.
992
+		 *    @access public
993
+		 */
994
+		function clickLink($label, $index = 0) {
995
+			$urls = $this->_page->getUrlsByLabel($label);
996
+			if (count($urls) == 0) {
997
+				return false;
998
+			}
999
+			if (count($urls) < $index + 1) {
1000
+				return false;
1001
+			}
1002
+			$this->_load($urls[$index], new SimpleGetEncoding());
1003
+			return $this->getContent();
1004
+		}
1005
+
1006
+		/**
1007
+		 *    Tests to see if a link is present by label.
1008
+		 *    @param string $label     Text of value attribute.
1009
+		 *    @return boolean          True if link present.
1010
+		 *    @access public
1011
+		 */
1012
+		function isLink($label) {
1013
+			return (count($this->_page->getUrlsByLabel($label)) > 0);
1014
+		}
1015
+
1016
+		/**
1017
+		 *    Follows a link by id attribute.
1018
+		 *    @param string $id        ID attribute value.
1019
+		 *    @return string/boolean   Page on success.
1020
+		 *    @access public
1021
+		 */
1022
+		function clickLinkById($id) {
1023
+			if (! ($url = $this->_page->getUrlById($id))) {
1024
+				return false;
1025
+			}
1026
+			$this->_load($url, new SimpleGetEncoding());
1027
+			return $this->getContent();
1028
+		}
1029
+
1030
+		/**
1031
+		 *    Tests to see if a link is present by ID attribute.
1032
+		 *    @param string $id     Text of id attribute.
1033
+		 *    @return boolean       True if link present.
1034
+		 *    @access public
1035
+		 */
1036
+		function isLinkById($id) {
1037
+			return (boolean)$this->_page->getUrlById($id);
1038
+		}
1039
+
1040
+		/**
1041
+		 *    Clicks a visible text item. Will first try buttons,
1042
+		 *    then links and then images.
1043
+		 *    @param string $label        Visible text or alt text.
1044
+		 *    @return string/boolean      Raw page or false.
1045
+		 *    @access public
1046
+		 */
1047
+		function click($label) {
1048
+			$raw = $this->clickSubmit($label);
1049
+			if (! $raw) {
1050
+				$raw = $this->clickLink($label);
1051
+			}
1052
+			if (! $raw) {
1053
+				$raw = $this->clickImage($label);
1054
+			}
1055
+			return $raw;
1056
+		}
1057
+	}
1058 1058
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test_tools/simpletest/selector.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -1,132 +1,132 @@
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     *	Base include file for SimpleTest.
4
-     *	@package	SimpleTest
5
-     *	@subpackage	WebTester
6
-     *	@version	$Id: selector.php 1398 2006-09-08 19:31:03Z xue $
7
-     */
2
+	/**
3
+	 *	Base include file for SimpleTest.
4
+	 *	@package	SimpleTest
5
+	 *	@subpackage	WebTester
6
+	 *	@version	$Id: selector.php 1398 2006-09-08 19:31:03Z xue $
7
+	 */
8 8
 
9
-    /**#@+
9
+	/**#@+
10 10
      * include SimpleTest files
11 11
      */
12
-    require_once(dirname(__FILE__) . '/tag.php');
13
-    require_once(dirname(__FILE__) . '/encoding.php');
14
-    /**#@-*/
12
+	require_once(dirname(__FILE__) . '/tag.php');
13
+	require_once(dirname(__FILE__) . '/encoding.php');
14
+	/**#@-*/
15 15
 
16
-    /**
17
-     *    Used to extract form elements for testing against.
18
-     *    Searches by name attribute.
16
+	/**
17
+	 *    Used to extract form elements for testing against.
18
+	 *    Searches by name attribute.
19 19
 	 *    @package SimpleTest
20 20
 	 *    @subpackage WebTester
21
-     */
22
-    class SimpleByName {
23
-        protected $_name;
21
+	 */
22
+	class SimpleByName {
23
+		protected $_name;
24 24
 
25
-        /**
26
-         *    Stashes the name for later comparison.
27
-         *    @param string $name     Name attribute to match.
28
-         */
29
-        function SimpleByName($name) {
30
-            $this->_name = $name;
31
-        }
25
+		/**
26
+		 *    Stashes the name for later comparison.
27
+		 *    @param string $name     Name attribute to match.
28
+		 */
29
+		function SimpleByName($name) {
30
+			$this->_name = $name;
31
+		}
32 32
 
33
-        /**
34
-         *    Compares with name attribute of widget.
35
-         *    @param SimpleWidget $widget    Control to compare.
36
-         *    @access public
37
-         */
38
-        function isMatch($widget) {
39
-            return ($widget->getName() == $this->_name);
40
-        }
41
-    }
33
+		/**
34
+		 *    Compares with name attribute of widget.
35
+		 *    @param SimpleWidget $widget    Control to compare.
36
+		 *    @access public
37
+		 */
38
+		function isMatch($widget) {
39
+			return ($widget->getName() == $this->_name);
40
+		}
41
+	}
42 42
 
43
-    /**
44
-     *    Used to extract form elements for testing against.
45
-     *    Searches by visible label or alt text.
43
+	/**
44
+	 *    Used to extract form elements for testing against.
45
+	 *    Searches by visible label or alt text.
46 46
 	 *    @package SimpleTest
47 47
 	 *    @subpackage WebTester
48
-     */
49
-    class SimpleByLabel {
50
-        protected $_label;
48
+	 */
49
+	class SimpleByLabel {
50
+		protected $_label;
51 51
 
52
-        /**
53
-         *    Stashes the name for later comparison.
54
-         *    @param string $label     Visible text to match.
55
-         */
56
-        function SimpleByLabel($label) {
57
-            $this->_label = $label;
58
-        }
52
+		/**
53
+		 *    Stashes the name for later comparison.
54
+		 *    @param string $label     Visible text to match.
55
+		 */
56
+		function SimpleByLabel($label) {
57
+			$this->_label = $label;
58
+		}
59 59
 
60
-        /**
61
-         *    Comparison. Compares visible text of widget or
62
-         *    related label.
63
-         *    @param SimpleWidget $widget    Control to compare.
64
-         *    @access public
65
-         */
66
-        function isMatch($widget) {
67
-            if (! method_exists($widget, 'isLabel')) {
68
-                return false;
69
-            }
70
-            return $widget->isLabel($this->_label);
71
-        }
72
-    }
60
+		/**
61
+		 *    Comparison. Compares visible text of widget or
62
+		 *    related label.
63
+		 *    @param SimpleWidget $widget    Control to compare.
64
+		 *    @access public
65
+		 */
66
+		function isMatch($widget) {
67
+			if (! method_exists($widget, 'isLabel')) {
68
+				return false;
69
+			}
70
+			return $widget->isLabel($this->_label);
71
+		}
72
+	}
73 73
 
74
-    /**
75
-     *    Used to extract form elements for testing against.
76
-     *    Searches dy id attribute.
74
+	/**
75
+	 *    Used to extract form elements for testing against.
76
+	 *    Searches dy id attribute.
77 77
 	 *    @package SimpleTest
78 78
 	 *    @subpackage WebTester
79
-     */
80
-    class SimpleById {
81
-        protected $_id;
79
+	 */
80
+	class SimpleById {
81
+		protected $_id;
82 82
 
83
-        /**
84
-         *    Stashes the name for later comparison.
85
-         *    @param string $id     ID atribute to match.
86
-         */
87
-        function SimpleById($id) {
88
-            $this->_id = $id;
89
-        }
83
+		/**
84
+		 *    Stashes the name for later comparison.
85
+		 *    @param string $id     ID atribute to match.
86
+		 */
87
+		function SimpleById($id) {
88
+			$this->_id = $id;
89
+		}
90 90
 
91
-        /**
92
-         *    Comparison. Compares id attribute of widget.
93
-         *    @param SimpleWidget $widget    Control to compare.
94
-         *    @access public
95
-         */
96
-        function isMatch($widget) {
97
-            return $widget->isId($this->_id);
98
-        }
99
-    }
91
+		/**
92
+		 *    Comparison. Compares id attribute of widget.
93
+		 *    @param SimpleWidget $widget    Control to compare.
94
+		 *    @access public
95
+		 */
96
+		function isMatch($widget) {
97
+			return $widget->isId($this->_id);
98
+		}
99
+	}
100 100
 
101
-    /**
102
-     *    Used to extract form elements for testing against.
103
-     *    Searches by visible label, name or alt text.
101
+	/**
102
+	 *    Used to extract form elements for testing against.
103
+	 *    Searches by visible label, name or alt text.
104 104
 	 *    @package SimpleTest
105 105
 	 *    @subpackage WebTester
106
-     */
107
-    class SimpleByLabelOrName {
108
-        protected $_label;
106
+	 */
107
+	class SimpleByLabelOrName {
108
+		protected $_label;
109 109
 
110
-        /**
111
-         *    Stashes the name/label for later comparison.
112
-         *    @param string $label     Visible text to match.
113
-         */
114
-        function SimpleByLabelOrName($label) {
115
-            $this->_label = $label;
116
-        }
110
+		/**
111
+		 *    Stashes the name/label for later comparison.
112
+		 *    @param string $label     Visible text to match.
113
+		 */
114
+		function SimpleByLabelOrName($label) {
115
+			$this->_label = $label;
116
+		}
117 117
 
118
-        /**
119
-         *    Comparison. Compares visible text of widget or
120
-         *    related label or name.
121
-         *    @param SimpleWidget $widget    Control to compare.
122
-         *    @access public
123
-         */
124
-        function isMatch($widget) {
125
-            if (method_exists($widget, 'isLabel')) {
126
-                if ($widget->isLabel($this->_label)) {
127
-                    return true;
128
-                }
129
-            }
130
-            return ($widget->getName() == $this->_label);
131
-        }
132
-    }
133 118
\ No newline at end of file
119
+		/**
120
+		 *    Comparison. Compares visible text of widget or
121
+		 *    related label or name.
122
+		 *    @param SimpleWidget $widget    Control to compare.
123
+		 *    @access public
124
+		 */
125
+		function isMatch($widget) {
126
+			if (method_exists($widget, 'isLabel')) {
127
+				if ($widget->isLabel($this->_label)) {
128
+					return true;
129
+				}
130
+			}
131
+			return ($widget->getName() == $this->_label);
132
+		}
133
+	}
134 134
\ No newline at end of file
Please login to merge, or discard this patch.
tests/unit/TComponentTest.php 1 patch
Indentation   +959 added lines, -959 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
   private $_colorattribute = null;
13 13
 
14 14
   public function getAutoGlobalListen() {
15
-    return true;
15
+	return true;
16 16
   }
17 17
 
18 18
   public function getText() {
19
-    return $this->_text;
19
+	return $this->_text;
20 20
   }
21 21
 
22 22
   public function setText($value) {
23
-    $this->_text=$value;
23
+	$this->_text=$value;
24 24
   }
25 25
 
26 26
   public function getReadOnlyProperty() {
@@ -32,37 +32,37 @@  discard block
 block discarded – undo
32 32
   }
33 33
 
34 34
   public function getObject() {
35
-    if(!$this->_object) {
36
-      $this->_object=new NewComponent;
37
-      $this->_object->_text='object text';
38
-    }
39
-    return $this->_object;
35
+	if(!$this->_object) {
36
+	  $this->_object=new NewComponent;
37
+	  $this->_object->_text='object text';
38
+	}
39
+	return $this->_object;
40 40
   }
41 41
 
42 42
   public function onMyEvent($param) {
43
-    $this->raiseEvent('OnMyEvent',$this,$param);
43
+	$this->raiseEvent('OnMyEvent',$this,$param);
44 44
   }
45 45
 
46 46
   public function myEventHandler($sender,$param) {
47
-    $this->_eventHandled=true;
47
+	$this->_eventHandled=true;
48 48
   }
49 49
 
50 50
   public function eventReturnValue($sender,$param) {
51
-    return $param->Return;
51
+	return $param->Return;
52 52
   }
53 53
 
54 54
   public function isEventHandled() {
55
-    return $this->_eventHandled;
55
+	return $this->_eventHandled;
56 56
   }
57 57
 
58 58
   public function resetEventHandled() {
59
-    $this->_eventHandled = false;
59
+	$this->_eventHandled = false;
60 60
   }
61 61
   public function getReturn() {
62 62
   	return $this->_return;
63 63
   }
64 64
   public function setReturn($return) {
65
-    $this->_return = $return;
65
+	$this->_return = $return;
66 66
   }
67 67
   public function getjsColorAttribute() {
68 68
 	return $this->_colorattribute;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	}
203 203
 
204 204
 	public function onBehaviorEvent($sender, $param,$responsetype=null,$postfunction=null) {
205
-    	return $this->getOwner()->raiseEvent('onBehaviorEvent',$sender,$param,$responsetype,$postfunction);
205
+		return $this->getOwner()->raiseEvent('onBehaviorEvent',$sender,$param,$responsetype,$postfunction);
206 206
 	}
207 207
 	public function fxGlobalBehaviorEvent($sender, $param) {
208 208
 	}
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
   protected $component;
414 414
 
415 415
   public function setUp() {
416
-    $this->component = new NewComponent();
416
+	$this->component = new NewComponent();
417 417
   }
418 418
 
419 419
 
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
   	// PHP version 5.3.6 doesn't call the __destruct method when unsetting variables;
422 422
   	//	Thus any object that listens must be explicitly call unlisten in this version of PHP.
423 423
   	if($this->component)
424
-	    $this->component->unlisten();
425
-    $this->component = null;
424
+		$this->component->unlisten();
425
+	$this->component = null;
426 426
   }
427 427
 
428 428
 
429 429
   public function testGetListeningToGlobalEvents() {
430 430
   	$this->assertEquals(true, $this->component->getListeningToGlobalEvents());
431
-    $this->component->unlisten();
431
+	$this->component->unlisten();
432 432
   	$this->assertEquals(false, $this->component->getListeningToGlobalEvents());
433 433
   }
434 434
 
@@ -437,12 +437,12 @@  discard block
 block discarded – undo
437 437
   	// the default object auto installs class behavior hooks
438 438
   	$this->assertEquals(1, $this->component->getEventHandlers('fxAttachClassBehavior')->getCount());
439 439
   	$this->assertEquals(1, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
440
-    $this->assertTrue($this->component->getListeningToGlobalEvents());
440
+	$this->assertTrue($this->component->getListeningToGlobalEvents());
441 441
 
442
-    // this object does not auto install class behavior hooks, thus not changing the global event structure.
443
-    //	Creating a new instance should _not_ influence the fxAttachClassBehavior and fxDetachClassBehavior
444
-    //	count.
445
-    $component_nolisten = new NewComponentNoListen();
442
+	// this object does not auto install class behavior hooks, thus not changing the global event structure.
443
+	//	Creating a new instance should _not_ influence the fxAttachClassBehavior and fxDetachClassBehavior
444
+	//	count.
445
+	$component_nolisten = new NewComponentNoListen();
446 446
   	$this->assertEquals(1, $this->component->getEventHandlers('fxAttachClassBehavior')->getCount());
447 447
   	$this->assertEquals(1, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
448 448
   	$this->assertEquals(1, $component_nolisten->getEventHandlers('fxAttachClassBehavior')->getCount());
@@ -523,66 +523,66 @@  discard block
 block discarded – undo
523 523
   //Test Class behaviors
524 524
   public function testAttachClassBehavior() {
525 525
 
526
-    // ensure that the class is listening
526
+	// ensure that the class is listening
527 527
   	$this->assertEquals(1, $this->component->getEventHandlers('fxAttachClassBehavior')->getCount());
528 528
 
529 529
   	//Test that the component is not a FooClassBehavior
530
-    $this->assertNull($this->component->asa('FooClassBehavior'), "Component is already a FooClassBehavior and should not have this behavior");
530
+	$this->assertNull($this->component->asa('FooClassBehavior'), "Component is already a FooClassBehavior and should not have this behavior");
531 531
 
532
-    //Add the FooClassBehavior
533
-    $this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
532
+	//Add the FooClassBehavior
533
+	$this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
534 534
 
535
-    //Test that the existing listening component can be a FooClassBehavior
536
-    $this->assertNotNull($this->component->asa('FooClassBehavior'), "Component is does not have the FooClassBehavior and should have this behavior");
535
+	//Test that the existing listening component can be a FooClassBehavior
536
+	$this->assertNotNull($this->component->asa('FooClassBehavior'), "Component is does not have the FooClassBehavior and should have this behavior");
537 537
 
538
-    // test if the function modifies new instances of the object
539
-    $anothercomponent = new NewComponent();
538
+	// test if the function modifies new instances of the object
539
+	$anothercomponent = new NewComponent();
540 540
 
541
-    //The new component should be a FooClassBehavior
542
-    $this->assertNotNull($anothercomponent->asa('FooClassBehavior'), "anothercomponent does not have the FooClassBehavior");
541
+	//The new component should be a FooClassBehavior
542
+	$this->assertNotNull($anothercomponent->asa('FooClassBehavior'), "anothercomponent does not have the FooClassBehavior");
543 543
 
544
-    // test when overwriting an existing class behavior, it should throw an TInvalidOperationException
545
-    try {
546
-      $this->component->attachClassBehavior('FooClassBehavior', new BarClassBehavior);
547
-      $this->fail('TInvalidOperationException not raised when overwriting an existing behavior');
548
-    } catch(TInvalidOperationException $e) {
549
-    }
544
+	// test when overwriting an existing class behavior, it should throw an TInvalidOperationException
545
+	try {
546
+	  $this->component->attachClassBehavior('FooClassBehavior', new BarClassBehavior);
547
+	  $this->fail('TInvalidOperationException not raised when overwriting an existing behavior');
548
+	} catch(TInvalidOperationException $e) {
549
+	}
550 550
 
551 551
 
552
-    // test when overwriting an existing class behavior, it should throw an TInvalidOperationException
553
-    try {
552
+	// test when overwriting an existing class behavior, it should throw an TInvalidOperationException
553
+	try {
554 554
   	  $this->component->attachClassBehavior('FooBarBehavior', 'FooBarBehavior', 'TComponent');
555
-      $this->fail('TInvalidOperationException not raised when trying to place a behavior on the root object TComponent');
556
-    } catch(TInvalidOperationException $e) {
557
-    }
555
+	  $this->fail('TInvalidOperationException not raised when trying to place a behavior on the root object TComponent');
556
+	} catch(TInvalidOperationException $e) {
557
+	}
558 558
 
559 559
 
560
-    // test if the function does not modify any existing objects that are not listening
561
-    //	The FooClassBehavior is already a part of the class behaviors thus the new instance gets the behavior.
562
-    $nolistencomponent = new NewComponentNoListen();
560
+	// test if the function does not modify any existing objects that are not listening
561
+	//	The FooClassBehavior is already a part of the class behaviors thus the new instance gets the behavior.
562
+	$nolistencomponent = new NewComponentNoListen();
563 563
 
564
-    // test if the function modifies all existing objects that are listening
565
-    //	Adding a behavior to the first object, the second instance should automatically get the class behavior.
566
-    //		This is because the second object is listening to the global events of class behaviors
567
-    $this->component->attachClassBehavior('BarClassBehavior', new BarClassBehavior);
568
-    $this->assertNotNull($anothercomponent->asa('BarClassBehavior'), "anothercomponent is does not have the BarClassBehavior");
564
+	// test if the function modifies all existing objects that are listening
565
+	//	Adding a behavior to the first object, the second instance should automatically get the class behavior.
566
+	//		This is because the second object is listening to the global events of class behaviors
567
+	$this->component->attachClassBehavior('BarClassBehavior', new BarClassBehavior);
568
+	$this->assertNotNull($anothercomponent->asa('BarClassBehavior'), "anothercomponent is does not have the BarClassBehavior");
569 569
 
570
-    // The no listen object should not have the BarClassBehavior because it was added as a class behavior after the object was instanced
571
-    $this->assertNull($nolistencomponent->asa('BarClassBehavior'), "nolistencomponent has the BarClassBehavior and should not");
570
+	// The no listen object should not have the BarClassBehavior because it was added as a class behavior after the object was instanced
571
+	$this->assertNull($nolistencomponent->asa('BarClassBehavior'), "nolistencomponent has the BarClassBehavior and should not");
572 572
 
573
-    //	But the no listen object should have the FooClassBehavior because the class behavior was installed before the object was instanced
574
-    $this->assertNotNull($nolistencomponent->asa('FooClassBehavior'), "nolistencomponent is does not have the FooClassBehavior");
573
+	//	But the no listen object should have the FooClassBehavior because the class behavior was installed before the object was instanced
574
+	$this->assertNotNull($nolistencomponent->asa('FooClassBehavior'), "nolistencomponent is does not have the FooClassBehavior");
575 575
 
576
-    //Clear out what was done during this test
577
-    $anothercomponent->unlisten();
578
-    $this->component->detachClassBehavior('FooClassBehavior');
579
-    $this->component->detachClassBehavior('BarClassBehavior');
576
+	//Clear out what was done during this test
577
+	$anothercomponent->unlisten();
578
+	$this->component->detachClassBehavior('FooClassBehavior');
579
+	$this->component->detachClassBehavior('BarClassBehavior');
580 580
 
581
-    // Test attaching of single object behaviors as class-wide behaviors
582
-    $this->component->attachClassBehavior('BarBehaviorObject', 'BarBehavior');
583
-    $this->assertTrue($this->component->asa('BarBehaviorObject') instanceof BarBehavior);
584
-    $this->assertEquals($this->component->BarBehaviorObject->Owner, $this->component);
585
-    $this->component->detachClassBehavior('BarBehaviorObject');
581
+	// Test attaching of single object behaviors as class-wide behaviors
582
+	$this->component->attachClassBehavior('BarBehaviorObject', 'BarBehavior');
583
+	$this->assertTrue($this->component->asa('BarBehaviorObject') instanceof BarBehavior);
584
+	$this->assertEquals($this->component->BarBehaviorObject->Owner, $this->component);
585
+	$this->component->detachClassBehavior('BarBehaviorObject');
586 586
   }
587 587
 
588 588
 
@@ -590,48 +590,48 @@  discard block
 block discarded – undo
590 590
 
591 591
 
592 592
   public function testDetachClassBehavior() {
593
-    // ensure that the component is listening
593
+	// ensure that the component is listening
594 594
   	$this->assertEquals(1, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
595 595
 
596
-    $prenolistencomponent = new NewComponentNoListen();
596
+	$prenolistencomponent = new NewComponentNoListen();
597 597
 
598 598
   	//Attach a class behavior
599
-    $this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
599
+	$this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
600 600
 
601
-    //Create new components that listen and don't listen to global events
602
-    $anothercomponent = new NewComponent();
603
-    $postnolistencomponent = new NewComponentNoListen();
601
+	//Create new components that listen and don't listen to global events
602
+	$anothercomponent = new NewComponent();
603
+	$postnolistencomponent = new NewComponentNoListen();
604 604
 
605
-    //ensures that all the Components are properly initialized
605
+	//ensures that all the Components are properly initialized
606 606
   	$this->assertEquals(2, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
607
-    $this->assertNotNull($this->component->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
608
-    $this->assertNull($prenolistencomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
609
-    $this->assertNotNull($anothercomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
610
-    $this->assertNotNull($postnolistencomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
607
+	$this->assertNotNull($this->component->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
608
+	$this->assertNull($prenolistencomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
609
+	$this->assertNotNull($anothercomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
610
+	$this->assertNotNull($postnolistencomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
611 611
 
612 612
 
613
-    $this->component->detachClassBehavior('FooClassBehavior');
613
+	$this->component->detachClassBehavior('FooClassBehavior');
614 614
 
615
-    $this->assertNull($this->component->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
616
-    $this->assertNull($prenolistencomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
617
-    $this->assertNull($anothercomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
618
-    $this->assertNotNull($postnolistencomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
615
+	$this->assertNull($this->component->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
616
+	$this->assertNull($prenolistencomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
617
+	$this->assertNull($anothercomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
618
+	$this->assertNotNull($postnolistencomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
619 619
 
620 620
 
621
-    //tear down function variables
622
-    $anothercomponent->unlisten();
621
+	//tear down function variables
622
+	$anothercomponent->unlisten();
623 623
   }
624 624
 
625 625
   public function testGetClassHierarchy() {
626
-    $component = new DynamicCatchingComponent;
627
-    $this->assertEquals(array('TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy());
628
-    $this->assertEquals(array('TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy(false));
629
-    $this->assertEquals(array('tcomponent', 'newcomponent', 'newcomponentnolisten', 'dynamiccatchingcomponent'), $component->getClassHierarchy(true));
626
+	$component = new DynamicCatchingComponent;
627
+	$this->assertEquals(array('TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy());
628
+	$this->assertEquals(array('TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy(false));
629
+	$this->assertEquals(array('tcomponent', 'newcomponent', 'newcomponentnolisten', 'dynamiccatchingcomponent'), $component->getClassHierarchy(true));
630 630
   }
631 631
 
632 632
 
633 633
   public function testAsA() {
634
-    $anothercomponent = new NewComponent();
634
+	$anothercomponent = new NewComponent();
635 635
 
636 636
   	// ensure the component does not have the FooClassBehavior
637 637
   	$this->assertNull($this->component->asa('FooClassBehavior'));
@@ -645,24 +645,24 @@  discard block
 block discarded – undo
645 645
   	$this->assertNull($anothercomponent->asa('NonExistantClassBehavior'));
646 646
 
647 647
   	// add the class behavior
648
-    $this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
648
+	$this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
649 649
 
650
-    //Check that the component has only the class behavior assigned
650
+	//Check that the component has only the class behavior assigned
651 651
   	$this->assertNotNull($this->component->asa('FooClassBehavior'));
652 652
   	$this->assertNull($this->component->asa('FooFooClassBehavior'));
653 653
   	$this->assertNull($this->component->asa('BarClassBehavior'));
654 654
   	$this->assertNull($this->component->asa('NonExistantClassBehavior'));
655 655
 
656
-    //Check that the component has only the class behavior assigned
656
+	//Check that the component has only the class behavior assigned
657 657
   	$this->assertNotNull($anothercomponent->asa('FooClassBehavior'));
658 658
   	$this->assertNull($anothercomponent->asa('FooFooClassBehavior'));
659 659
   	$this->assertNull($anothercomponent->asa('BarClassBehavior'));
660 660
   	$this->assertNull($anothercomponent->asa('NonExistantClassBehavior'));
661 661
 
662 662
   	// remove the class behavior
663
-    $this->component->detachClassBehavior('FooClassBehavior');
663
+	$this->component->detachClassBehavior('FooClassBehavior');
664 664
 
665
-    // Check the function doesn't have the behavior any more
665
+	// Check the function doesn't have the behavior any more
666 666
   	$this->assertNull($this->component->asa('FooClassBehavior'));
667 667
   	$this->assertNull($this->component->asa('FooFooClassBehavior'));
668 668
   	$this->assertNull($this->component->asa('BarClassBehavior'));
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 
679 679
   	$this->component->attachBehavior('BarBehavior', new BarBehavior);
680 680
 
681
-    //Check that the component has only the object behavior assigned
681
+	//Check that the component has only the object behavior assigned
682 682
   	$this->assertNull($this->component->asa('FooBehavior'));
683 683
   	$this->assertNull($this->component->asa('FooFooBehavior'));
684 684
   	$this->assertNotNull($this->component->asa('BarBehavior'));
685 685
   	$this->assertNull($this->component->asa('NonExistantBehavior'));
686 686
 
687
-    //Check that the component has the behavior assigned
687
+	//Check that the component has the behavior assigned
688 688
   	$this->assertNull($anothercomponent->asa('FooBehavior'));
689 689
   	$this->assertNull($anothercomponent->asa('FooFooBehavior'));
690 690
   	$this->assertNull($anothercomponent->asa('BarBehavior'));
@@ -692,690 +692,690 @@  discard block
 block discarded – undo
692 692
 
693 693
   	$this->component->detachBehavior('BarBehavior');
694 694
 
695
-    //Check that the component has no object behaviors assigned
695
+	//Check that the component has no object behaviors assigned
696 696
   	$this->assertNull($this->component->asa('FooBehavior'));
697 697
   	$this->assertNull($this->component->asa('FooFooBehavior'));
698 698
   	$this->assertNull($this->component->asa('BarBehavior'));
699 699
   	$this->assertNull($this->component->asa('NonExistantBehavior'));
700 700
 
701
-    //Check that the component has no behavior assigned
701
+	//Check that the component has no behavior assigned
702 702
   	$this->assertNull($anothercomponent->asa('FooBehavior'));
703 703
   	$this->assertNull($anothercomponent->asa('FooFooBehavior'));
704 704
   	$this->assertNull($anothercomponent->asa('BarBehavior'));
705 705
   	$this->assertNull($anothercomponent->asa('NonExistantBehavior'));
706 706
 
707
-    $anothercomponent->unlisten();
707
+	$anothercomponent->unlisten();
708 708
   }
709 709
 
710 710
   public function testIsA() {
711 711
   	//This doesn't check the IInstanceCheck functionality, separate function
712 712
 
713
-    $this->assertTrue($this->component->isa('TComponent'));
714
-    $this->assertTrue($this->component->isa('NewComponent'));
715
-    $this->assertFalse($this->component->isa(new FooBehavior));
716
-    $this->assertFalse($this->component->isa('FooBehavior'));
713
+	$this->assertTrue($this->component->isa('TComponent'));
714
+	$this->assertTrue($this->component->isa('NewComponent'));
715
+	$this->assertFalse($this->component->isa(new FooBehavior));
716
+	$this->assertFalse($this->component->isa('FooBehavior'));
717 717
 
718
-    //Ensure there is no BarBehavior
718
+	//Ensure there is no BarBehavior
719 719
   	$this->assertNull($this->component->asa('FooFooBehavior'));
720 720
 
721
-    $this->assertFalse($this->component->isa('FooBehavior'));
722
-    $this->assertFalse($this->component->isa('FooFooBehavior'));
721
+	$this->assertFalse($this->component->isa('FooBehavior'));
722
+	$this->assertFalse($this->component->isa('FooFooBehavior'));
723 723
 
724 724
   	$this->component->attachBehavior('FooFooBehavior', new FooFooBehavior);
725 725
 
726 726
   	$this->assertNotNull($this->component->asa('FooFooBehavior'));
727 727
 
728
-    $this->assertTrue($this->component->isa('FooBehavior'));
729
-    $this->assertTrue($this->component->isa('FooFooBehavior'));
728
+	$this->assertTrue($this->component->isa('FooBehavior'));
729
+	$this->assertTrue($this->component->isa('FooFooBehavior'));
730 730
 
731 731
 	$this->component->disableBehaviors();
732 732
 	// It still has the behavior
733 733
   	$this->assertNotNull($this->component->asa('FooFooBehavior'));
734 734
 
735 735
   	// But it is not expressed
736
-    $this->assertFalse($this->component->isa('FooBehavior'));
737
-    $this->assertFalse($this->component->isa('FooFooBehavior'));
736
+	$this->assertFalse($this->component->isa('FooBehavior'));
737
+	$this->assertFalse($this->component->isa('FooFooBehavior'));
738 738
 
739 739
 	$this->component->enableBehaviors();
740 740
   	$this->assertNotNull($this->component->asa('FooFooBehavior'));
741 741
 
742
-    $this->assertTrue($this->component->isa('FooFooBehavior'));
742
+	$this->assertTrue($this->component->isa('FooFooBehavior'));
743 743
 
744 744
 
745 745
 
746 746
    	$this->component->attachBehavior('FooBarBehavior', new FooBarBehavior);
747 747
 
748
-    $this->assertTrue($this->component->isa('FooBehavior'));
749
-    $this->assertTrue($this->component->isa('FooBarBehavior'));
748
+	$this->assertTrue($this->component->isa('FooBehavior'));
749
+	$this->assertTrue($this->component->isa('FooBarBehavior'));
750 750
 
751
-    $this->component->disableBehavior('FooBarBehavior');
751
+	$this->component->disableBehavior('FooBarBehavior');
752 752
 
753
-    $this->assertTrue($this->component->isa('FooBehavior'));
754
-    $this->assertFalse($this->component->isa('FooBarBehavior'));
753
+	$this->assertTrue($this->component->isa('FooBehavior'));
754
+	$this->assertFalse($this->component->isa('FooBarBehavior'));
755 755
 
756
-    $this->component->enableBehavior('FooBarBehavior');
757
-    $this->component->disableBehavior('FooFooBehavior');
758
-    $this->assertFalse($this->component->isa('FooBehavior'));
759
-    $this->assertFalse($this->component->isa('FooFooBehavior'));
760
-    $this->assertTrue($this->component->isa('FooBarBehavior'));
756
+	$this->component->enableBehavior('FooBarBehavior');
757
+	$this->component->disableBehavior('FooFooBehavior');
758
+	$this->assertFalse($this->component->isa('FooBehavior'));
759
+	$this->assertFalse($this->component->isa('FooFooBehavior'));
760
+	$this->assertTrue($this->component->isa('FooBarBehavior'));
761 761
 
762
-    $this->component->disableBehavior('FooBarBehavior');
763
-    $this->component->disableBehavior('FooFooBehavior');
762
+	$this->component->disableBehavior('FooBarBehavior');
763
+	$this->component->disableBehavior('FooFooBehavior');
764 764
 
765
-    $this->assertFalse($this->component->isa('FooBehavior'));
766
-    $this->assertFalse($this->component->isa('FooFooBehavior'));
767
-    $this->assertFalse($this->component->isa('FooBarBehavior'));
765
+	$this->assertFalse($this->component->isa('FooBehavior'));
766
+	$this->assertFalse($this->component->isa('FooFooBehavior'));
767
+	$this->assertFalse($this->component->isa('FooBarBehavior'));
768 768
 
769
-    $this->component->enableBehavior('FooBarBehavior');
770
-    $this->component->enableBehavior('FooFooBehavior');
769
+	$this->component->enableBehavior('FooBarBehavior');
770
+	$this->component->enableBehavior('FooFooBehavior');
771 771
 
772
-    $this->assertTrue($this->component->isa('FooFooBehavior'));
773
-    $this->assertTrue($this->component->isa('FooBarBehavior'));
772
+	$this->assertTrue($this->component->isa('FooFooBehavior'));
773
+	$this->assertTrue($this->component->isa('FooBarBehavior'));
774 774
 
775 775
 
776 776
   	$this->component->detachBehavior('FooFooBehavior');
777 777
   	$this->component->detachBehavior('FooBarBehavior');
778 778
 
779
-    $this->assertFalse($this->component->isa(new FooBehavior));
780
-    $this->assertFalse($this->component->isa('FooBehavior'));
781
-    $this->assertFalse($this->component->isa(new FooFooBehavior));
782
-    $this->assertFalse($this->component->isa('FooFooBehavior'));
783
-    $this->assertFalse($this->component->isa(new FooBarBehavior));
784
-    $this->assertFalse($this->component->isa('FooBarBehavior'));
779
+	$this->assertFalse($this->component->isa(new FooBehavior));
780
+	$this->assertFalse($this->component->isa('FooBehavior'));
781
+	$this->assertFalse($this->component->isa(new FooFooBehavior));
782
+	$this->assertFalse($this->component->isa('FooFooBehavior'));
783
+	$this->assertFalse($this->component->isa(new FooBarBehavior));
784
+	$this->assertFalse($this->component->isa('FooBarBehavior'));
785 785
 
786 786
   }
787 787
 
788 788
   public function testIsA_with_IInstanceCheck() {
789 789
 
790
-    $this->assertTrue($this->component->isa('NewComponent'));
791
-    $this->assertFalse($this->component->isa('PreBarBehavior'));
790
+	$this->assertTrue($this->component->isa('NewComponent'));
791
+	$this->assertFalse($this->component->isa('PreBarBehavior'));
792 792
 
793
-    $this->component->attachBehavior('BarBehavior', $behavior = new BarBehavior);
793
+	$this->component->attachBehavior('BarBehavior', $behavior = new BarBehavior);
794 794
 
795
-    $behavior->setInstanceReturn(null);
795
+	$behavior->setInstanceReturn(null);
796 796
 
797
-    $this->assertTrue($this->component->isa('NewComponent'));
798
-    $this->assertTrue($this->component->isa('PreBarBehavior'));
799
-    $this->assertFalse($this->component->isa('FooBehavior'));
797
+	$this->assertTrue($this->component->isa('NewComponent'));
798
+	$this->assertTrue($this->component->isa('PreBarBehavior'));
799
+	$this->assertFalse($this->component->isa('FooBehavior'));
800 800
 
801
-    // This forces the iso on the BarBehavior to respond to any class with false
802
-    $behavior->setInstanceReturn(false);
803
-    $this->assertFalse($this->component->isa('PreBarBehavior'));
804
-    $this->assertFalse($this->component->isa('FooBehavior'));
801
+	// This forces the iso on the BarBehavior to respond to any class with false
802
+	$behavior->setInstanceReturn(false);
803
+	$this->assertFalse($this->component->isa('PreBarBehavior'));
804
+	$this->assertFalse($this->component->isa('FooBehavior'));
805 805
 
806
-    //This forces the isa on the BarBehavior to respond to any class with true
807
-    $behavior->setInstanceReturn(true);
808
-    $this->assertTrue($this->component->isa('FooBehavior'));
806
+	//This forces the isa on the BarBehavior to respond to any class with true
807
+	$behavior->setInstanceReturn(true);
808
+	$this->assertTrue($this->component->isa('FooBehavior'));
809 809
 
810 810
 
811 811
   }
812 812
 
813 813
   public function testAttachDetachBehavior() {
814 814
 
815
-    try {
815
+	try {
816 816
 	  $this->component->faaEverMore(true, true);
817
-      $this->fail('TApplicationException not raised trying to execute a undefined class method');
818
-    } catch(TApplicationException $e) {}
819
-
820
-    $this->assertNull($this->component->asa('FooBehavior'));
821
-    $this->assertFalse($this->component->isa('FooBehavior'));
822
-    $this->assertNull($this->component->asa('BarBehavior'));
823
-    $this->assertFalse($this->component->isa('BarBehavior'));
824
-
825
-    try {
826
-      $this->component->attachBehavior('FooBehavior', new TComponent);
827
-      $this->fail('TApplicationException not raised trying to execute a undefined class method');
828
-    } catch(TInvalidDataTypeException $e) {}
829
-
830
-    $this->component->attachBehavior('FooBehavior', new FooBehavior);
831
-
832
-    $this->assertNotNull($this->component->asa('FooBehavior'));
833
-    $this->assertTrue($this->component->isa('FooBehavior'));
834
-    $this->assertNull($this->component->asa('BarBehavior'));
835
-    $this->assertFalse($this->component->isa('BarBehavior'));
836
-
837
-    try {
838
-	    $this->assertTrue($this->component->faaEverMore(true, true));
839
-    } catch(TApplicationException $e) {
840
-      $this->fail('TApplicationException raised while trying to execute a behavior class method');
841
-    }
817
+	  $this->fail('TApplicationException not raised trying to execute a undefined class method');
818
+	} catch(TApplicationException $e) {}
819
+
820
+	$this->assertNull($this->component->asa('FooBehavior'));
821
+	$this->assertFalse($this->component->isa('FooBehavior'));
822
+	$this->assertNull($this->component->asa('BarBehavior'));
823
+	$this->assertFalse($this->component->isa('BarBehavior'));
824
+
825
+	try {
826
+	  $this->component->attachBehavior('FooBehavior', new TComponent);
827
+	  $this->fail('TApplicationException not raised trying to execute a undefined class method');
828
+	} catch(TInvalidDataTypeException $e) {}
829
+
830
+	$this->component->attachBehavior('FooBehavior', new FooBehavior);
831
+
832
+	$this->assertNotNull($this->component->asa('FooBehavior'));
833
+	$this->assertTrue($this->component->isa('FooBehavior'));
834
+	$this->assertNull($this->component->asa('BarBehavior'));
835
+	$this->assertFalse($this->component->isa('BarBehavior'));
836
+
837
+	try {
838
+		$this->assertTrue($this->component->faaEverMore(true, true));
839
+	} catch(TApplicationException $e) {
840
+	  $this->fail('TApplicationException raised while trying to execute a behavior class method');
841
+	}
842 842
 
843
-    try {
843
+	try {
844 844
 	  $this->component->noMethodHere(true);
845
-      $this->fail('TApplicationException not raised trying to execute a undefined class method');
846
-    } catch(TApplicationException $e) {}
845
+	  $this->fail('TApplicationException not raised trying to execute a undefined class method');
846
+	} catch(TApplicationException $e) {}
847 847
 
848
-    $this->assertTrue($this->component->disableBehavior('FooBehavior'));
848
+	$this->assertTrue($this->component->disableBehavior('FooBehavior'));
849 849
 
850
-    //BarBehavior is not a behavior at this time
851
-    $this->assertNull($this->component->disableBehavior('BarBehavior'));
850
+	//BarBehavior is not a behavior at this time
851
+	$this->assertNull($this->component->disableBehavior('BarBehavior'));
852 852
 
853
-    try {
853
+	try {
854 854
 	  $this->component->faaEverMore(true, true);
855
-      $this->fail('TApplicationException not raised trying to execute a undefined class method');
856
-    } catch(TApplicationException $e) {}
855
+	  $this->fail('TApplicationException not raised trying to execute a undefined class method');
856
+	} catch(TApplicationException $e) {}
857 857
 
858
-    $this->assertTrue($this->component->enableBehavior('FooBehavior'));
858
+	$this->assertTrue($this->component->enableBehavior('FooBehavior'));
859 859
 
860
-    //BarBehavior is not a behavior at this time
861
-    $this->assertNull($this->component->enableBehavior('BarBehavior'));
860
+	//BarBehavior is not a behavior at this time
861
+	$this->assertNull($this->component->enableBehavior('BarBehavior'));
862 862
 
863
-    try {
864
-	    $this->assertTrue($this->component->faaEverMore(true, true));
865
-    } catch(TApplicationException $e) {
866
-      $this->fail('TApplicationException raised while trying to execute a behavior class method');
867
-    }
863
+	try {
864
+		$this->assertTrue($this->component->faaEverMore(true, true));
865
+	} catch(TApplicationException $e) {
866
+	  $this->fail('TApplicationException raised while trying to execute a behavior class method');
867
+	}
868 868
 
869
-    $this->component->detachBehavior('FooBehavior');
869
+	$this->component->detachBehavior('FooBehavior');
870 870
 
871
-    $this->assertNull($this->component->asa('FooBehavior'));
872
-    $this->assertFalse($this->component->isa('FooBehavior'));
873
-    $this->assertNull($this->component->asa('BarBehavior'));
874
-    $this->assertFalse($this->component->isa('BarBehavior'));
871
+	$this->assertNull($this->component->asa('FooBehavior'));
872
+	$this->assertFalse($this->component->isa('FooBehavior'));
873
+	$this->assertNull($this->component->asa('BarBehavior'));
874
+	$this->assertFalse($this->component->isa('BarBehavior'));
875 875
 
876 876
   }
877 877
 
878 878
   public function testAttachDetachBehaviors() {
879
-    $this->assertNull($this->component->asa('FooBehavior'));
880
-    $this->assertNull($this->component->asa('BarBehavior'));
881
-    $this->assertNull($this->component->asa('FooBarBehavior'));
882
-    $this->assertNull($this->component->asa('PreBarBehavior'));
879
+	$this->assertNull($this->component->asa('FooBehavior'));
880
+	$this->assertNull($this->component->asa('BarBehavior'));
881
+	$this->assertNull($this->component->asa('FooBarBehavior'));
882
+	$this->assertNull($this->component->asa('PreBarBehavior'));
883 883
 
884
-    $this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior, 'PreBarBehavior' => new PreBarBehavior));
884
+	$this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior, 'PreBarBehavior' => new PreBarBehavior));
885 885
 
886
-    $this->assertNull($this->component->asa('FooBehavior'));
887
-    $this->assertNotNull($this->component->asa('FooFooBehavior'));
888
-    $this->assertNotNull($this->component->asa('BarBehavior'));
889
-    $this->assertNull($this->component->asa('FooBarBehavior'));
890
-    $this->assertNotNull($this->component->asa('PreBarBehavior'));
886
+	$this->assertNull($this->component->asa('FooBehavior'));
887
+	$this->assertNotNull($this->component->asa('FooFooBehavior'));
888
+	$this->assertNotNull($this->component->asa('BarBehavior'));
889
+	$this->assertNull($this->component->asa('FooBarBehavior'));
890
+	$this->assertNotNull($this->component->asa('PreBarBehavior'));
891 891
 
892
-    $this->assertTrue($this->component->isa('FooFooBehavior'));
893
-    $this->assertTrue($this->component->isa('FooBehavior'));
894
-    $this->assertTrue($this->component->isa('BarBehavior'));
895
-    $this->assertTrue($this->component->isa('PreBarBehavior'));
896
-    $this->assertFalse($this->component->isa('FooBarBehavior'));
892
+	$this->assertTrue($this->component->isa('FooFooBehavior'));
893
+	$this->assertTrue($this->component->isa('FooBehavior'));
894
+	$this->assertTrue($this->component->isa('BarBehavior'));
895
+	$this->assertTrue($this->component->isa('PreBarBehavior'));
896
+	$this->assertFalse($this->component->isa('FooBarBehavior'));
897 897
 
898
-    $this->component->detachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior));
898
+	$this->component->detachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior));
899 899
 
900
-    $this->assertNull($this->component->asa('FooBehavior'));
901
-    $this->assertNull($this->component->asa('FooFooBehavior'));
902
-    $this->assertNull($this->component->asa('BarBehavior'));
903
-    $this->assertNull($this->component->asa('FooBarBehavior'));
904
-    $this->assertNotNull($this->component->asa('PreBarBehavior'));
900
+	$this->assertNull($this->component->asa('FooBehavior'));
901
+	$this->assertNull($this->component->asa('FooFooBehavior'));
902
+	$this->assertNull($this->component->asa('BarBehavior'));
903
+	$this->assertNull($this->component->asa('FooBarBehavior'));
904
+	$this->assertNotNull($this->component->asa('PreBarBehavior'));
905 905
 
906
-    $this->assertFalse($this->component->isa('FooFooBehavior'));
907
-    $this->assertFalse($this->component->isa('FooBehavior'));
908
-    $this->assertFalse($this->component->isa('BarBehavior'));
909
-    $this->assertFalse($this->component->isa('FooBarBehavior'));
910
-    $this->assertTrue($this->component->isa('PreBarBehavior'));
906
+	$this->assertFalse($this->component->isa('FooFooBehavior'));
907
+	$this->assertFalse($this->component->isa('FooBehavior'));
908
+	$this->assertFalse($this->component->isa('BarBehavior'));
909
+	$this->assertFalse($this->component->isa('FooBarBehavior'));
910
+	$this->assertTrue($this->component->isa('PreBarBehavior'));
911 911
 
912 912
 
913 913
 
914
-    //	testing if we can detachBehaviors just by the name of the behavior instead of an array of the behavior
915
-    $this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior));
914
+	//	testing if we can detachBehaviors just by the name of the behavior instead of an array of the behavior
915
+	$this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior));
916 916
 
917
-    $this->assertTrue($this->component->isa('FooBehavior'));
918
-    $this->assertTrue($this->component->isa('BarBehavior'));
917
+	$this->assertTrue($this->component->isa('FooBehavior'));
918
+	$this->assertTrue($this->component->isa('BarBehavior'));
919 919
 
920
-    $this->component->detachBehaviors(array('FooFooBehavior', 'BarBehavior'));
920
+	$this->component->detachBehaviors(array('FooFooBehavior', 'BarBehavior'));
921 921
 
922
-    $this->assertNull($this->component->asa('FooBehavior'));
923
-    $this->assertNull($this->component->asa('FooFooBehavior'));
924
-    $this->assertNull($this->component->asa('BarBehavior'));
925
-    $this->assertNull($this->component->asa('FooBarBehavior'));
922
+	$this->assertNull($this->component->asa('FooBehavior'));
923
+	$this->assertNull($this->component->asa('FooFooBehavior'));
924
+	$this->assertNull($this->component->asa('BarBehavior'));
925
+	$this->assertNull($this->component->asa('FooBarBehavior'));
926 926
 
927
-    $this->assertFalse($this->component->isa('FooFooBehavior'));
928
-    $this->assertFalse($this->component->isa('FooBehavior'));
929
-    $this->assertFalse($this->component->isa('BarBehavior'));
930
-    $this->assertFalse($this->component->isa('FooBarBehavior'));
927
+	$this->assertFalse($this->component->isa('FooFooBehavior'));
928
+	$this->assertFalse($this->component->isa('FooBehavior'));
929
+	$this->assertFalse($this->component->isa('BarBehavior'));
930
+	$this->assertFalse($this->component->isa('FooBarBehavior'));
931 931
   }
932 932
 
933 933
 
934 934
   public function testClearBehaviors() {
935 935
 
936
-    $this->assertNull($this->component->asa('FooBehavior'));
937
-    $this->assertNull($this->component->asa('BarBehavior'));
938
-    $this->assertNull($this->component->asa('FooBarBehavior'));
939
-    $this->assertNull($this->component->asa('PreBarBehavior'));
936
+	$this->assertNull($this->component->asa('FooBehavior'));
937
+	$this->assertNull($this->component->asa('BarBehavior'));
938
+	$this->assertNull($this->component->asa('FooBarBehavior'));
939
+	$this->assertNull($this->component->asa('PreBarBehavior'));
940 940
 
941
-    $this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior, 'PreBarBehavior' => new PreBarBehavior));
941
+	$this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior, 'PreBarBehavior' => new PreBarBehavior));
942 942
 
943
-    $this->assertNull($this->component->asa('FooBehavior'));
944
-    $this->assertNotNull($this->component->asa('FooFooBehavior'));
945
-    $this->assertNotNull($this->component->asa('BarBehavior'));
946
-    $this->assertNull($this->component->asa('FooBarBehavior'));
947
-    $this->assertNotNull($this->component->asa('PreBarBehavior'));
943
+	$this->assertNull($this->component->asa('FooBehavior'));
944
+	$this->assertNotNull($this->component->asa('FooFooBehavior'));
945
+	$this->assertNotNull($this->component->asa('BarBehavior'));
946
+	$this->assertNull($this->component->asa('FooBarBehavior'));
947
+	$this->assertNotNull($this->component->asa('PreBarBehavior'));
948 948
 
949
-    $this->component->clearBehaviors();
949
+	$this->component->clearBehaviors();
950 950
 
951
-    $this->assertNull($this->component->asa('FooBehavior'));
952
-    $this->assertNull($this->component->asa('BarBehavior'));
953
-    $this->assertNull($this->component->asa('FooBarBehavior'));
954
-    $this->assertNull($this->component->asa('PreBarBehavior'));
951
+	$this->assertNull($this->component->asa('FooBehavior'));
952
+	$this->assertNull($this->component->asa('BarBehavior'));
953
+	$this->assertNull($this->component->asa('FooBarBehavior'));
954
+	$this->assertNull($this->component->asa('PreBarBehavior'));
955 955
   }
956 956
 
957 957
   public function testEnableDisableBehavior() {
958 958
 
959
-    $this->assertNull($this->component->enableBehavior('FooBehavior'));
960
-    $this->assertNull($this->component->disableBehavior('FooBehavior'));
959
+	$this->assertNull($this->component->enableBehavior('FooBehavior'));
960
+	$this->assertNull($this->component->disableBehavior('FooBehavior'));
961 961
 
962
-    try {
962
+	try {
963 963
 	  $this->component->faaEverMore(true, true);
964
-      $this->fail('TApplicationException not raised trying to execute a undefined class method');
965
-    } catch(TApplicationException $e) {}
964
+	  $this->fail('TApplicationException not raised trying to execute a undefined class method');
965
+	} catch(TApplicationException $e) {}
966 966
 
967
-    $this->component->attachBehavior('FooBehavior', new FooBehavior);
967
+	$this->component->attachBehavior('FooBehavior', new FooBehavior);
968 968
 
969
-    $this->assertTrue($this->component->isa('FooBehavior'));
970
-    try {
971
-	    $this->assertTrue($this->component->faaEverMore(true, true));
972
-    } catch(TApplicationException $e) {
973
-      $this->fail('TApplicationException raised while trying to execute a behavior class method');
974
-    }
969
+	$this->assertTrue($this->component->isa('FooBehavior'));
970
+	try {
971
+		$this->assertTrue($this->component->faaEverMore(true, true));
972
+	} catch(TApplicationException $e) {
973
+	  $this->fail('TApplicationException raised while trying to execute a behavior class method');
974
+	}
975 975
 
976
-    $this->assertTrue($this->component->disableBehavior('FooBehavior'));
976
+	$this->assertTrue($this->component->disableBehavior('FooBehavior'));
977 977
 
978
-    $this->assertFalse($this->component->isa('FooBehavior'));
978
+	$this->assertFalse($this->component->isa('FooBehavior'));
979 979
 
980
-    try {
980
+	try {
981 981
 	  $this->component->faaEverMore(true, true);
982
-      $this->fail('TApplicationException not raised trying to execute a undefined class method');
983
-    } catch(TApplicationException $e) {}
982
+	  $this->fail('TApplicationException not raised trying to execute a undefined class method');
983
+	} catch(TApplicationException $e) {}
984 984
 
985
-    $this->assertTrue($this->component->enableBehavior('FooBehavior'));
985
+	$this->assertTrue($this->component->enableBehavior('FooBehavior'));
986 986
 
987
-    $this->assertTrue($this->component->isa('FooBehavior'));
988
-    try {
989
-	    $this->assertTrue($this->component->faaEverMore(true, true));
990
-    } catch(TApplicationException $e) {
991
-      $this->fail('TApplicationException raised while trying to execute a behavior class method');
992
-    }
987
+	$this->assertTrue($this->component->isa('FooBehavior'));
988
+	try {
989
+		$this->assertTrue($this->component->faaEverMore(true, true));
990
+	} catch(TApplicationException $e) {
991
+	  $this->fail('TApplicationException raised while trying to execute a behavior class method');
992
+	}
993 993
 
994 994
 
995 995
 
996
-    $this->assertNull($this->component->enableBehavior('BarClassBehavior'));
997
-    $this->assertNull($this->component->disableBehavior('BarClassBehavior'));
996
+	$this->assertNull($this->component->enableBehavior('BarClassBehavior'));
997
+	$this->assertNull($this->component->disableBehavior('BarClassBehavior'));
998 998
 
999
-    try {
999
+	try {
1000 1000
 	  $this->component->moreFunction(true, true);
1001
-      $this->fail('TApplicationException not raised trying to execute an undefined class method');
1002
-    } catch(TApplicationException $e) {}
1001
+	  $this->fail('TApplicationException not raised trying to execute an undefined class method');
1002
+	} catch(TApplicationException $e) {}
1003 1003
 
1004
-    $this->component->attachClassBehavior('BarClassBehavior', new BarClassBehavior);
1004
+	$this->component->attachClassBehavior('BarClassBehavior', new BarClassBehavior);
1005 1005
 
1006
-    $this->assertFalse($this->component->enableBehavior('BarClassBehavior'));
1007
-    $this->assertFalse($this->component->disableBehavior('BarClassBehavior'));
1006
+	$this->assertFalse($this->component->enableBehavior('BarClassBehavior'));
1007
+	$this->assertFalse($this->component->disableBehavior('BarClassBehavior'));
1008 1008
 
1009
-    try {
1010
-	    $this->assertTrue($this->component->moreFunction(true, true));
1011
-    } catch(TApplicationException $e) {
1012
-      $this->fail('TApplicationException raised while trying to execute a behavior class method');
1013
-    }
1009
+	try {
1010
+		$this->assertTrue($this->component->moreFunction(true, true));
1011
+	} catch(TApplicationException $e) {
1012
+	  $this->fail('TApplicationException raised while trying to execute a behavior class method');
1013
+	}
1014 1014
 
1015
-    $this->component->detachClassBehavior('BarClassBehavior');
1015
+	$this->component->detachClassBehavior('BarClassBehavior');
1016 1016
   }
1017 1017
 
1018 1018
 
1019 1019
   public function testBehaviorFunctionCalls() {
1020 1020
 
1021
-    $this->component->attachBehavior('FooBarBehavior', $behavior = new FooBarBehavior);
1022
-    $this->component->attachClassBehavior('FooClassBehavior', $classbehavior = new FooClassBehavior);
1021
+	$this->component->attachBehavior('FooBarBehavior', $behavior = new FooBarBehavior);
1022
+	$this->component->attachClassBehavior('FooClassBehavior', $classbehavior = new FooClassBehavior);
1023 1023
 
1024
-    // Test the Class Methods
1025
-    $this->assertEquals(12, $this->component->faaEverMore(3, 4));
1024
+	// Test the Class Methods
1025
+	$this->assertEquals(12, $this->component->faaEverMore(3, 4));
1026 1026
 
1027
-    // Check that the called object is shifted in front of the array of a class behavior call
1028
-    $this->assertEquals($this->component, $this->component->getLastClassObject());
1027
+	// Check that the called object is shifted in front of the array of a class behavior call
1028
+	$this->assertEquals($this->component, $this->component->getLastClassObject());
1029 1029
 
1030 1030
 
1031
-    //Test the FooBarBehavior
1032
-    $this->assertEquals(27, $this->component->moreFunction(3, 3));
1031
+	//Test the FooBarBehavior
1032
+	$this->assertEquals(27, $this->component->moreFunction(3, 3));
1033 1033
 
1034
-    $this->assertTrue($this->component->disableBehavior('FooBarBehavior'));
1035
-    try {
1036
-	    $this->assertNull($this->component->moreFunction(3, 4));
1037
-      	$this->fail('TApplicationException not raised trying to execute a disabled behavior');
1038
-    } catch(TApplicationException $e) {}
1039
-    $this->assertTrue($this->component->enableBehavior('FooBarBehavior'));
1034
+	$this->assertTrue($this->component->disableBehavior('FooBarBehavior'));
1035
+	try {
1036
+		$this->assertNull($this->component->moreFunction(3, 4));
1037
+	  	$this->fail('TApplicationException not raised trying to execute a disabled behavior');
1038
+	} catch(TApplicationException $e) {}
1039
+	$this->assertTrue($this->component->enableBehavior('FooBarBehavior'));
1040 1040
 
1041 1041
 	// Test the global event space, this should work and return false because no function implements these methods
1042
-    $this->assertNull($this->component->fxSomeUndefinedGlobalEvent());
1043
-    $this->assertNull($this->component->dySomeUndefinedIntraObjectEvent());
1042
+	$this->assertNull($this->component->fxSomeUndefinedGlobalEvent());
1043
+	$this->assertNull($this->component->dySomeUndefinedIntraObjectEvent());
1044 1044
 
1045
-    $this->component->detachClassBehavior('FooClassBehavior');
1045
+	$this->component->detachClassBehavior('FooClassBehavior');
1046 1046
 
1047 1047
 
1048 1048
 
1049
-    // test object instance behaviors implemented through class-wide behaviors
1050
-    $this->component->attachClassBehavior('FooFooBehaviorAsClass', 'FooFooBehavior');
1049
+	// test object instance behaviors implemented through class-wide behaviors
1050
+	$this->component->attachClassBehavior('FooFooBehaviorAsClass', 'FooFooBehavior');
1051 1051
 
1052
-    $component = new NewComponent;
1052
+	$component = new NewComponent;
1053 1053
 
1054
-    $this->assertEquals(5, $this->component->faafaaEverMore(3, 4));
1055
-    $this->assertEquals(10, $component->faafaaEverMore(6, 8));
1054
+	$this->assertEquals(5, $this->component->faafaaEverMore(3, 4));
1055
+	$this->assertEquals(10, $component->faafaaEverMore(6, 8));
1056 1056
 
1057
-    $this->component->detachClassBehavior('FooFooBehaviorAsClass');
1058
-    $component->unlisten();
1059
-    $component = null;
1057
+	$this->component->detachClassBehavior('FooFooBehaviorAsClass');
1058
+	$component->unlisten();
1059
+	$component = null;
1060 1060
 
1061
-    try {
1062
-    	$this->component->faafaaEverMore(3, 4);
1063
-      	$this->fail('TApplicationException not raised trying to execute a disabled behavior');
1064
-    } catch(TApplicationException $e) {}
1061
+	try {
1062
+		$this->component->faafaaEverMore(3, 4);
1063
+	  	$this->fail('TApplicationException not raised trying to execute a disabled behavior');
1064
+	} catch(TApplicationException $e) {}
1065 1065
 
1066 1066
 
1067 1067
 
1068
-    // make a call to an unpatched fx and dy call so that it's passed through to the __dycall function
1069
-    $dynamicComponent = new DynamicCallComponent;
1068
+	// make a call to an unpatched fx and dy call so that it's passed through to the __dycall function
1069
+	$dynamicComponent = new DynamicCallComponent;
1070 1070
 
1071
-    $this->assertNull($dynamicComponent->fxUndefinedEvent());
1072
-    $this->assertNull($dynamicComponent->dyUndefinedEvent());
1071
+	$this->assertNull($dynamicComponent->fxUndefinedEvent());
1072
+	$this->assertNull($dynamicComponent->dyUndefinedEvent());
1073 1073
 
1074
-    //This tests the dynamic __dycall function
1075
-    $this->assertEquals(1024, $dynamicComponent->dyPowerFunction(2, 10));
1076
-    $this->assertEquals(5, $dynamicComponent->dyDivisionFunction(10, 2));
1074
+	//This tests the dynamic __dycall function
1075
+	$this->assertEquals(1024, $dynamicComponent->dyPowerFunction(2, 10));
1076
+	$this->assertEquals(5, $dynamicComponent->dyDivisionFunction(10, 2));
1077 1077
 
1078
-    $this->assertEquals(2048, $dynamicComponent->fxPowerFunction(2, 10));
1079
-    $this->assertEquals(10, $dynamicComponent->fxDivisionFunction(10, 2));
1078
+	$this->assertEquals(2048, $dynamicComponent->fxPowerFunction(2, 10));
1079
+	$this->assertEquals(10, $dynamicComponent->fxDivisionFunction(10, 2));
1080 1080
 
1081
-    $dynamicComponent->unlisten();
1081
+	$dynamicComponent->unlisten();
1082 1082
 
1083 1083
   }
1084 1084
 
1085 1085
 
1086 1086
   public function testHasProperty() {
1087
-    $this->assertTrue($this->component->hasProperty('Text'), "Component hasn't property Text");
1088
-    $this->assertTrue($this->component->hasProperty('text'), "Component hasn't property text");
1089
-    $this->assertFalse($this->component->hasProperty('Caption'), "Component has property Caption");
1090
-
1091
-    $this->assertTrue($this->component->hasProperty('ColorAttribute'), "Component hasn't property JsColorAttribute");
1092
-    $this->assertTrue($this->component->hasProperty('colorattribute'), "Component hasn't property JsColorAttribute");
1093
-    $this->assertFalse($this->component->canGetProperty('PastelAttribute'), "Component has property JsPastelAttribute");
1094
-
1095
-    $this->assertTrue($this->component->hasProperty('JSColorAttribute'), "Component hasn't property JsColorAttribute");
1096
-    $this->assertTrue($this->component->hasProperty('jscolorattribute'), "Component hasn't property JsColorAttribute");
1097
-    $this->assertFalse($this->component->hasProperty('jsPastelAttribute'), "Component has property JsPastelAttribute");
1098
-
1099
-    $this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1100
-    $this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
1101
-    $this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
1102
-    $this->component->disableBehaviors();
1103
-    $this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1104
-    $this->component->enableBehaviors();
1105
-    $this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
1106
-    $this->component->disableBehavior('ExcitementPropBehavior');
1107
-    $this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1108
-    $this->component->enableBehavior('ExcitementPropBehavior');
1109
-    $this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
1110
-
1111
-    $this->component->detachBehavior('ExcitementPropBehavior');
1112
-
1113
-    $this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1087
+	$this->assertTrue($this->component->hasProperty('Text'), "Component hasn't property Text");
1088
+	$this->assertTrue($this->component->hasProperty('text'), "Component hasn't property text");
1089
+	$this->assertFalse($this->component->hasProperty('Caption'), "Component has property Caption");
1090
+
1091
+	$this->assertTrue($this->component->hasProperty('ColorAttribute'), "Component hasn't property JsColorAttribute");
1092
+	$this->assertTrue($this->component->hasProperty('colorattribute'), "Component hasn't property JsColorAttribute");
1093
+	$this->assertFalse($this->component->canGetProperty('PastelAttribute'), "Component has property JsPastelAttribute");
1094
+
1095
+	$this->assertTrue($this->component->hasProperty('JSColorAttribute'), "Component hasn't property JsColorAttribute");
1096
+	$this->assertTrue($this->component->hasProperty('jscolorattribute'), "Component hasn't property JsColorAttribute");
1097
+	$this->assertFalse($this->component->hasProperty('jsPastelAttribute'), "Component has property JsPastelAttribute");
1098
+
1099
+	$this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1100
+	$this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
1101
+	$this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
1102
+	$this->component->disableBehaviors();
1103
+	$this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1104
+	$this->component->enableBehaviors();
1105
+	$this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
1106
+	$this->component->disableBehavior('ExcitementPropBehavior');
1107
+	$this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1108
+	$this->component->enableBehavior('ExcitementPropBehavior');
1109
+	$this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
1110
+
1111
+	$this->component->detachBehavior('ExcitementPropBehavior');
1112
+
1113
+	$this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
1114 1114
 
1115 1115
   }
1116 1116
 
1117 1117
   public function testCanGetProperty() {
1118
-    $this->assertTrue($this->component->canGetProperty('Text'));
1119
-    $this->assertTrue($this->component->canGetProperty('text'));
1120
-    $this->assertFalse($this->component->canGetProperty('Caption'));
1121
-
1122
-    $this->assertTrue($this->component->canGetProperty('ColorAttribute'));
1123
-    $this->assertTrue($this->component->canGetProperty('colorattribute'));
1124
-    $this->assertFalse($this->component->canGetProperty('PastelAttribute'));
1125
-
1126
-    $this->assertTrue($this->component->canGetProperty('JSColorAttribute'));
1127
-    $this->assertTrue($this->component->canGetProperty('jscolorattribute'));
1128
-    $this->assertFalse($this->component->canGetProperty('jsPastelAttribute'));
1129
-
1130
-
1131
-    $this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1132
-    $this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
1133
-    $this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
1134
-    $this->component->disableBehaviors();
1135
-    $this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1136
-    $this->component->enableBehaviors();
1137
-    $this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
1138
-    $this->component->disableBehavior('ExcitementPropBehavior');
1139
-    $this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1140
-    $this->component->enableBehavior('ExcitementPropBehavior');
1141
-    $this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
1142
-
1143
-    $this->component->detachBehavior('ExcitementPropBehavior');
1144
-
1145
-    $this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1118
+	$this->assertTrue($this->component->canGetProperty('Text'));
1119
+	$this->assertTrue($this->component->canGetProperty('text'));
1120
+	$this->assertFalse($this->component->canGetProperty('Caption'));
1121
+
1122
+	$this->assertTrue($this->component->canGetProperty('ColorAttribute'));
1123
+	$this->assertTrue($this->component->canGetProperty('colorattribute'));
1124
+	$this->assertFalse($this->component->canGetProperty('PastelAttribute'));
1125
+
1126
+	$this->assertTrue($this->component->canGetProperty('JSColorAttribute'));
1127
+	$this->assertTrue($this->component->canGetProperty('jscolorattribute'));
1128
+	$this->assertFalse($this->component->canGetProperty('jsPastelAttribute'));
1129
+
1130
+
1131
+	$this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1132
+	$this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
1133
+	$this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
1134
+	$this->component->disableBehaviors();
1135
+	$this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1136
+	$this->component->enableBehaviors();
1137
+	$this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
1138
+	$this->component->disableBehavior('ExcitementPropBehavior');
1139
+	$this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1140
+	$this->component->enableBehavior('ExcitementPropBehavior');
1141
+	$this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
1142
+
1143
+	$this->component->detachBehavior('ExcitementPropBehavior');
1144
+
1145
+	$this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
1146 1146
   }
1147 1147
 
1148 1148
   public function testCanSetProperty() {
1149
-    $this->assertTrue($this->component->canSetProperty('Text'));
1150
-    $this->assertTrue($this->component->canSetProperty('text'));
1151
-    $this->assertFalse($this->component->canSetProperty('Caption'));
1152
-
1153
-    $this->assertTrue($this->component->canSetProperty('ColorAttribute'));
1154
-    $this->assertTrue($this->component->canSetProperty('colorattribute'));
1155
-    $this->assertFalse($this->component->canSetProperty('PastelAttribute'));
1156
-
1157
-    $this->assertTrue($this->component->canSetProperty('JSColorAttribute'));
1158
-    $this->assertTrue($this->component->canSetProperty('jscolorattribute'));
1159
-    $this->assertFalse($this->component->canSetProperty('jsPastelAttribute'));
1160
-
1161
-    $this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
1162
-    $this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
1163
-    $this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
1164
-    $this->component->disableBehaviors();
1165
-    $this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
1166
-    $this->component->enableBehaviors();
1167
-    $this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
1168
-    $this->component->disableBehavior('ExcitementPropBehavior');
1169
-    $this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
1170
-    $this->component->enableBehavior('ExcitementPropBehavior');
1171
-    $this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
1172
-
1173
-    $this->component->detachBehavior('ExcitementPropBehavior');
1149
+	$this->assertTrue($this->component->canSetProperty('Text'));
1150
+	$this->assertTrue($this->component->canSetProperty('text'));
1151
+	$this->assertFalse($this->component->canSetProperty('Caption'));
1152
+
1153
+	$this->assertTrue($this->component->canSetProperty('ColorAttribute'));
1154
+	$this->assertTrue($this->component->canSetProperty('colorattribute'));
1155
+	$this->assertFalse($this->component->canSetProperty('PastelAttribute'));
1156
+
1157
+	$this->assertTrue($this->component->canSetProperty('JSColorAttribute'));
1158
+	$this->assertTrue($this->component->canSetProperty('jscolorattribute'));
1159
+	$this->assertFalse($this->component->canSetProperty('jsPastelAttribute'));
1160
+
1161
+	$this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
1162
+	$this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
1163
+	$this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
1164
+	$this->component->disableBehaviors();
1165
+	$this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
1166
+	$this->component->enableBehaviors();
1167
+	$this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
1168
+	$this->component->disableBehavior('ExcitementPropBehavior');
1169
+	$this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
1170
+	$this->component->enableBehavior('ExcitementPropBehavior');
1171
+	$this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
1172
+
1173
+	$this->component->detachBehavior('ExcitementPropBehavior');
1174 1174
   }
1175 1175
 
1176 1176
   public function testGetProperty() {
1177
-    $this->assertTrue('default'===$this->component->Text);
1178
-    try {
1179
-      $value2=$this->component->Caption;
1180
-      $this->fail('exception not raised when getting undefined property');
1181
-    } catch(TInvalidOperationException $e) {
1182
-    }
1177
+	$this->assertTrue('default'===$this->component->Text);
1178
+	try {
1179
+	  $value2=$this->component->Caption;
1180
+	  $this->fail('exception not raised when getting undefined property');
1181
+	} catch(TInvalidOperationException $e) {
1182
+	}
1183 1183
 
1184
-    $this->assertTrue($this->component->OnMyEvent instanceof TPriorityList);
1185
-    try {
1186
-      $value2=$this->component->onUndefinedEvent;
1187
-      $this->fail('exception not raised when getting undefined property');
1188
-    } catch(TInvalidOperationException $e) {
1189
-    }
1184
+	$this->assertTrue($this->component->OnMyEvent instanceof TPriorityList);
1185
+	try {
1186
+	  $value2=$this->component->onUndefinedEvent;
1187
+	  $this->fail('exception not raised when getting undefined property');
1188
+	} catch(TInvalidOperationException $e) {
1189
+	}
1190 1190
 
1191
-    //Without the function parenthesis, the function is _not_ called but the __get
1192
-    //	method is called and the global events (list) are accessed
1193
-    $this->assertTrue($this->component->fxAttachClassBehavior instanceof TPriorityList);
1194
-    $this->assertTrue($this->component->fxDetachClassBehavior instanceof TPriorityList);
1191
+	//Without the function parenthesis, the function is _not_ called but the __get
1192
+	//	method is called and the global events (list) are accessed
1193
+	$this->assertTrue($this->component->fxAttachClassBehavior instanceof TPriorityList);
1194
+	$this->assertTrue($this->component->fxDetachClassBehavior instanceof TPriorityList);
1195 1195
 
1196
-    // even undefined global events have a list as every object is able to access every event
1197
-    $this->assertTrue($this->component->fxUndefinedEvent instanceof TPriorityList);
1196
+	// even undefined global events have a list as every object is able to access every event
1197
+	$this->assertTrue($this->component->fxUndefinedEvent instanceof TPriorityList);
1198 1198
 
1199 1199
 
1200
-    // Test the behaviors within the __get function
1201
-    $this->component->enableBehaviors();
1200
+	// Test the behaviors within the __get function
1201
+	$this->component->enableBehaviors();
1202 1202
 
1203
-    try {
1204
-      $value2=$this->component->Excitement;
1205
-      $this->fail('exception not raised when getting undefined property');
1206
-    } catch(TInvalidOperationException $e) {
1207
-    }
1203
+	try {
1204
+	  $value2=$this->component->Excitement;
1205
+	  $this->fail('exception not raised when getting undefined property');
1206
+	} catch(TInvalidOperationException $e) {
1207
+	}
1208 1208
 
1209
-    $this->component->attachBehavior('BehaviorTestBehavior', $behavior = new BehaviorTestBehavior);
1210
-    $this->assertEquals('faa', $this->component->Excitement);
1209
+	$this->component->attachBehavior('BehaviorTestBehavior', $behavior = new BehaviorTestBehavior);
1210
+	$this->assertEquals('faa', $this->component->Excitement);
1211 1211
 
1212
-    $this->component->disableBehaviors();
1212
+	$this->component->disableBehaviors();
1213 1213
 
1214
-    try {
1215
-      $this->assertEquals('faa', $this->component->Excitement);
1216
-      $this->fail('exception not raised when getting undefined property');
1217
-    } catch(TInvalidOperationException $e) {
1218
-    }
1214
+	try {
1215
+	  $this->assertEquals('faa', $this->component->Excitement);
1216
+	  $this->fail('exception not raised when getting undefined property');
1217
+	} catch(TInvalidOperationException $e) {
1218
+	}
1219 1219
 
1220
-    $this->component->enableBehaviors();
1221
-    $this->assertEquals('faa', $this->component->getExcitement());
1220
+	$this->component->enableBehaviors();
1221
+	$this->assertEquals('faa', $this->component->getExcitement());
1222 1222
 
1223
-    $this->component->disableBehavior('BehaviorTestBehavior');
1223
+	$this->component->disableBehavior('BehaviorTestBehavior');
1224 1224
 
1225
-    $this->assertEquals($behavior, $this->component->BehaviorTestBehavior);
1226
-    try {
1227
-	      $behavior = $this->component->BehaviorTestBehavior2;
1228
-	      $this->fail('exception not raised when getting undefined property');
1229
-	    } catch(TInvalidOperationException $e) {
1230
-    }
1225
+	$this->assertEquals($behavior, $this->component->BehaviorTestBehavior);
1226
+	try {
1227
+		  $behavior = $this->component->BehaviorTestBehavior2;
1228
+		  $this->fail('exception not raised when getting undefined property');
1229
+		} catch(TInvalidOperationException $e) {
1230
+	}
1231 1231
 
1232
-    try {
1233
-      $this->assertEquals('faa', $this->component->Excitement);
1234
-      $this->fail('exception not raised when getting undefined property');
1235
-    } catch(TInvalidOperationException $e) {
1236
-    }
1237
-    $this->component->enableBehavior('BehaviorTestBehavior');
1238
-    $this->assertEquals('faa', $this->component->getExcitement());
1232
+	try {
1233
+	  $this->assertEquals('faa', $this->component->Excitement);
1234
+	  $this->fail('exception not raised when getting undefined property');
1235
+	} catch(TInvalidOperationException $e) {
1236
+	}
1237
+	$this->component->enableBehavior('BehaviorTestBehavior');
1238
+	$this->assertEquals('faa', $this->component->getExcitement());
1239 1239
 
1240 1240
 
1241
-    // behaviors allow on and fx events to be passed through.
1242
-    $this->assertTrue($this->component->onBehaviorEvent instanceof TPriorityList);
1241
+	// behaviors allow on and fx events to be passed through.
1242
+	$this->assertTrue($this->component->onBehaviorEvent instanceof TPriorityList);
1243 1243
 
1244 1244
   }
1245 1245
 
1246 1246
   public function testSetProperty() {
1247
-    $value='new value';
1248
-    $this->component->Text=$value;
1249
-    $text=$this->component->Text;
1250
-    $this->assertTrue($value===$this->component->Text);
1251
-    try {
1252
-      $this->component->NewMember=$value;
1253
-      $this->fail('exception not raised when setting undefined property');
1254
-    } catch(TInvalidOperationException $e) {
1255
-    }
1256
-
1257
-    // Test get only properties is a set function
1258
-    try {
1259
-      $this->component->ReadOnlyProperty = 'setting read only';
1260
-      $this->fail('a property without a set function was set to a new value without error');
1261
-    } catch(TInvalidOperationException $e) {
1262
-    }
1263
-
1264
-    try {
1265
-      $this->component->ReadOnlyJsProperty = 'jssetting read only';
1266
-      $this->fail('a js property without a set function was set to a new value without error');
1267
-    } catch(TInvalidOperationException $e) {
1268
-    }
1269
-
1270
-    try {
1271
-      $this->component->JsReadOnlyJsProperty = 'jssetting read only';
1272
-      $this->fail('a js property without a set function was set to a new value without error');
1273
-    } catch(TInvalidOperationException $e) {
1274
-    }
1275
-
1276
-    $this->assertEquals(0, $this->component->getEventHandlers('onMyEvent')->getCount());
1277
-    $this->component->onMyEvent = array($this->component,'myEventHandler');
1278
-    $this->assertEquals(1, $this->component->getEventHandlers('onMyEvent')->getCount());
1279
-    $this->component->onMyEvent[] = array($this->component,'Object.myEventHandler');
1280
-    $this->assertEquals(2, $this->component->getEventHandlers('onMyEvent')->getCount());
1281
-
1282
-    $this->component->getEventHandlers('onMyEvent')->clear();
1283
-
1284
-    // Test the behaviors within the __get function
1285
-    $this->component->enableBehaviors();
1286
-
1287
-    try {
1288
-      $this->component->Excitement = 'laa';
1289
-      $this->fail('exception not raised when getting undefined property');
1290
-    } catch(TInvalidOperationException $e) {
1291
-    }
1292
-
1293
-    $this->component->attachBehavior('BehaviorTestBehavior', $behavior1 = new BehaviorTestBehavior);
1294
-    $this->component->Excitement = 'laa';
1295
-    $this->assertEquals('laa', $this->component->Excitement);
1296
-    $this->assertEquals('sol', $this->component->Excitement = 'sol');
1297
-
1298
-
1299
-    $this->component->disableBehaviors();
1300
-
1301
-    try {
1302
-      $this->component->Excitement = false;
1303
-      $this->assertEquals(false, $this->component->Excitement);
1304
-      $this->fail('exception not raised when getting undefined property');
1305
-    } catch(TInvalidOperationException $e) {
1306
-    }
1307
-
1308
-    $this->component->enableBehaviors();
1309
-    $this->component->Excitement = 'faa';
1310
-    $this->assertEquals('faa', $this->component->getExcitement());
1311
-
1312
-    $this->component->disableBehavior('BehaviorTestBehavior');
1313
-
1314
-    try {
1315
-      $this->component->Excitement = false;
1316
-      $this->assertEquals(false, $this->component->Excitement);
1317
-      $this->fail('exception not raised when getting undefined property');
1318
-    } catch(TInvalidOperationException $e) {
1319
-    }
1320
-    $this->component->enableBehavior('BehaviorTestBehavior');
1321
-    $this->component->Excitement = 'sol';
1322
-    $this->assertEquals('sol', $this->component->Excitement);
1323
-
1324
-
1325
-    $this->component->attachBehavior('BehaviorTestBehavior2', $behavior2 = new BehaviorTestBehavior);
1326
-
1327
-    $this->assertEquals('sol', $this->component->Excitement);
1328
-    $this->assertEquals('faa', $behavior2->Excitement);
1329
-
1330
-    // this sets Excitement for both because they are not uniquely named
1331
-    $this->component->Excitement = 'befaad';
1332
-
1333
-    $this->assertEquals('befaad', $this->component->Excitement);
1334
-    $this->assertEquals('befaad', $behavior1->Excitement);
1335
-    $this->assertEquals('befaad', $behavior2->Excitement);
1336
-
1337
-
1338
-    $this->component->detachBehavior('BehaviorTestBehavior2');
1339
-
1340
-    // behaviors allow on and fx events to be passed through.
1341
-    $this->assertTrue($this->component->BehaviorTestBehavior->onBehaviorEvent instanceof TPriorityList);
1342
-
1343
-    $this->assertEquals(0, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
1344
-    $this->component->onBehaviorEvent = array($this->component,'myEventHandler');
1345
-    $this->assertEquals(1, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
1346
-    $this->component->onBehaviorEvent[] = array($this->component,'Object.myEventHandler');
1347
-    $this->assertEquals(2, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
1348
-
1349
-    $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->clear();
1247
+	$value='new value';
1248
+	$this->component->Text=$value;
1249
+	$text=$this->component->Text;
1250
+	$this->assertTrue($value===$this->component->Text);
1251
+	try {
1252
+	  $this->component->NewMember=$value;
1253
+	  $this->fail('exception not raised when setting undefined property');
1254
+	} catch(TInvalidOperationException $e) {
1255
+	}
1256
+
1257
+	// Test get only properties is a set function
1258
+	try {
1259
+	  $this->component->ReadOnlyProperty = 'setting read only';
1260
+	  $this->fail('a property without a set function was set to a new value without error');
1261
+	} catch(TInvalidOperationException $e) {
1262
+	}
1263
+
1264
+	try {
1265
+	  $this->component->ReadOnlyJsProperty = 'jssetting read only';
1266
+	  $this->fail('a js property without a set function was set to a new value without error');
1267
+	} catch(TInvalidOperationException $e) {
1268
+	}
1269
+
1270
+	try {
1271
+	  $this->component->JsReadOnlyJsProperty = 'jssetting read only';
1272
+	  $this->fail('a js property without a set function was set to a new value without error');
1273
+	} catch(TInvalidOperationException $e) {
1274
+	}
1275
+
1276
+	$this->assertEquals(0, $this->component->getEventHandlers('onMyEvent')->getCount());
1277
+	$this->component->onMyEvent = array($this->component,'myEventHandler');
1278
+	$this->assertEquals(1, $this->component->getEventHandlers('onMyEvent')->getCount());
1279
+	$this->component->onMyEvent[] = array($this->component,'Object.myEventHandler');
1280
+	$this->assertEquals(2, $this->component->getEventHandlers('onMyEvent')->getCount());
1281
+
1282
+	$this->component->getEventHandlers('onMyEvent')->clear();
1283
+
1284
+	// Test the behaviors within the __get function
1285
+	$this->component->enableBehaviors();
1286
+
1287
+	try {
1288
+	  $this->component->Excitement = 'laa';
1289
+	  $this->fail('exception not raised when getting undefined property');
1290
+	} catch(TInvalidOperationException $e) {
1291
+	}
1292
+
1293
+	$this->component->attachBehavior('BehaviorTestBehavior', $behavior1 = new BehaviorTestBehavior);
1294
+	$this->component->Excitement = 'laa';
1295
+	$this->assertEquals('laa', $this->component->Excitement);
1296
+	$this->assertEquals('sol', $this->component->Excitement = 'sol');
1297
+
1298
+
1299
+	$this->component->disableBehaviors();
1300
+
1301
+	try {
1302
+	  $this->component->Excitement = false;
1303
+	  $this->assertEquals(false, $this->component->Excitement);
1304
+	  $this->fail('exception not raised when getting undefined property');
1305
+	} catch(TInvalidOperationException $e) {
1306
+	}
1307
+
1308
+	$this->component->enableBehaviors();
1309
+	$this->component->Excitement = 'faa';
1310
+	$this->assertEquals('faa', $this->component->getExcitement());
1311
+
1312
+	$this->component->disableBehavior('BehaviorTestBehavior');
1313
+
1314
+	try {
1315
+	  $this->component->Excitement = false;
1316
+	  $this->assertEquals(false, $this->component->Excitement);
1317
+	  $this->fail('exception not raised when getting undefined property');
1318
+	} catch(TInvalidOperationException $e) {
1319
+	}
1320
+	$this->component->enableBehavior('BehaviorTestBehavior');
1321
+	$this->component->Excitement = 'sol';
1322
+	$this->assertEquals('sol', $this->component->Excitement);
1323
+
1324
+
1325
+	$this->component->attachBehavior('BehaviorTestBehavior2', $behavior2 = new BehaviorTestBehavior);
1326
+
1327
+	$this->assertEquals('sol', $this->component->Excitement);
1328
+	$this->assertEquals('faa', $behavior2->Excitement);
1329
+
1330
+	// this sets Excitement for both because they are not uniquely named
1331
+	$this->component->Excitement = 'befaad';
1332
+
1333
+	$this->assertEquals('befaad', $this->component->Excitement);
1334
+	$this->assertEquals('befaad', $behavior1->Excitement);
1335
+	$this->assertEquals('befaad', $behavior2->Excitement);
1336
+
1337
+
1338
+	$this->component->detachBehavior('BehaviorTestBehavior2');
1339
+
1340
+	// behaviors allow on and fx events to be passed through.
1341
+	$this->assertTrue($this->component->BehaviorTestBehavior->onBehaviorEvent instanceof TPriorityList);
1342
+
1343
+	$this->assertEquals(0, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
1344
+	$this->component->onBehaviorEvent = array($this->component,'myEventHandler');
1345
+	$this->assertEquals(1, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
1346
+	$this->component->onBehaviorEvent[] = array($this->component,'Object.myEventHandler');
1347
+	$this->assertEquals(2, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
1348
+
1349
+	$this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->clear();
1350 1350
   }
1351 1351
 
1352 1352
 
1353 1353
   public function testIsSetFunction() {
1354
-    $this->assertTrue(isset($this->component->fxAttachClassBehavior));
1355
-    $this->component->unlisten();
1354
+	$this->assertTrue(isset($this->component->fxAttachClassBehavior));
1355
+	$this->component->unlisten();
1356 1356
 
1357
-    $this->assertFalse(isset($this->component->onMyEvent));
1358
-    $this->assertFalse(isset($this->component->undefinedEvent));
1359
-    $this->assertFalse(isset($this->component->fxAttachClassBehavior));
1357
+	$this->assertFalse(isset($this->component->onMyEvent));
1358
+	$this->assertFalse(isset($this->component->undefinedEvent));
1359
+	$this->assertFalse(isset($this->component->fxAttachClassBehavior));
1360 1360
 
1361
-    $this->assertFalse(isset($this->component->BehaviorTestBehavior));
1362
-    $this->assertFalse(isset($this->component->onBehaviorEvent));
1361
+	$this->assertFalse(isset($this->component->BehaviorTestBehavior));
1362
+	$this->assertFalse(isset($this->component->onBehaviorEvent));
1363 1363
 
1364
-    $this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1364
+	$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1365 1365
 
1366
-    $this->assertTrue(isset($this->component->BehaviorTestBehavior));
1367
-    $this->assertFalse(isset($this->component->onBehaviorEvent));
1366
+	$this->assertTrue(isset($this->component->BehaviorTestBehavior));
1367
+	$this->assertFalse(isset($this->component->onBehaviorEvent));
1368 1368
 
1369
-    $this->component->attachEventHandler('onBehaviorEvent','foo');
1370
-    $this->assertTrue(isset($this->component->onBehaviorEvent));
1369
+	$this->component->attachEventHandler('onBehaviorEvent','foo');
1370
+	$this->assertTrue(isset($this->component->onBehaviorEvent));
1371 1371
 
1372
-    $this->component->attachEventHandler('onMyEvent','foo');
1373
-    $this->assertTrue(isset($this->component->onMyEvent));
1372
+	$this->component->attachEventHandler('onMyEvent','foo');
1373
+	$this->assertTrue(isset($this->component->onMyEvent));
1374 1374
 
1375
-    $this->assertTrue(isset($this->component->Excitement));
1376
-    $this->component->Excitement = null;
1377
-    $this->assertFalse(isset($this->component->Excitement));
1378
-    $this->assertFalse(isset($this->component->UndefinedBehaviorProperty));
1375
+	$this->assertTrue(isset($this->component->Excitement));
1376
+	$this->component->Excitement = null;
1377
+	$this->assertFalse(isset($this->component->Excitement));
1378
+	$this->assertFalse(isset($this->component->UndefinedBehaviorProperty));
1379 1379
 
1380 1380
 
1381 1381
   }
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
  	// object events
1393 1393
  	$this->assertEquals(0, $this->component->onMyEvent->Count);
1394
-    $this->component->attachEventHandler('onMyEvent','foo');
1394
+	$this->component->attachEventHandler('onMyEvent','foo');
1395 1395
  	$this->assertEquals(1, $this->component->onMyEvent->Count);
1396 1396
  	unset($this->component->onMyEvent);
1397 1397
  	$this->assertEquals(0, $this->component->onMyEvent->Count);
@@ -1407,10 +1407,10 @@  discard block
 block discarded – undo
1407 1407
 
1408 1408
   	try {
1409 1409
 	  	unset($this->component->Object);
1410
-    	$this->fail('TInvalidOperationException not raised when unsetting get only property');
1410
+		$this->fail('TInvalidOperationException not raised when unsetting get only property');
1411 1411
   	} catch(TInvalidOperationException $e) {}
1412 1412
 
1413
-    $this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1413
+	$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1414 1414
  	$this->assertTrue($this->component->asa('BehaviorTestBehavior') instanceof BehaviorTestBehavior);
1415 1415
  	$this->assertFalse($this->component->asa('BehaviorTestBehavior2') instanceof BehaviorTestBehavior);
1416 1416
 
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 
1437 1437
   	try {
1438 1438
 	  	unset($this->component->ReadOnly);
1439
-    	$this->fail('TInvalidOperationException not raised when unsetting get only property');
1439
+		$this->fail('TInvalidOperationException not raised when unsetting get only property');
1440 1440
   	} catch(TInvalidOperationException $e) {}
1441 1441
 
1442 1442
   	$this->component->onBehaviorEvent = 'foo';
@@ -1453,338 +1453,338 @@  discard block
 block discarded – undo
1453 1453
   }
1454 1454
 
1455 1455
   public function testGetSubProperty() {
1456
-    $this->assertTrue('object text'===$this->component->getSubProperty('Object.Text'));
1456
+	$this->assertTrue('object text'===$this->component->getSubProperty('Object.Text'));
1457 1457
   }
1458 1458
 
1459 1459
   public function testSetSubProperty() {
1460
-    $this->component->setSubProperty('Object.Text','new object text');
1461
-    $this->assertEquals('new object text',$this->component->getSubProperty('Object.Text'));
1460
+	$this->component->setSubProperty('Object.Text','new object text');
1461
+	$this->assertEquals('new object text',$this->component->getSubProperty('Object.Text'));
1462 1462
   }
1463 1463
 
1464 1464
   public function testHasEvent() {
1465
-    $this->assertTrue($this->component->hasEvent('OnMyEvent'));
1466
-    $this->assertTrue($this->component->hasEvent('onmyevent'));
1467
-    $this->assertFalse($this->component->hasEvent('onYourEvent'));
1465
+	$this->assertTrue($this->component->hasEvent('OnMyEvent'));
1466
+	$this->assertTrue($this->component->hasEvent('onmyevent'));
1467
+	$this->assertFalse($this->component->hasEvent('onYourEvent'));
1468 1468
 
1469
-    // fx won't throw an error if any of these fx function are called on an object.
1470
-    //	It is a special prefix event designation that every object responds to all events.
1471
-    $this->assertTrue($this->component->hasEvent('fxAttachClassBehavior'));
1472
-    $this->assertTrue($this->component->hasEvent('fxattachclassbehavior'));
1469
+	// fx won't throw an error if any of these fx function are called on an object.
1470
+	//	It is a special prefix event designation that every object responds to all events.
1471
+	$this->assertTrue($this->component->hasEvent('fxAttachClassBehavior'));
1472
+	$this->assertTrue($this->component->hasEvent('fxattachclassbehavior'));
1473 1473
 
1474
-    $this->assertTrue($this->component->hasEvent('fxNonExistantGlobalEvent'));
1475
-    $this->assertTrue($this->component->hasEvent('fxnonexistantglobalevent'));
1474
+	$this->assertTrue($this->component->hasEvent('fxNonExistantGlobalEvent'));
1475
+	$this->assertTrue($this->component->hasEvent('fxnonexistantglobalevent'));
1476 1476
 
1477
-    $this->assertTrue($this->component->hasEvent('dyNonExistantLocalEvent'));
1478
-    $this->assertTrue($this->component->hasEvent('fxnonexistantlocalevent'));
1477
+	$this->assertTrue($this->component->hasEvent('dyNonExistantLocalEvent'));
1478
+	$this->assertTrue($this->component->hasEvent('fxnonexistantlocalevent'));
1479 1479
 
1480 1480
 
1481
-    //Test behavior events
1482
-    $this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
1483
-    $this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1484
-    $this->assertTrue($this->component->hasEvent('onBehaviorEvent'));
1485
-    $this->assertTrue($this->component->BehaviorTestBehavior->hasEvent('onBehaviorEvent'));
1481
+	//Test behavior events
1482
+	$this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
1483
+	$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1484
+	$this->assertTrue($this->component->hasEvent('onBehaviorEvent'));
1485
+	$this->assertTrue($this->component->BehaviorTestBehavior->hasEvent('onBehaviorEvent'));
1486 1486
 
1487
-    $this->component->disableBehavior('BehaviorTestBehavior');
1488
-    $this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
1489
-    $this->component->enableBehavior('BehaviorTestBehavior');
1490
-    $this->assertTrue($this->component->hasEvent('onBehaviorEvent'));
1487
+	$this->component->disableBehavior('BehaviorTestBehavior');
1488
+	$this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
1489
+	$this->component->enableBehavior('BehaviorTestBehavior');
1490
+	$this->assertTrue($this->component->hasEvent('onBehaviorEvent'));
1491 1491
   }
1492 1492
 
1493 1493
   public function testHasEventHandler() {
1494
-    $this->assertFalse($this->component->hasEventHandler('OnMyEvent'));
1495
-    $this->component->attachEventHandler('OnMyEvent','foo');
1496
-    $this->assertTrue($this->component->hasEventHandler('OnMyEvent'));
1497
-
1498
-    $this->assertFalse($this->component->hasEventHandler('fxNonExistantGlobalEvent'));
1499
-    $this->component->attachEventHandler('fxNonExistantGlobalEvent','foo');
1500
-    $this->assertTrue($this->component->hasEventHandler('fxNonExistantGlobalEvent'));
1501
-
1502
-    //Test behavior events
1503
-    $this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1504
-    $this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1505
-    $this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1506
-    $this->assertFalse($this->component->BehaviorTestBehavior->hasEventHandler('onBehaviorEvent'));
1507
-
1508
-    $this->component->attachEventHandler('onBehaviorEvent','foo');
1509
-    $this->assertTrue($this->component->hasEventHandler('onBehaviorEvent'));
1510
-
1511
-    $this->component->disableBehavior('BehaviorTestBehavior');
1512
-    $this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
1513
-    $this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1514
-    $this->component->enableBehavior('BehaviorTestBehavior');
1515
-    $this->assertTrue($this->component->hasEvent('onBehaviorEvent'));
1516
-    $this->assertTrue($this->component->hasEventHandler('onBehaviorEvent'));
1494
+	$this->assertFalse($this->component->hasEventHandler('OnMyEvent'));
1495
+	$this->component->attachEventHandler('OnMyEvent','foo');
1496
+	$this->assertTrue($this->component->hasEventHandler('OnMyEvent'));
1497
+
1498
+	$this->assertFalse($this->component->hasEventHandler('fxNonExistantGlobalEvent'));
1499
+	$this->component->attachEventHandler('fxNonExistantGlobalEvent','foo');
1500
+	$this->assertTrue($this->component->hasEventHandler('fxNonExistantGlobalEvent'));
1501
+
1502
+	//Test behavior events
1503
+	$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1504
+	$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1505
+	$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1506
+	$this->assertFalse($this->component->BehaviorTestBehavior->hasEventHandler('onBehaviorEvent'));
1507
+
1508
+	$this->component->attachEventHandler('onBehaviorEvent','foo');
1509
+	$this->assertTrue($this->component->hasEventHandler('onBehaviorEvent'));
1510
+
1511
+	$this->component->disableBehavior('BehaviorTestBehavior');
1512
+	$this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
1513
+	$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1514
+	$this->component->enableBehavior('BehaviorTestBehavior');
1515
+	$this->assertTrue($this->component->hasEvent('onBehaviorEvent'));
1516
+	$this->assertTrue($this->component->hasEventHandler('onBehaviorEvent'));
1517 1517
   }
1518 1518
 
1519 1519
   public function testGetEventHandlers() {
1520
-    $list=$this->component->getEventHandlers('OnMyEvent');
1521
-    $this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
1522
-    $this->component->attachEventHandler('OnMyEvent','foo');
1523
-    $this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===1));
1524
-    try {
1525
-      $list=$this->component->getEventHandlers('YourEvent');
1526
-      $this->fail('exception not raised when getting event handlers for undefined event');
1527
-    } catch(TInvalidOperationException $e) {
1528
-    }
1529
-
1530
-    $list=$this->component->getEventHandlers('fxRandomEvent');
1531
-    $this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
1532
-    $this->component->attachEventHandler('fxRandomEvent','foo');
1533
-    $this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===1));
1534
-    try {
1535
-      $list=$this->component->getEventHandlers('fxSomeUndefinedGlobalEvent');
1536
-    } catch(TInvalidOperationException $e) {
1537
-      $this->fail('exception raised when getting event handlers for universal global event');
1538
-    }
1539
-
1540
-
1541
-
1542
-    //Test behavior events
1543
-    try {
1544
-      $list=$this->component->getEventHandlers('onBehaviorEvent');
1545
-      $this->fail('exception not raised when getting event handlers for undefined event');
1546
-    } catch(TInvalidOperationException $e) {
1547
-    }
1548
-    $this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1549
-
1550
-    $this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1551
-    $list=$this->component->getEventHandlers('onBehaviorEvent');
1552
-    $this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
1553
-    $this->component->attachEventHandler('onBehaviorEvent','foo');
1554
-    $this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===1));
1555
-
1556
-    $this->component->disableBehavior('BehaviorTestBehavior');
1557
-    try {
1558
-      $list=$this->component->getEventHandlers('onBehaviorEvent');
1559
-      $this->fail('exception not raised when getting event handlers for undefined event');
1560
-    } catch(TInvalidOperationException $e) {
1561
-    }
1562
-    $this->component->enableBehavior('BehaviorTestBehavior');
1563
-    $this->assertTrue(($this->component->getEventHandlers('onBehaviorEvent') instanceof TPriorityList) && ($list->getCount()===1));
1520
+	$list=$this->component->getEventHandlers('OnMyEvent');
1521
+	$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
1522
+	$this->component->attachEventHandler('OnMyEvent','foo');
1523
+	$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===1));
1524
+	try {
1525
+	  $list=$this->component->getEventHandlers('YourEvent');
1526
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1527
+	} catch(TInvalidOperationException $e) {
1528
+	}
1529
+
1530
+	$list=$this->component->getEventHandlers('fxRandomEvent');
1531
+	$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
1532
+	$this->component->attachEventHandler('fxRandomEvent','foo');
1533
+	$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===1));
1534
+	try {
1535
+	  $list=$this->component->getEventHandlers('fxSomeUndefinedGlobalEvent');
1536
+	} catch(TInvalidOperationException $e) {
1537
+	  $this->fail('exception raised when getting event handlers for universal global event');
1538
+	}
1539
+
1540
+
1541
+
1542
+	//Test behavior events
1543
+	try {
1544
+	  $list=$this->component->getEventHandlers('onBehaviorEvent');
1545
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1546
+	} catch(TInvalidOperationException $e) {
1547
+	}
1548
+	$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
1549
+
1550
+	$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1551
+	$list=$this->component->getEventHandlers('onBehaviorEvent');
1552
+	$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
1553
+	$this->component->attachEventHandler('onBehaviorEvent','foo');
1554
+	$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===1));
1555
+
1556
+	$this->component->disableBehavior('BehaviorTestBehavior');
1557
+	try {
1558
+	  $list=$this->component->getEventHandlers('onBehaviorEvent');
1559
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1560
+	} catch(TInvalidOperationException $e) {
1561
+	}
1562
+	$this->component->enableBehavior('BehaviorTestBehavior');
1563
+	$this->assertTrue(($this->component->getEventHandlers('onBehaviorEvent') instanceof TPriorityList) && ($list->getCount()===1));
1564 1564
 
1565 1565
   }
1566 1566
 
1567 1567
   public function testAttachEventHandler() {
1568 1568
 
1569
-    $this->component->attachEventHandler('OnMyEvent','foo');
1570
-    $this->assertEquals(1, $this->component->getEventHandlers('OnMyEvent')->getCount());
1571
-    try {
1572
-      $this->component->attachEventHandler('YourEvent','foo');
1573
-      $this->fail('exception not raised when attaching event handlers for undefined event');
1574
-    } catch(TInvalidOperationException $e) {
1575
-    }
1576
-
1577
-    //Testing the priorities of attaching events
1578
-    $this->component->attachEventHandler('OnMyEvent','foopre', 5);
1579
-    $this->component->attachEventHandler('OnMyEvent','foopost', 15);
1580
-    $this->component->attachEventHandler('OnMyEvent','foobar', 10);
1581
-    $this->assertEquals(4, $this->component->getEventHandlers('OnMyEvent')->getCount());
1582
-    $list = $this->component->getEventHandlers('OnMyEvent');
1583
-    $this->assertEquals('foopre', $list[0]);
1584
-    $this->assertEquals('foo', $list[1]);
1585
-    $this->assertEquals('foobar', $list[2]);
1586
-    $this->assertEquals('foopost', $list[3]);
1587
-
1588
-
1589
-    //Test attaching behavior events
1590
-    try {
1591
-      $this->component->attachEventHandler('onBehaviorEvent','foo');
1592
-      $this->fail('exception not raised when getting event handlers for undefined event');
1593
-    } catch(TInvalidOperationException $e) {
1594
-    }
1595
-    $this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1596
-
1597
-    $this->component->attachEventHandler('onBehaviorEvent','foo');
1598
-
1599
-    //Testing the priorities of attaching behavior events
1600
-    $this->component->attachEventHandler('onBehaviorEvent','foopre', 5);
1601
-    $this->component->attachEventHandler('onBehaviorEvent','foopost', 15);
1602
-    $this->component->attachEventHandler('onBehaviorEvent','foobar', 10);
1603
-    $this->component->attachEventHandler('onBehaviorEvent','foobarfoobar', 10);
1604
-    $this->assertEquals(5, $this->component->getEventHandlers('onBehaviorEvent')->getCount());
1605
-    $list = $this->component->getEventHandlers('onBehaviorEvent');
1606
-    $this->assertEquals('foopre', $list[0]);
1607
-    $this->assertEquals('foo', $list[1]);
1608
-    $this->assertEquals('foobar', $list[2]);
1609
-    $this->assertEquals('foobarfoobar', $list[3]);
1610
-    $this->assertEquals('foopost', $list[4]);
1611
-
1612
-    $this->component->disableBehavior('BehaviorTestBehavior');
1613
-    try {
1614
-      $this->component->attachEventHandler('onBehaviorEvent','bar');
1615
-      $this->fail('exception not raised when getting event handlers for undefined event');
1616
-    } catch(TInvalidOperationException $e) {
1617
-    }
1618
-    $this->component->enableBehavior('BehaviorTestBehavior');
1569
+	$this->component->attachEventHandler('OnMyEvent','foo');
1570
+	$this->assertEquals(1, $this->component->getEventHandlers('OnMyEvent')->getCount());
1571
+	try {
1572
+	  $this->component->attachEventHandler('YourEvent','foo');
1573
+	  $this->fail('exception not raised when attaching event handlers for undefined event');
1574
+	} catch(TInvalidOperationException $e) {
1575
+	}
1576
+
1577
+	//Testing the priorities of attaching events
1578
+	$this->component->attachEventHandler('OnMyEvent','foopre', 5);
1579
+	$this->component->attachEventHandler('OnMyEvent','foopost', 15);
1580
+	$this->component->attachEventHandler('OnMyEvent','foobar', 10);
1581
+	$this->assertEquals(4, $this->component->getEventHandlers('OnMyEvent')->getCount());
1582
+	$list = $this->component->getEventHandlers('OnMyEvent');
1583
+	$this->assertEquals('foopre', $list[0]);
1584
+	$this->assertEquals('foo', $list[1]);
1585
+	$this->assertEquals('foobar', $list[2]);
1586
+	$this->assertEquals('foopost', $list[3]);
1587
+
1588
+
1589
+	//Test attaching behavior events
1590
+	try {
1591
+	  $this->component->attachEventHandler('onBehaviorEvent','foo');
1592
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1593
+	} catch(TInvalidOperationException $e) {
1594
+	}
1595
+	$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1596
+
1597
+	$this->component->attachEventHandler('onBehaviorEvent','foo');
1598
+
1599
+	//Testing the priorities of attaching behavior events
1600
+	$this->component->attachEventHandler('onBehaviorEvent','foopre', 5);
1601
+	$this->component->attachEventHandler('onBehaviorEvent','foopost', 15);
1602
+	$this->component->attachEventHandler('onBehaviorEvent','foobar', 10);
1603
+	$this->component->attachEventHandler('onBehaviorEvent','foobarfoobar', 10);
1604
+	$this->assertEquals(5, $this->component->getEventHandlers('onBehaviorEvent')->getCount());
1605
+	$list = $this->component->getEventHandlers('onBehaviorEvent');
1606
+	$this->assertEquals('foopre', $list[0]);
1607
+	$this->assertEquals('foo', $list[1]);
1608
+	$this->assertEquals('foobar', $list[2]);
1609
+	$this->assertEquals('foobarfoobar', $list[3]);
1610
+	$this->assertEquals('foopost', $list[4]);
1611
+
1612
+	$this->component->disableBehavior('BehaviorTestBehavior');
1613
+	try {
1614
+	  $this->component->attachEventHandler('onBehaviorEvent','bar');
1615
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1616
+	} catch(TInvalidOperationException $e) {
1617
+	}
1618
+	$this->component->enableBehavior('BehaviorTestBehavior');
1619 1619
 
1620 1620
   }
1621 1621
 
1622 1622
   public function testDetachEventHandler() {
1623 1623
 
1624
-    $this->component->attachEventHandler('OnMyEvent','foo');
1625
-    $this->assertEquals(1, $this->component->getEventHandlers('OnMyEvent')->getCount());
1624
+	$this->component->attachEventHandler('OnMyEvent','foo');
1625
+	$this->assertEquals(1, $this->component->getEventHandlers('OnMyEvent')->getCount());
1626 1626
 
1627
-    $this->component->attachEventHandler('OnMyEvent','foopre', 5);
1628
-    $this->component->attachEventHandler('OnMyEvent','foopost', 15);
1629
-    $this->component->attachEventHandler('OnMyEvent','foobar', 10);
1630
-    $this->component->attachEventHandler('OnMyEvent','foobarfoobar', 10);
1627
+	$this->component->attachEventHandler('OnMyEvent','foopre', 5);
1628
+	$this->component->attachEventHandler('OnMyEvent','foopost', 15);
1629
+	$this->component->attachEventHandler('OnMyEvent','foobar', 10);
1630
+	$this->component->attachEventHandler('OnMyEvent','foobarfoobar', 10);
1631 1631
 
1632 1632
 
1633 1633
 
1634
-    $this->component->detachEventHandler('OnMyEvent','foo');
1635
-    $list = $this->component->getEventHandlers('OnMyEvent');
1636
-    $this->assertEquals(4, $list->getCount());
1634
+	$this->component->detachEventHandler('OnMyEvent','foo');
1635
+	$list = $this->component->getEventHandlers('OnMyEvent');
1636
+	$this->assertEquals(4, $list->getCount());
1637 1637
 
1638
-    $this->assertEquals('foopre', $list[0]);
1639
-    $this->assertEquals('foobar', $list[1]);
1640
-    $this->assertEquals('foobarfoobar', $list[2]);
1641
-    $this->assertEquals('foopost', $list[3]);
1638
+	$this->assertEquals('foopre', $list[0]);
1639
+	$this->assertEquals('foobar', $list[1]);
1640
+	$this->assertEquals('foobarfoobar', $list[2]);
1641
+	$this->assertEquals('foopost', $list[3]);
1642 1642
 
1643
-    $this->component->detachEventHandler('OnMyEvent','foopre', null);
1644
-    $this->assertEquals(4, $list->getCount());
1643
+	$this->component->detachEventHandler('OnMyEvent','foopre', null);
1644
+	$this->assertEquals(4, $list->getCount());
1645 1645
 
1646
-    $this->component->detachEventHandler('OnMyEvent','foopre', 5);
1647
-    $this->assertEquals(3, $list->getCount());
1646
+	$this->component->detachEventHandler('OnMyEvent','foopre', 5);
1647
+	$this->assertEquals(3, $list->getCount());
1648 1648
 
1649 1649
 
1650
-    // Now do detaching of behavior on events
1651
-    try {
1652
-      $this->component->attachEventHandler('onBehaviorEvent','foo');
1653
-      $this->fail('exception not raised when getting event handlers for undefined event');
1654
-    } catch(TInvalidOperationException $e) {
1655
-    }
1656
-    $this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1650
+	// Now do detaching of behavior on events
1651
+	try {
1652
+	  $this->component->attachEventHandler('onBehaviorEvent','foo');
1653
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1654
+	} catch(TInvalidOperationException $e) {
1655
+	}
1656
+	$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
1657 1657
 
1658
-    $this->component->attachEventHandler('onBehaviorEvent','foo');
1659
-    $this->assertEquals(1, $this->component->getEventHandlers('onBehaviorEvent')->getCount());
1658
+	$this->component->attachEventHandler('onBehaviorEvent','foo');
1659
+	$this->assertEquals(1, $this->component->getEventHandlers('onBehaviorEvent')->getCount());
1660 1660
 
1661
-    $this->component->attachEventHandler('onBehaviorEvent','foopre', 5);
1662
-    $this->component->attachEventHandler('onBehaviorEvent','foopost', 15);
1663
-    $this->component->attachEventHandler('onBehaviorEvent','foobar', 10);
1664
-    $this->component->attachEventHandler('onBehaviorEvent','foobarfoobar', 10);
1661
+	$this->component->attachEventHandler('onBehaviorEvent','foopre', 5);
1662
+	$this->component->attachEventHandler('onBehaviorEvent','foopost', 15);
1663
+	$this->component->attachEventHandler('onBehaviorEvent','foobar', 10);
1664
+	$this->component->attachEventHandler('onBehaviorEvent','foobarfoobar', 10);
1665 1665
 
1666 1666
 
1667 1667
 
1668
-    $this->component->detachEventHandler('onBehaviorEvent','foo');
1669
-    $list = $this->component->getEventHandlers('onBehaviorEvent');
1670
-    $this->assertEquals(4, $list->getCount());
1668
+	$this->component->detachEventHandler('onBehaviorEvent','foo');
1669
+	$list = $this->component->getEventHandlers('onBehaviorEvent');
1670
+	$this->assertEquals(4, $list->getCount());
1671 1671
 
1672
-    $this->assertEquals('foopre', $list[0]);
1673
-    $this->assertEquals('foobar', $list[1]);
1674
-    $this->assertEquals('foobarfoobar', $list[2]);
1675
-    $this->assertEquals('foopost', $list[3]);
1672
+	$this->assertEquals('foopre', $list[0]);
1673
+	$this->assertEquals('foobar', $list[1]);
1674
+	$this->assertEquals('foobarfoobar', $list[2]);
1675
+	$this->assertEquals('foopost', $list[3]);
1676 1676
 
1677
-    $this->component->detachEventHandler('onBehaviorEvent','foopre', null);
1678
-    $this->assertEquals(4, $list->getCount());
1677
+	$this->component->detachEventHandler('onBehaviorEvent','foopre', null);
1678
+	$this->assertEquals(4, $list->getCount());
1679 1679
 
1680
-    $this->component->detachEventHandler('onBehaviorEvent','foopre', 5);
1681
-    $this->assertEquals(3, $list->getCount());
1680
+	$this->component->detachEventHandler('onBehaviorEvent','foopre', 5);
1681
+	$this->assertEquals(3, $list->getCount());
1682 1682
   }
1683 1683
 
1684 1684
 
1685 1685
 
1686 1686
 
1687 1687
   public function testRaiseEvent() {
1688
-    $this->component->attachEventHandler('OnMyEvent',array($this->component,'myEventHandler'));
1689
-    $this->assertFalse($this->component->isEventHandled());
1690
-    $this->component->raiseEvent('OnMyEvent',$this,null);
1691
-    $this->assertTrue($this->component->isEventHandled());
1692
-    $this->component->attachEventHandler('OnMyEvent',array($this->component,'Object.myEventHandler'));
1693
-    $this->assertFalse($this->component->Object->isEventHandled());
1694
-    $this->component->raiseEvent('OnMyEvent',$this,null);
1695
-    $this->assertTrue($this->component->Object->isEventHandled());
1688
+	$this->component->attachEventHandler('OnMyEvent',array($this->component,'myEventHandler'));
1689
+	$this->assertFalse($this->component->isEventHandled());
1690
+	$this->component->raiseEvent('OnMyEvent',$this,null);
1691
+	$this->assertTrue($this->component->isEventHandled());
1692
+	$this->component->attachEventHandler('OnMyEvent',array($this->component,'Object.myEventHandler'));
1693
+	$this->assertFalse($this->component->Object->isEventHandled());
1694
+	$this->component->raiseEvent('OnMyEvent',$this,null);
1695
+	$this->assertTrue($this->component->Object->isEventHandled());
1696 1696
 
1697
-    $this->component->resetEventHandled();
1698
-    $this->component->Object->resetEventHandled();
1697
+	$this->component->resetEventHandled();
1698
+	$this->component->Object->resetEventHandled();
1699 1699
 
1700 1700
 
1701
-    // Test a behavior on event
1702
-    $this->component->attachBehavior('test', new BehaviorTestBehavior);
1701
+	// Test a behavior on event
1702
+	$this->component->attachBehavior('test', new BehaviorTestBehavior);
1703 1703
 
1704
-    $this->component->attachEventHandler('onBehaviorEvent',array($this->component,'myEventHandler'));
1705
-    $this->assertFalse($this->component->isEventHandled());
1706
-    $this->component->raiseEvent('onBehaviorEvent',$this,null);
1707
-    $this->assertTrue($this->component->isEventHandled());
1708
-    $this->component->attachEventHandler('onBehaviorEvent',array($this->component,'Object.myEventHandler'));
1709
-    $this->assertFalse($this->component->Object->isEventHandled());
1710
-    $this->component->raiseEvent('onBehaviorEvent',$this,null);
1711
-    $this->assertTrue($this->component->Object->isEventHandled());
1704
+	$this->component->attachEventHandler('onBehaviorEvent',array($this->component,'myEventHandler'));
1705
+	$this->assertFalse($this->component->isEventHandled());
1706
+	$this->component->raiseEvent('onBehaviorEvent',$this,null);
1707
+	$this->assertTrue($this->component->isEventHandled());
1708
+	$this->component->attachEventHandler('onBehaviorEvent',array($this->component,'Object.myEventHandler'));
1709
+	$this->assertFalse($this->component->Object->isEventHandled());
1710
+	$this->component->raiseEvent('onBehaviorEvent',$this,null);
1711
+	$this->assertTrue($this->component->Object->isEventHandled());
1712 1712
 
1713
-    //test behavior enabled/disabled events
1714
-    $this->component->disableBehavior('test');
1713
+	//test behavior enabled/disabled events
1714
+	$this->component->disableBehavior('test');
1715 1715
 
1716
-    $this->component->resetEventHandled();
1717
-    $this->component->Object->resetEventHandled();
1716
+	$this->component->resetEventHandled();
1717
+	$this->component->Object->resetEventHandled();
1718 1718
 
1719
-    try {
1720
-    	$this->component->attachEventHandler('onBehaviorEvent',array($this->component,'myEventHandler'));
1721
-      $this->fail('exception not raised when getting event handlers for undefined event');
1722
-    } catch(TInvalidOperationException $e) {}
1723
-    $this->assertFalse($this->component->isEventHandled());
1724
-    try {
1725
-      $this->component->raiseEvent('onBehaviorEvent',$this,null);
1726
-      $this->fail('exception not raised when getting event handlers for undefined event');
1727
-    } catch(TInvalidOperationException $e) {}
1728
-    $this->assertFalse($this->component->isEventHandled());
1719
+	try {
1720
+		$this->component->attachEventHandler('onBehaviorEvent',array($this->component,'myEventHandler'));
1721
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1722
+	} catch(TInvalidOperationException $e) {}
1723
+	$this->assertFalse($this->component->isEventHandled());
1724
+	try {
1725
+	  $this->component->raiseEvent('onBehaviorEvent',$this,null);
1726
+	  $this->fail('exception not raised when getting event handlers for undefined event');
1727
+	} catch(TInvalidOperationException $e) {}
1728
+	$this->assertFalse($this->component->isEventHandled());
1729 1729
 
1730
-    $this->component->enableBehavior('test');
1730
+	$this->component->enableBehavior('test');
1731 1731
 
1732 1732
 
1733 1733
 
1734
-    //Test the return types of this function
1734
+	//Test the return types of this function
1735 1735
 
1736
-    $this->assertFalse($this->component->isEventHandled());
1737
-    $this->assertFalse($this->component->Object->isEventHandled());
1738
-    $this->assertEquals(array(), $this->component->onBehaviorEvent($this,$this->component));
1739
-    $this->assertTrue($this->component->isEventHandled());
1740
-    $this->assertTrue($this->component->Object->isEventHandled());
1736
+	$this->assertFalse($this->component->isEventHandled());
1737
+	$this->assertFalse($this->component->Object->isEventHandled());
1738
+	$this->assertEquals(array(), $this->component->onBehaviorEvent($this,$this->component));
1739
+	$this->assertTrue($this->component->isEventHandled());
1740
+	$this->assertTrue($this->component->Object->isEventHandled());
1741 1741
 
1742
-    // This accumulates all the responses from each of the events
1743
-    $arr=$this->component->onBehaviorEvent($this, $this->component, TEventResults::EVENT_RESULT_ALL);
1744
-    $this->assertEquals($this, $arr[0]['sender']);
1745
-    $this->assertEquals($this->component, $arr[0]['param']);
1746
-    $this->assertTrue(null === $arr[0]['response']);
1742
+	// This accumulates all the responses from each of the events
1743
+	$arr=$this->component->onBehaviorEvent($this, $this->component, TEventResults::EVENT_RESULT_ALL);
1744
+	$this->assertEquals($this, $arr[0]['sender']);
1745
+	$this->assertEquals($this->component, $arr[0]['param']);
1746
+	$this->assertTrue(null === $arr[0]['response']);
1747 1747
 
1748
-    $this->assertEquals($this, $arr[1]['sender']);
1749
-    $this->assertEquals($this->component, $arr[1]['param']);
1750
-    $this->assertTrue(null === $arr[1]['response']);
1748
+	$this->assertEquals($this, $arr[1]['sender']);
1749
+	$this->assertEquals($this->component, $arr[1]['param']);
1750
+	$this->assertTrue(null === $arr[1]['response']);
1751 1751
 
1752
-    $this->assertEquals(2, count($arr));
1752
+	$this->assertEquals(2, count($arr));
1753 1753
 
1754
-    // This tests without the default filtering-out of null
1755
-    $arr=$this->component->onBehaviorEvent($this, $this->component, false);
1756
-    $this->assertEquals(array(null, null), $arr);
1754
+	// This tests without the default filtering-out of null
1755
+	$arr=$this->component->onBehaviorEvent($this, $this->component, false);
1756
+	$this->assertEquals(array(null, null), $arr);
1757 1757
 
1758 1758
 
1759
-    unset($this->component->onBehaviorEvent);
1760
-    $this->assertEquals(0, $this->component->onBehaviorEvent->Count);
1759
+	unset($this->component->onBehaviorEvent);
1760
+	$this->assertEquals(0, $this->component->onBehaviorEvent->Count);
1761 1761
 
1762
-    $this->component->onBehaviorEvent = array($this, 'returnValue4');
1763
-    $this->component->onBehaviorEvent = array($this, 'returnValue1');
1762
+	$this->component->onBehaviorEvent = array($this, 'returnValue4');
1763
+	$this->component->onBehaviorEvent = array($this, 'returnValue1');
1764 1764
 
1765
-    // Test the per event post processing function
1766
-    $arr=$this->component->onBehaviorEvent($this, $this->component, array($this, 'postEventFunction'));
1767
-    $this->assertEquals(array(exp(4), exp(1)), $arr);
1768
-    $arr=$this->component->onBehaviorEvent($this, $this->component, array($this, 'postEventFunction2'));
1769
-    $this->assertEquals(array(sin(4), sin(1)), $arr);
1765
+	// Test the per event post processing function
1766
+	$arr=$this->component->onBehaviorEvent($this, $this->component, array($this, 'postEventFunction'));
1767
+	$this->assertEquals(array(exp(4), exp(1)), $arr);
1768
+	$arr=$this->component->onBehaviorEvent($this, $this->component, array($this, 'postEventFunction2'));
1769
+	$this->assertEquals(array(sin(4), sin(1)), $arr);
1770 1770
 
1771 1771
 
1772
-    //Testing Feed-forward functionality
1773
-    unset($this->component->onBehaviorEvent);
1772
+	//Testing Feed-forward functionality
1773
+	unset($this->component->onBehaviorEvent);
1774 1774
 
1775
-    $this->component->onBehaviorEvent = array($this, 'ffValue4');
1776
-    $this->component->onBehaviorEvent = array($this, 'ffValue2');
1777
-    $arr=$this->component->onBehaviorEvent($this, 5, TEventResults::EVENT_RESULT_FEED_FORWARD);
1778
-    $this->assertEquals(array(20, 40), $arr);
1775
+	$this->component->onBehaviorEvent = array($this, 'ffValue4');
1776
+	$this->component->onBehaviorEvent = array($this, 'ffValue2');
1777
+	$arr=$this->component->onBehaviorEvent($this, 5, TEventResults::EVENT_RESULT_FEED_FORWARD);
1778
+	$this->assertEquals(array(20, 40), $arr);
1779 1779
 
1780 1780
 
1781
-    unset($this->component->onBehaviorEvent);
1781
+	unset($this->component->onBehaviorEvent);
1782 1782
 
1783
-    //Order of these events affects the response order in feed forward
1784
-    $this->component->onBehaviorEvent = array($this, 'ffValue2');
1785
-    $this->component->onBehaviorEvent = array($this, 'ffValue4');
1786
-    $arr=$this->component->onBehaviorEvent($this, 5, TEventResults::EVENT_RESULT_FEED_FORWARD);
1787
-    $this->assertEquals(array(10, 40), $arr);
1783
+	//Order of these events affects the response order in feed forward
1784
+	$this->component->onBehaviorEvent = array($this, 'ffValue2');
1785
+	$this->component->onBehaviorEvent = array($this, 'ffValue4');
1786
+	$arr=$this->component->onBehaviorEvent($this, 5, TEventResults::EVENT_RESULT_FEED_FORWARD);
1787
+	$this->assertEquals(array(10, 40), $arr);
1788 1788
   }
1789 1789
 
1790 1790
   public function returnValue1(){return 1;}
@@ -1796,31 +1796,31 @@  discard block
 block discarded – undo
1796 1796
 
1797 1797
 
1798 1798
   public function testGlobalEventListenerInRaiseEvent() {
1799
-    //TODO Test the Global Event Listener
1799
+	//TODO Test the Global Event Listener
1800 1800
   }
1801 1801
 
1802 1802
 
1803 1803
   public function testIDynamicMethodsOnBehavior() {
1804 1804
 
1805 1805
 	//Add Behavior with dynamic call
1806
-    $this->component->attachBehavior('TDynamicBehavior', new TDynamicBehavior);
1806
+	$this->component->attachBehavior('TDynamicBehavior', new TDynamicBehavior);
1807 1807
 
1808
-    //Check that the behavior is working as it should
1809
-    $this->assertTrue($this->component->isa('TDynamicBehavior'));
1810
-    $this->assertNull($this->component->getLastBehaviorDynamicMethodCalled());
1808
+	//Check that the behavior is working as it should
1809
+	$this->assertTrue($this->component->isa('TDynamicBehavior'));
1810
+	$this->assertNull($this->component->getLastBehaviorDynamicMethodCalled());
1811 1811
 
1812
-    // call basic behavior implemented method from object (containing behavior)
1813
-    $this->assertEquals(42, $this->component->TestBehaviorMethod(6, 7));
1812
+	// call basic behavior implemented method from object (containing behavior)
1813
+	$this->assertEquals(42, $this->component->TestBehaviorMethod(6, 7));
1814 1814
 
1815
-    //Test out undefined behavior/host object method
1816
-    try {
1817
-	    $this->component->objectAndBehaviorUndefinedMethod();
1815
+	//Test out undefined behavior/host object method
1816
+	try {
1817
+		$this->component->objectAndBehaviorUndefinedMethod();
1818 1818
 		$this->fail('exception not raised when evaluating an undefined method by the object and behavior');
1819
-    } catch(TApplicationException $e) {
1820
-    }
1819
+	} catch(TApplicationException $e) {
1820
+	}
1821 1821
 
1822
-    // calling undefined dynamic method, caught by the __dycall method in the behavior and implemented
1823
-    //	this behavior catches undefined dynamic event and divides param1 by param 2
1822
+	// calling undefined dynamic method, caught by the __dycall method in the behavior and implemented
1823
+	//	this behavior catches undefined dynamic event and divides param1 by param 2
1824 1824
 	$this->assertEquals(22, $this->component->dyTestDynamicBehaviorMethod(242, 11));
1825 1825
 	$this->assertEquals('dyTestDynamicBehaviorMethod', $this->component->getLastBehaviorDynamicMethodCalled());
1826 1826
 
@@ -1832,30 +1832,30 @@  discard block
 block discarded – undo
1832 1832
 	//	param1 * 2 * param2
1833 1833
 	$this->assertEquals(2420, $this->component->dyTestIntraEvent(121, 10));
1834 1834
 
1835
-    $this->component->detachBehavior('TDynamicBehavior');
1836
-    $this->assertFalse($this->component->isa('TDynamicBehavior'));
1835
+	$this->component->detachBehavior('TDynamicBehavior');
1836
+	$this->assertFalse($this->component->isa('TDynamicBehavior'));
1837 1837
 
1838 1838
 
1839 1839
 
1840 1840
 	//Add Class Behavior with dynamic call
1841
-    $this->component->attachBehavior('TDynamicClassBehavior', new TDynamicClassBehavior);
1841
+	$this->component->attachBehavior('TDynamicClassBehavior', new TDynamicClassBehavior);
1842 1842
 
1843
-    //Check that the behavior is working as it should
1844
-    $this->assertTrue($this->component->isa('TDynamicClassBehavior'));
1845
-    $this->assertNull($this->component->getLastBehaviorDynamicMethodCalled());
1843
+	//Check that the behavior is working as it should
1844
+	$this->assertTrue($this->component->isa('TDynamicClassBehavior'));
1845
+	$this->assertNull($this->component->getLastBehaviorDynamicMethodCalled());
1846 1846
 
1847
-    // call basic behavior implemented method from object (containing behavior)
1848
-    $this->assertEquals(42, $this->component->TestBehaviorMethod(6, 7));
1847
+	// call basic behavior implemented method from object (containing behavior)
1848
+	$this->assertEquals(42, $this->component->TestBehaviorMethod(6, 7));
1849 1849
 
1850
-    //Test out undefined behavior/host object method
1851
-    try {
1852
-	    $this->component->objectAndBehaviorUndefinedMethod();
1850
+	//Test out undefined behavior/host object method
1851
+	try {
1852
+		$this->component->objectAndBehaviorUndefinedMethod();
1853 1853
 		$this->fail('exception not raised when evaluating an undefined method by the object and behavior');
1854
-    } catch(TApplicationException $e) {
1855
-    }
1854
+	} catch(TApplicationException $e) {
1855
+	}
1856 1856
 
1857
-    // calling undefined dynamic method, caught by the __dycall method in the behavior and implemented
1858
-    //	this behavior catches undefined dynamic event and divides param1 by param 2
1857
+	// calling undefined dynamic method, caught by the __dycall method in the behavior and implemented
1858
+	//	this behavior catches undefined dynamic event and divides param1 by param 2
1859 1859
 	$this->assertEquals(22, $this->component->dyTestDynamicClassBehaviorMethod(242, 11));
1860 1860
 	$this->assertEquals('dyTestDynamicClassBehaviorMethod', $this->component->getLastBehaviorDynamicMethodCalled());
1861 1861
 
@@ -1867,8 +1867,8 @@  discard block
 block discarded – undo
1867 1867
 	//	param1 * 2 * param2
1868 1868
 	$this->assertEquals(2420, $this->component->dyTestIntraEvent(121, 10));
1869 1869
 
1870
-    $this->component->detachBehavior('TDynamicClassBehavior');
1871
-    $this->assertFalse($this->component->isa('TDynamicClassBehavior'));
1870
+	$this->component->detachBehavior('TDynamicClassBehavior');
1871
+	$this->assertFalse($this->component->isa('TDynamicClassBehavior'));
1872 1872
 
1873 1873
 
1874 1874
   }
@@ -1899,80 +1899,80 @@  discard block
 block discarded – undo
1899 1899
 
1900 1900
 
1901 1901
   public function testEvaluateExpression() {
1902
-    $expression="1+2";
1903
-    $this->assertTrue(3===$this->component->evaluateExpression($expression));
1904
-    try {
1905
-      $button=$this->component->evaluateExpression('$this->button');
1906
-      $this->fail('exception not raised when evaluating an invalid exception');
1907
-    } catch(Exception $e) {
1908
-    }
1902
+	$expression="1+2";
1903
+	$this->assertTrue(3===$this->component->evaluateExpression($expression));
1904
+	try {
1905
+	  $button=$this->component->evaluateExpression('$this->button');
1906
+	  $this->fail('exception not raised when evaluating an invalid exception');
1907
+	} catch(Exception $e) {
1908
+	}
1909 1909
   }
1910 1910
 
1911 1911
 
1912 1912
 
1913 1913
 
1914 1914
   public function testEvaluateStatements() {
1915
-    $statements='$a="test string"; echo $a;';
1916
-    $this->assertEquals('test string',$this->component->evaluateStatements($statements));
1917
-    try {
1918
-      $statements='$a=new NewComponent; echo $a->button;';
1919
-      $button=$this->component->evaluateStatements($statements);
1920
-      $this->fail('exception not raised when evaluating an invalid statement');
1921
-    } catch(Exception $e) {
1922
-    }
1915
+	$statements='$a="test string"; echo $a;';
1916
+	$this->assertEquals('test string',$this->component->evaluateStatements($statements));
1917
+	try {
1918
+	  $statements='$a=new NewComponent; echo $a->button;';
1919
+	  $button=$this->component->evaluateStatements($statements);
1920
+	  $this->fail('exception not raised when evaluating an invalid statement');
1921
+	} catch(Exception $e) {
1922
+	}
1923 1923
   }
1924 1924
 
1925 1925
 
1926 1926
   public function testDynamicFunctionCall() {
1927 1927
 
1928
-    $this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1928
+	$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1929 1929
 
1930
-    $this->component->attachBehavior('dy1', new dy1TextReplace);
1931
-    $this->assertFalse($this->component->dy1->isCalled());
1932
-    $this->assertEquals(' aa bb cc __ __ ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1933
-    $this->assertTrue($this->component->dy1->isCalled());
1930
+	$this->component->attachBehavior('dy1', new dy1TextReplace);
1931
+	$this->assertFalse($this->component->dy1->isCalled());
1932
+	$this->assertEquals(' aa bb cc __ __ ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1933
+	$this->assertTrue($this->component->dy1->isCalled());
1934 1934
 
1935
-    $this->component->attachBehavior('dy2', new dy2TextReplace);
1936
-    $this->assertFalse($this->component->dy2->isCalled());
1937
-    $this->assertEquals(' aa bb cc __ __ || || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1938
-    $this->assertTrue($this->component->dy2->isCalled());
1935
+	$this->component->attachBehavior('dy2', new dy2TextReplace);
1936
+	$this->assertFalse($this->component->dy2->isCalled());
1937
+	$this->assertEquals(' aa bb cc __ __ || || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1938
+	$this->assertTrue($this->component->dy2->isCalled());
1939 1939
 
1940
-    $this->component->attachBehavior('dy3', new dy3TextReplace);
1941
-    $this->assertFalse($this->component->dy3->isCalled());
1942
-    $this->assertEquals(' aa bb cc __ __ || || ?? ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1943
-    $this->assertTrue($this->component->dy3->isCalled());
1940
+	$this->component->attachBehavior('dy3', new dy3TextReplace);
1941
+	$this->assertFalse($this->component->dy3->isCalled());
1942
+	$this->assertEquals(' aa bb cc __ __ || || ?? ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1943
+	$this->assertTrue($this->component->dy3->isCalled());
1944 1944
 
1945
-    $this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyUndefinedEvent(' aa bb cc __ .. ++ || !! ?? '));
1945
+	$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyUndefinedEvent(' aa bb cc __ .. ++ || !! ?? '));
1946 1946
 
1947
-    $this->assertEquals(0.25, $this->component->dyPowerFunction(2,2));
1947
+	$this->assertEquals(0.25, $this->component->dyPowerFunction(2,2));
1948 1948
 
1949 1949
 
1950
-    $this->component->detachBehavior('dy1');
1951
-    $this->component->detachBehavior('dy2');
1952
-    $this->component->detachBehavior('dy3');
1950
+	$this->component->detachBehavior('dy1');
1951
+	$this->component->detachBehavior('dy2');
1952
+	$this->component->detachBehavior('dy3');
1953 1953
 
1954
-    //test class behaviors of dynamic events and the argument list order
1954
+	//test class behaviors of dynamic events and the argument list order
1955 1955
 
1956
-    $this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1956
+	$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1957 1957
 
1958
-    $this->component->attachBehavior('dy1', new dy1ClassTextReplace);
1959
-    $this->assertFalse($this->component->dy1->isCalled());
1960
-    $this->assertEquals(' aa bb cc .. .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1961
-    $this->assertTrue($this->component->dy1->isCalled());
1958
+	$this->component->attachBehavior('dy1', new dy1ClassTextReplace);
1959
+	$this->assertFalse($this->component->dy1->isCalled());
1960
+	$this->assertEquals(' aa bb cc .. .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1961
+	$this->assertTrue($this->component->dy1->isCalled());
1962 1962
 
1963
-    $this->component->attachBehavior('dy2', new dy2ClassTextReplace);
1964
-    $this->assertFalse($this->component->dy2->isCalled());
1965
-    $this->assertEquals(' aa bb cc .. .. ++ ++ !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1966
-    $this->assertTrue($this->component->dy2->isCalled());
1963
+	$this->component->attachBehavior('dy2', new dy2ClassTextReplace);
1964
+	$this->assertFalse($this->component->dy2->isCalled());
1965
+	$this->assertEquals(' aa bb cc .. .. ++ ++ !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1966
+	$this->assertTrue($this->component->dy2->isCalled());
1967 1967
 
1968
-    $this->component->attachBehavior('dy3', new dy3ClassTextReplace);
1969
-    $this->assertFalse($this->component->dy3->isCalled());
1970
-    $this->assertEquals(' aa bb cc .. .. ++ ++ !! ^_^ ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1971
-    $this->assertTrue($this->component->dy3->isCalled());
1968
+	$this->component->attachBehavior('dy3', new dy3ClassTextReplace);
1969
+	$this->assertFalse($this->component->dy3->isCalled());
1970
+	$this->assertEquals(' aa bb cc .. .. ++ ++ !! ^_^ ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
1971
+	$this->assertTrue($this->component->dy3->isCalled());
1972 1972
 
1973
-    $this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyUndefinedEvent(' aa bb cc __ .. ++ || !! ?? '));
1973
+	$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyUndefinedEvent(' aa bb cc __ .. ++ || !! ?? '));
1974 1974
 
1975
-    $this->assertEquals(0.25, $this->component->dyPowerFunction(2,2));
1975
+	$this->assertEquals(0.25, $this->component->dyPowerFunction(2,2));
1976 1976
 
1977 1977
 
1978 1978
   }
@@ -1982,61 +1982,61 @@  discard block
 block discarded – undo
1982 1982
 
1983 1983
   public function testDynamicIntraObjectEvents() {
1984 1984
 
1985
-    $this->component->attachBehavior('IntraEvents', new IntraObjectExtenderBehavior);
1985
+	$this->component->attachBehavior('IntraEvents', new IntraObjectExtenderBehavior);
1986 1986
 
1987
-    $this->assertNull($this->component->IntraEvents->LastCall);
1987
+	$this->assertNull($this->component->IntraEvents->LastCall);
1988 1988
 
1989
-    //unlisten first, this object listens upon instantiation.
1990
-    $this->component->unlisten();
1991
-    $this->assertEquals(2, $this->component->IntraEvents->LastCall);
1989
+	//unlisten first, this object listens upon instantiation.
1990
+	$this->component->unlisten();
1991
+	$this->assertEquals(2, $this->component->IntraEvents->LastCall);
1992 1992
 
1993
-    // ensures that IntraEvents nulls the last call variable when calling this getter
1994
-    $this->assertNull($this->component->IntraEvents->LastCall);
1993
+	// ensures that IntraEvents nulls the last call variable when calling this getter
1994
+	$this->assertNull($this->component->IntraEvents->LastCall);
1995 1995
 
1996
-    //listen next to undo the unlisten
1997
-    $this->component->listen();
1998
-    $this->assertEquals(1, $this->component->IntraEvents->LastCall);
1996
+	//listen next to undo the unlisten
1997
+	$this->component->listen();
1998
+	$this->assertEquals(1, $this->component->IntraEvents->LastCall);
1999 1999
 
2000 2000
 
2001
-    $this->assertEquals(3, $this->component->evaluateExpression('1+2'));
2002
-    $this->assertEquals(7, $this->component->IntraEvents->LastCall);
2001
+	$this->assertEquals(3, $this->component->evaluateExpression('1+2'));
2002
+	$this->assertEquals(7, $this->component->IntraEvents->LastCall);
2003 2003
 
2004
-    $statements='$a="test string"; echo $a;';
2005
-    $this->assertEquals('test string', $this->component->evaluateStatements($statements));
2006
-    $this->assertEquals(8, $this->component->IntraEvents->LastCall);
2004
+	$statements='$a="test string"; echo $a;';
2005
+	$this->assertEquals('test string', $this->component->evaluateStatements($statements));
2006
+	$this->assertEquals(8, $this->component->IntraEvents->LastCall);
2007 2007
 
2008 2008
   	$component2 = new NewComponentNoListen();
2009
-    $this->assertNull($this->component->createdOnTemplate($component2));
2010
-    $this->assertEquals(9, $this->component->IntraEvents->LastCall);
2009
+	$this->assertNull($this->component->createdOnTemplate($component2));
2010
+	$this->assertEquals(9, $this->component->IntraEvents->LastCall);
2011 2011
 
2012
-    $this->assertNull($this->component->addParsedObject($component2));
2013
-    $this->assertEquals(10, $this->component->IntraEvents->LastCall);
2012
+	$this->assertNull($this->component->addParsedObject($component2));
2013
+	$this->assertEquals(10, $this->component->IntraEvents->LastCall);
2014 2014
 
2015 2015
 
2016 2016
 
2017
-    $behavior = new BarBehavior;
2018
-    $this->assertEquals($behavior, $this->component->attachBehavior('BarBehavior', $behavior));
2019
-    $this->assertEquals(11, $this->component->IntraEvents->LastCall);
2017
+	$behavior = new BarBehavior;
2018
+	$this->assertEquals($behavior, $this->component->attachBehavior('BarBehavior', $behavior));
2019
+	$this->assertEquals(11, $this->component->IntraEvents->LastCall);
2020 2020
 
2021
-    $this->assertNull($this->component->disableBehaviors());
2022
-    $this->assertNull($this->component->enableBehaviors());
2023
-    $this->assertEquals(27, $this->component->IntraEvents->LastCall);
2021
+	$this->assertNull($this->component->disableBehaviors());
2022
+	$this->assertNull($this->component->enableBehaviors());
2023
+	$this->assertEquals(27, $this->component->IntraEvents->LastCall);
2024 2024
 
2025
-    $this->assertTrue($this->component->disableBehavior('BarBehavior'));
2026
-    $this->assertEquals(16, $this->component->IntraEvents->LastCall);
2025
+	$this->assertTrue($this->component->disableBehavior('BarBehavior'));
2026
+	$this->assertEquals(16, $this->component->IntraEvents->LastCall);
2027 2027
 
2028
-    $this->assertTrue($this->component->enableBehavior('BarBehavior'));
2029
-    $this->assertEquals(15, $this->component->IntraEvents->LastCall);
2028
+	$this->assertTrue($this->component->enableBehavior('BarBehavior'));
2029
+	$this->assertEquals(15, $this->component->IntraEvents->LastCall);
2030 2030
 
2031
-    $this->assertEquals($behavior, $this->component->detachBehavior('BarBehavior'));
2032
-    $this->assertEquals(12, $this->component->IntraEvents->LastCall);
2031
+	$this->assertEquals($behavior, $this->component->detachBehavior('BarBehavior'));
2032
+	$this->assertEquals(12, $this->component->IntraEvents->LastCall);
2033 2033
 
2034 2034
 
2035
-    $this->component->attachEventHandler('OnMyEvent',array($this->component,'myEventHandler'));
2036
-    $this->component->raiseEvent('OnMyEvent',$this,null);
2035
+	$this->component->attachEventHandler('OnMyEvent',array($this->component,'myEventHandler'));
2036
+	$this->component->raiseEvent('OnMyEvent',$this,null);
2037 2037
 
2038
-    //3 + 4 + 5 + 6 = 18 (the behavior adds these together when each raiseEvent dynamic intra event is called)
2039
-    $this->assertEquals(18, $this->component->IntraEvents->LastCall);
2038
+	//3 + 4 + 5 + 6 = 18 (the behavior adds these together when each raiseEvent dynamic intra event is called)
2039
+	$this->assertEquals(18, $this->component->IntraEvents->LastCall);
2040 2040
   }
2041 2041
 
2042 2042
 
@@ -2047,23 +2047,23 @@  discard block
 block discarded – undo
2047 2047
 	$this->assertFalse(isset($this->component->JsColorAttribute));
2048 2048
 
2049 2049
 	$this->component->ColorAttribute = "('#556677', '#abcdef', 503987)";
2050
-    $this->assertEquals("('#556677', '#abcdef', 503987)", $this->component->ColorAttribute);
2050
+	$this->assertEquals("('#556677', '#abcdef', 503987)", $this->component->ColorAttribute);
2051 2051
 
2052 2052
 	$this->assertTrue(isset($this->component->ColorAttribute));
2053 2053
 	$this->assertTrue(isset($this->component->JsColorAttribute));
2054 2054
 
2055 2055
 	$this->component->ColorAttribute = "new Array(1, 2, 3, 4, 5)";
2056
-    $this->assertEquals("new Array(1, 2, 3, 4, 5)", $this->component->JsColorAttribute);
2056
+	$this->assertEquals("new Array(1, 2, 3, 4, 5)", $this->component->JsColorAttribute);
2057 2057
 
2058 2058
 	$this->component->JsColorAttribute = "['#112233', '#fedcba', 22009837]";
2059
-    $this->assertEquals("['#112233', '#fedcba', 22009837]", $this->component->ColorAttribute);
2059
+	$this->assertEquals("['#112233', '#fedcba', 22009837]", $this->component->ColorAttribute);
2060 2060
   }
2061 2061
 
2062 2062
 
2063 2063
   public function testJavascriptIssetUnset() {
2064 2064
 
2065 2065
 	$this->component->JsColorAttribute = "['#112233', '#fedcba', 22009837]";
2066
-    $this->assertEquals("['#112233', '#fedcba', 22009837]", $this->component->ColorAttribute);
2066
+	$this->assertEquals("['#112233', '#fedcba', 22009837]", $this->component->ColorAttribute);
2067 2067
 
2068 2068
 	unset($this->component->ColorAttribute);
2069 2069
 
Please login to merge, or discard this patch.