|
From: Nicolas T. <nic...@gm...> - 2009-10-21 15:11:14
|
Hi,
<?php
class A {
function m() {
throw new Exception('Woohoo');
}
}
class ErrorTest extends UnitTestCase {
function test_m1() {
$a = new A();
$this->expectException('Exception');
$this->expectError();
$a->m();
}
function test_m2() {
}
}
?>
The test fails:
-> ErrorTest -> test_m2 -> Expected true, got [Boolean: false] ->
Expected error not caught
Why does the message refers to test_m2() ? Where does this true/false
check come from?
Strange, isn't it?
If I remove the test_m2() method or the expectError, it goes green.
Yours,
Nicolas Terray
|
|
From: Jason S. <jsw...@ya...> - 2009-10-21 15:26:47
|
Hi Nicolas,
Your code throws an exception, and does not raise an error, so the unit test is telling you that. Everything appears to be working as expected with SimpleTest.
Regards,
Jason
________________________________
From: Nicolas Terray <nic...@gm...>
To: "Help, advice, bugs and workarounds" <sim...@li...>
Sent: Wed, October 21, 2009 10:10:57 AM
Subject: [Simpletest-support] Strange behavior with expectError
Hi,
<?php
class A {
function m() {
throw new Exception('Woohoo');
}
}
class ErrorTest extends UnitTestCase {
function test_m1() {
$a = new A();
$this->expectException('Exception');
$this->expectError();
$a->m();
}
function test_m2() {
}
}
?>
The test fails:
-> ErrorTest -> test_m2 -> Expected true, got [Boolean: false] ->
Expected error not caught
Why does the message refers to test_m2() ? Where does this true/false
check come from?
Strange, isn't it?
If I remove the test_m2() method or the expectError, it goes green.
Yours,
Nicolas Terray
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Simpletest-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simpletest-support
|
|
From: Nicolas T. <nic...@gm...> - 2009-10-21 15:38:00
|
2009/10/21 Jason Sweat <jsw...@ya...>: > Hi Nicolas, > > Your code throws an exception, and does not raise an error, so the unit test is telling you that. Everything appears to be working as expected with SimpleTest. > Why the Fail message speaks about test_m2 ? (tests shouldn't be independent?) Why does it say "Expected true, got [Boolean: false]" ? (I didn't make any assertion about True or False values) Why does my test go green if i remove the function test_m2() ? Thanks, Nicolas |
|
From: Chris C. <ch...@w3...> - 2009-10-21 23:17:52
|
You're right, that does seem broken. I haven't tested it myself but from the code you posted you should get a failure in test_m1 but not in test_m2. It's as if SimpleTest is not resetting state correctly between the test methods and it thinks it's still waiting for an error to be raised. On 22/10/2009, at 2:37 AM, Nicolas Terray wrote: > 2009/10/21 Jason Sweat <jsw...@ya...>: >> Hi Nicolas, >> >> Your code throws an exception, and does not raise an error, so the >> unit test is telling you that. Everything appears to be working as >> expected with SimpleTest. >> > > Why the Fail message speaks about test_m2 ? (tests shouldn't be > independent?) > Why does it say "Expected true, got [Boolean: false]" ? (I didn't make > any assertion about True or False values) > Why does my test go green if i remove the function test_m2() ? > > Thanks, > Nicolas > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Simpletest-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpletest-support |
|
From: Marcus B. <ma...@wo...> - 2009-10-22 09:48:13
|
Hi... Nicolas Terray wrote: > Why does the message refers to test_m2() ? Where does this true/false > check come from? If no one else picks this up, I'll dig into it next week. What version of SimpleTest are you using? I have recently done some fixes where an error would prevent the exception trap working, and vice versa. Looks like I'm still missing something. > > Strange, isn't it? Yes :). > Yours, > Nicolas Terray yours, Marcus |
|
From: Nicolas T. <nic...@gm...> - 2009-10-22 10:07:20
|
2009/10/22 Marcus Baker <ma...@wo...>: > Hi... > > Nicolas Terray wrote: >> Why does the message refers to test_m2() ? Where does this true/false >> check come from? > > If no one else picks this up, I'll dig into it next week. > > What version of SimpleTest are you using? I have recently done some > fixes where an error would prevent the exception trap working, and > vice versa. Looks like I'm still missing something. > The latest stable version 1.0.1 :) http://sourceforge.net/projects/simpletest/files/simpletest/simpletest_1.0.1/ |
|
From: Marcus B. <ma...@wo...> - 2009-10-22 15:31:42
|
Hi... Nicolas Terray wrote: > The latest stable version 1.0.1 :) > http://sourceforge.net/projects/simpletest/files/simpletest/simpletest_1.0.1/ The version in SVN is 1.1 and shoudl actually be more stable than the one you are using. An official release is coming pretty soon, so it won't significantly differ from what you are using. I think this fixes your issue, but I'll need to confirm this next week (unless you can first). yours, Marcus |