Moodle

The fact that unit tests involving the database have been disabled it obstructing my work

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

Petr broke it ages ago and seems not to care.

Issue Links

Activity

Hide
Tim Hunt added a comment -

Please someone, do something about this.

Show
Tim Hunt added a comment - Please someone, do something about this.
Hide
Petr Škoda (skodak) added a comment -

I keep working on that, trying to solve all problems that are related. At present it is all the caching in accesslib.php

Show
Petr Škoda (skodak) added a comment - I keep working on that, trying to solve all problems that are related. At present it is all the caching in accesslib.php
Hide
Tim Hunt added a comment -

OK, attached is a fairly simple approach.

There is a very simple test file to demonstrate it:
lib/simpletest/testunittestusingdb.php

Eloy, I had to make a new method install_one_table_from_xmldb_file in lib/ddl/database_manager.php which I would be grateful if you could review. (I did a little refactor too, to avoid duplicating code.)

I also had to extend Petr's temporary hack in lib/simpletestlib/test_case.php. Instead, we should probably change to making our own subclass of TestSuite that subclasses the standard one.

Please tell me what you think. I would like to use this to get the accesslib unit tests (such as they are) working again tomorrow.

Thanks.

Show
Tim Hunt added a comment - OK, attached is a fairly simple approach. There is a very simple test file to demonstrate it: lib/simpletest/testunittestusingdb.php Eloy, I had to make a new method install_one_table_from_xmldb_file in lib/ddl/database_manager.php which I would be grateful if you could review. (I did a little refactor too, to avoid duplicating code.) I also had to extend Petr's temporary hack in lib/simpletestlib/test_case.php. Instead, we should probably change to making our own subclass of TestSuite that subclasses the standard one. Please tell me what you think. I would like to use this to get the accesslib unit tests (such as they are) working again tomorrow. Thanks.
Hide
Tim Hunt added a comment -

I'm now seeing what Petr means about static caches breaking unit tests.

I think the only solution is to stop using static to cache stuff. Which probably involves switching to more objects, which is not a small change.

Show
Tim Hunt added a comment - I'm now seeing what Petr means about static caches breaking unit tests. I think the only solution is to stop using static to cache stuff. Which probably involves switching to more objects, which is not a small change.
Hide
Eloy Lafuente (stronk7) added a comment -

sorry, I assigned myself the wrong bug.

Show
Eloy Lafuente (stronk7) added a comment - sorry, I assigned myself the wrong bug.
Hide
Tim Hunt added a comment -

OK, I have fixed this to my satisfaction.

Show
Tim Hunt added a comment - OK, I have fixed this to my satisfaction.

People

Vote (0)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: