|
From: Marcus B. <ma...@la...> - 2004-02-20 02:05:36
|
Hi.
SimpleTest1.0beta4 has been released.
This one was a real struggle as there was a lot of refactoring to get
the web browser portion into one top level class. The feature set can be
seen from the Sourceforge release notes, but the most significant
changes are the error trapping now respects PHP ini file settings (and
hopefully doesn't crash PHP5 boxes) and the web browser can be used
independently.
As usual the documentation is a little behind. Having a separate web
browser means that a UnitTestCase can be used when a WebTestCase is too
course grained. For example...
class ConfirmingRandomPassword extends UnitTestCase {
function ConfirmingRandomPassword() {
$this->UnitTestCase();
}
function testAutoPasswordMatchesDatabaseEntry() {
$browser = &new SimpleBrowser();
$browser->get('http://portal.com/join.php');
$browser->setField('name', 'Me');
$browser->clickSubmit('Join');
preg_match(
'/your password is (.*?)\s/',
$browser->getContent(),
$matches);
$this->assertNotNull($matches[1]);
$finder = &new LoginFinder();
$login = &$finder->findByName('Me');
$this->assertTrue($login);
$this->assertIdentical($matches[1], $login->getPassword());
}
}
Another possibility is when you want to test that multiple logins to a
system are denied.
yours, Marcus
--
Marcus Baker, ma...@la..., no...@ap...
|