Expectations At Arbitrary Script-points
Posted: Sat Oct 22, 2005 7:30 pm
Recently, I tried to run this test code on SimpleTest:
So it would always inextricably fail. I later found out that both expectArguments are checked on every method call, so one would always fail on me, rather than expectArguments represent possible arguments that could be passed.
So I ended up using expectArgumentsAt(). However, the UnitOfWork doesn't apply any particular logic on which order the captcha objects are passed to the mapper (it just so turned out that captcha1 came before captcha2). Which means a brittle testcase.
If you had to have this sort of testcase, what would you do? I have a sneaking suspicion that the solution is a custom Expectation class, but I'm not sure. What would you do?
Code: Select all
$this->mapper->expectArguments('delete', array(&$captcha1));
$this->mapper->expectArguments('delete', array(&$captcha2));So I ended up using expectArgumentsAt(). However, the UnitOfWork doesn't apply any particular logic on which order the captcha objects are passed to the mapper (it just so turned out that captcha1 came before captcha2). Which means a brittle testcase.
If you had to have this sort of testcase, what would you do? I have a sneaking suspicion that the solution is a custom Expectation class, but I'm not sure. What would you do?