Page 1 of 1

simpletest. how to see if select is given values only.

Posted: Thu Aug 24, 2006 5:46 am
by jmut
howto see what values can be set in a select/radio/checkbox.

From documentation I only see how you check if can set given value...but now what available values there are.

While this does not proove any security, as form is easily spoofed, it is useful to determine
what the customer will see in a drop down for example.

Posted: Thu Aug 24, 2006 9:25 am
by sweatje
not pretty:

Code: Select all

$this->dump(
			$this->getBrowser()->_page->_complete_forms[0]
		);

Posted: Thu Aug 24, 2006 9:43 am
by Chris Corbyn
At the risk of dereailing this thread, how often do you use dump() ? And is dump() something you should run briefly, then delete from the test code, or is it something that's acceptable to leave in the tests? (Assuming the tests will be packaged as part of a project).

Posted: Thu Aug 24, 2006 9:53 am
by sweatje
I tend to use $this->dump() temporarily, in much the same manner you would use a print_r or var_dump in "old style" programming/bug hunting. Once I know the structure of what I am looking at, I will then throw in the asserts*()s that I want and remove the dump().

Posted: Thu Aug 24, 2006 2:27 pm
by Ambush Commander
It also seems like a convenient way to help give more descriptive information to custom asserts.