Moodle

execption thrown from unit test affects the code flow in simpletest framework itself

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Unit tests
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Sample code:

function test_error_and_exception () { count(); // results in warning throw new exception('buuuuaa'); // this exception nukes simpletest }

function test_fails_with_exception () { return; }

fails in both tests with:

Exception: lib/dml/simpletest/testdml.php / ? dml_test / ? test_error_and_exception
Unexpected exception of type [Exception] with message [buuuuaa] in [C:\workspace\moodle\lib\dml\simpletest\testdml.php line 65]

Exception: lib/dml/simpletest/testdml.php / ? dml_test / ? test_fails_with_exception
Unexpected PHP error [count() expects at least 1 parameter, 0 given] severity [E_WARNING] in [C:\workspace\moodle\lib\dml\simpletest\testdml.php line 64]

working on a temporary patch

Activity

Hide
Petr Škoda (skodak) added a comment -

Temporary fix in cvs, Nicolas could you please review it and try to find less hacky solution please?
We should also report it upstream

thanks

Show
Petr Škoda (skodak) added a comment - Temporary fix in cvs, Nicolas could you please review it and try to find less hacky solution please? We should also report it upstream thanks
Hide
mert gokkaya added a comment -

is this a bug about the test or the actual database problem? I keep getting dmlwrite/read errors on grouping creation and randomly on internal messaging. PHP 5.2.8 MySQL 5 Suse 11.1 Apache 2, clean moodle 2 install

Show
mert gokkaya added a comment - is this a bug about the test or the actual database problem? I keep getting dmlwrite/read errors on grouping creation and randomly on internal messaging. PHP 5.2.8 MySQL 5 Suse 11.1 Apache 2, clean moodle 2 install

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: