Adds a new cache class DrupalInMemoryCache so that during unit testing the DB/Memcache cache layer is not being polluted. This gives us the ability to have a clean () cache at the beginning of each test.
() The cache that has been constructed during bootstrap is being restored at the end of each test.
There is a line in the phpunit.xml file which makes this system optional, but enabled by default (because test isolation is crucial).
Caveat: if the subclass extends either setUp or tearDown methods but doesn't call the parent method this implementation breaks. This caveat is valid for the changes in the pull request no #4. One possible solution for this is to use subclass of PHPUnit_Framework_TestSuite to run the tests in which we move the clearing of the caching outside of the setUp/tearDown method.
Performance implications: I haven't profiled the serialize/unserialize steps at all. Compared to a full drupal bootstrap (especially in a large installation) that performance hit should be negligible. Also as mentioned before, test isolation is critical.
Re performance: actually I just realised that using this in memory cache mechanism should theoretically improve performance because we don't do network roundtrips to mysql (or memcache)
Adds a new cache class DrupalInMemoryCache so that during unit testing the DB/Memcache cache layer is not being polluted. This gives us the ability to have a clean () cache at the beginning of each test. () The cache that has been constructed during bootstrap is being restored at the end of each test.
There is a line in the phpunit.xml file which makes this system optional, but enabled by default (because test isolation is crucial).
Caveat: if the subclass extends either setUp or tearDown methods but doesn't call the parent method this implementation breaks. This caveat is valid for the changes in the pull request no #4. One possible solution for this is to use subclass of PHPUnit_Framework_TestSuite to run the tests in which we move the clearing of the caching outside of the setUp/tearDown method.
Performance implications: I haven't profiled the serialize/unserialize steps at all. Compared to a full drupal bootstrap (especially in a large installation) that performance hit should be negligible. Also as mentioned before, test isolation is critical.