phpunit でこれをテストしていませんが、Selenium IDE では、javascript を使用して隠しフィールドを変更できます。
テスト ページ:
<html><head></head><body>
<?php print_r($_POST); ?>
<br/><br/>
<form action="test.php" method="POST">
<input type="hidden" id="hhh" name="hhh" value="orig"/>
<input type="text" name="ttt"/>
<input type="submit" name="sss"/>
</form>
</body></html>
スクリプト (firefox IDE から生成されるため、テストしていません):
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser("*chrome");
$this->setBrowserUrl("http://localhost/test.php");
}
public function testMyTestCase()
{
$this->type("ttt", "bbb");
$this->runScript("javascript{ this.browserbot.getCurrentWindow().document.getElementById('hhh').value = 'new2'; }");
$this->click("sss");
}
}
?>
したがって、変数を非表示フィールドとして追加し、port
javascript で値を設定するだけです。