|
From: Jason S. <jsw...@ya...> - 2004-04-09 10:27:04
|
--- Culley Harrelson <cu...@fa...> wrote:
>
> On Apr 7, 2004, at 6:11 PM, Marcus Baker wrote:
> >
> > Is this workaround sufficient?
>
> I think you loose all the WebTestCase assertions if you do this, right?
> But I don't need any of this-- I was just throwing some ideas out
> there. assertTrue can mimic most all of the other assertion methods
> and is all I need ultimately. Where are mixins when you need them...
>
> culley
Just extend WebTestCase rather than UnitTestCase. For example, I wanted to be
able to have the first few tests as if you were a new user, and then the
majority of the test run as if you had just completed logging into the site.
One choice for me would have been to make to test cases, one that would be the
"new user" and another that would do the login in the setup() method.
However I did not want to actually login each time, so instead I wanted to
"save" a copy of the browser as it exited the moment I finished logging in, and
then use that browser for the rest of the test cases. To do this, I needed a
"setBrowser()" method that does not exist on the WebTestCase. In the same file
as my test case, I defined:
class ReuseWebTestCase extends WebTestCase {
function ReuseWebTestCase($name=false) {
$this->WebTestCase($name);
}
function setBrowser(&$browser) {
$this->_browser =& $browser;
}
}
HTH
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
|