li3 test does not handle all exceptions correctly #514

hans-d opened this Issue Jun 1, 2012 · 3 comments


None yet

1 participant


namespace app\tests\cases\test;

use li3_mockery\test\Mockery as m;

class MockeryTest extends \lithium\test\Unit {

    public function tearDown() {

    public function testMock() {
        $mock = m::mock('test');

        $result = $mock->go();
        $expected = 2;
        $this->assertEqual($expected, $result);

    public function testSimple() {
        $this->assertEqual(1, 2);


It will output only

[     fail] on line   19 in app\tests\cases\test\MockeryTest::testMock()
Method go() from test should be called
 exactly 2 times but called 1 times.

Lines 2 and 3 are the output of mockery.

It does not show the assert in the first test, and the second test is not run at all.

When the twice() is replaced by once() on line 15, both tests run and I get the details of the fail.

Note: li3_mockery can be found at


Most likely because the exception is raised in tearDown.

@hans-d hans-d added a commit to hans-d/lithium that referenced this issue 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

It is also a problem when a exception is thrown in setUp. shows that setUp is wrapped in a try/catch, and further down tearDown is not.


this particular case is now handled that tests continue, and the Exception thrown is nicely displayed.
Opening new issue for not reporting on the pass/fail in the test method prior to the tearDown

@hans-d hans-d closed this Jun 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment