When I have Cache Consistent in my codebase and I try to start SimpleTest for another module's tests the following error is displayed:

$ simpletest --verbose --class MetatagFaviconsTest

Fatal error: Class 'ConsistentCacheTestCaseBase' not found in sites/all/modules/contrib/cache_consistent/tests/cache_consistent.speed.test on line 12

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Fixing the above error lead to this error:
Fatal error: Interface 'CacheVariableHandlerInterface' not found in sites/all/modules/contrib/cache_consistent/tests/cache_consistent.test.inc on line 430

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.76 KB

So in order to fix the first error I loaded the cache_consistent.test.inc file at the top of each test file, and then to fix the second error I loaded cache_consistent.inc at the top of the cache_consistent.test.inc file.

gielfeldt’s picture

Hmm. I thought the class was autoloaded due to its presence in the info-file?

damienmckenna’s picture

In theory. However, I suspect that Simpletest is sorting the list of files alphabetically and loading them in that order, rather than in the order they're listed in the info file. BICBW. The reason I wonder about the file ordering is that the cache_consistent.buffer.test file *does* have a require_once() line, apparently to fix the same problem.

So, in short, this is an existing problem with the buffer.test filethat was fixed by adding the require_once() line, so the others should be fixed this way too.

damienmckenna’s picture

StatusFileSize
new1.64 KB

It might be because the CacheConsistentTestHelper class is in a 'use' statement instead of being extended?

Also, the 'use' statements are inside the class definitions instead of outside. Moving them outside fixes the problem of CacheConsistentTestHelper not being loaded but still leaves ConsistentCacheTestCaseBase unavailable.

gielfeldt’s picture

Ahh... But it has to be inside the class. It's a trait.

Are we sure this is not a php version issue?

damienmckenna’s picture

Ok, lets ignore #7 then.

I'm running 5.6.10 locally (from MAMP). Tests are disabled for this module, so it's hard to compare the tests across PHP versions.

damienmckenna’s picture

BTW should ConsistentCacheTestCaseBase be an abstract class?

gielfeldt’s picture

Status: Needs review » Fixed
damienmckenna’s picture

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.