Given this form:
<html>
<head><title></title></title>
<body>
<form action="doform.php" method="GET">
<input id="text_field" type="text" name="a" value="default" />
<input id="submit_button" name="submit" type="submit" value="Go" />
</form>
</body>
</html>
and this test case:
class TestPostComment extends WebTestCase
{
function testPostAnonymousComment()
{
$this->get('http://localhost/blog/test/form.htm');
$this->showRequest();
// $this->showHeaders();
$this->showSource();
$this->assertField('a', 'default');
$this->assertFieldById('text_field', 'default');
if ($this->clickSubmit('Go'))
{
$this->showRequest();
// $this->showHeaders();
// $this->showSource();
}
}
}
Both assertField* tests fail. I get these error messages:
Fail: testPostAnonymousComment -> Field [a] should match with [Field expectation [String: default] fails with [NULL] at character 0 with [default] and []] at [c:\html\blog\test\testform.php line 17]
Fail: testPostAnonymousComment -> Field [text_field] should match with [Field expectation [String: default] fails with [NULL] at character 0 with [default] and []] at [c:\html\blog\test\testform.php line 18]
However, when the form does not contain quoted values, the tests pass as expected.
Here's the passing form:
<html>
<head><title></title></title>
<body>
<form action=doform.php method=GET>
<input id=text_field type=text name=a value=default />
<input id=submit_button name=submit type=submit value=Go />
</form>
</body>
</html>
This might be related to this bug (I'm not 100% sure it's the same bug.):
https://sourceforge.net/tracker/index.php?func=detail&aid=1642529&group_id=76550&atid=547455
I'm running SimpleTest 1.0.1Beta, the latest version.
If you have any other questions, feel free to contact me at puckdropper@yahoo.com
Logged In: NO
More information:
This bug occurs only when using a web server to process PHP. I'm using Version 5, I had 5.0.4 and now have 5.2.3. Same results.
However, when I run through PHP.exe, the bug does not occur. Everything processes properly, giving me a passing test case.
System Configuration information:
System One:
Windows XP, Easy PHP, with Apache 1.33, PHP 5.2.3 (Upgraded from default 4.3 in Easy PHP), MySQL 4.1.9
System Two:
Server 2003 SP1, IIS, PHP 5.2.3 (Upgraded from 5.04), No MySQL Server
System Three:
Windows XP, PHPEd software. This one works correctly, probably by shelling out to its included version of PHP.
Logged In: YES
user_id=292377
Originator: NO
Thank you for the report. The SVN version already had a fix. But I did add your test case to the acceptane test suite to prevent any regression later on. I'm very grateful for your help towards a better SimpleTest.
Yours,
Perrick