On exception from tearDown pass/fail is not reported #536

Merged
merged 4 commits into from Jun 14, 2012

Projects

None yet

2 participants

@hans-d
Contributor
hans-d commented Jun 12, 2012

When an exception is thrown in 'tearDown`, the results of the asserts in the method directly preceding the tearDown are not displayed and not taken into account of the total tests(asserts) being run.

Note: Also had to swap the lines in testRun to make UnitTest pass (prior to making other changes).

hans-d added some commits Jun 12, 2012
@hans-d hans-d exceptions thrown in setUp and tearDown cause silent end of testcases…
… being run

testcase for #514.
Also had to swap the lines in tesstRun to make it pass

Test case will cause silent ending on running
- /tests/cases/test
- /tests/cases/test/Dispatcher
- tests/cases/test/UnitTest
2f7f4db
@hans-d hans-d fix SetupThrowsExceptions. This test passes already. 7455a62
@hans-d
Contributor
hans-d commented Jun 12, 2012

In the testcase in the example, UnitTest reports: UniTest reports: 91 / 91 passes, 0 fails and 1 exception.
This should be 92 / 92 passes, 0 fails and 1 exception.

@hans-d
Contributor
hans-d commented Jun 13, 2012

Also $this->expectException() is not found in the results (non-verbose dots, verbose passing line, totals x / x passes).

@nateabele nateabele commented on an outdated diff Jun 14, 2012
tests/cases/test/UnitTest.php
@@ -491,6 +493,13 @@ public function testGetTest() {
$this->assertEqual($expected, $result);
}
+ /**
+ * With a fresh PHP environment this might throw an exception:
+ * `strtotime(): It is not safe to rely on the system's timezone settings. You are
+ * *required* to use the date.timezone setting or the date_default_timezone_set() function.`
+ * See also http://www.php.net/manual/en/function.date-default-timezone-get.php
+ * Nuff said...
@nateabele
nateabele Jun 14, 2012 Member

A comment like "Nuff said..." is fine in discussions on GitHub issues, but not appropriate in the source code.

@nateabele nateabele commented on an outdated diff Jun 14, 2012
tests/cases/test/UnitTest.php
@@ -652,6 +671,7 @@ public function testTestMethods() {
$result = $this->test->methods();
$this->assertIdentical($expected, $result);
}
+
@nateabele
nateabele Jun 14, 2012 Member

Why the extra line break here?

@hans-d
Contributor
hans-d commented Jun 14, 2012

Remarks processed...

@nateabele
Member

Perfect, thanks!

@nateabele nateabele merged commit e7f83a7 into UnionOfRAD:dev Jun 14, 2012
@hans-d
Contributor
hans-d commented Jun 14, 2012

@nateabele, please do note that the underlying issue (displayed number of tests run/passed/failed) is still not solved in this one...

@nateabele
Member

Right, I understand. It's okay for PRs that produce failing test cases to go to dev. Once someone's able to get a patch to dev that makes the tests pass, then we'll merge to master.

@gwoo gwoo added a commit that referenced this pull request Jul 6, 2012
@gwoo gwoo Going green after #536 where test cases were added to test exception …
…handling in test cases.
d4ae2a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment