I am writing a simpletest test script, where I would like to enable my module, and then invoke a Drupal core test to ensure that my module is producing core-compliant results (in particular, I render a pager alternative to core's, and would make sure that, at its minimal setup, is equal to core's one).

Is there a way to do that?

Thanks for help



So... I found a solution that's working, at least for my case.

It has to do with the fact that test cases are actually PHP classes that can be extended. So I tried to leverage inheritance, with a caveat...

I want to run a test on the pager, Drupal 7, after I have enabled a module that replaces the core pager.

The core pager test class is defined as

class PagerFunctionalWebTestCase extends DrupalWebTestCase {

now, my problem was that the core test would not be caring about my module to be loaded before running the tests.

I created my module test class as an extension of the core one, like

class MyPagerTest extends PagerFunctionalWebTestCase {

This is OK, but the point is that if I call parent::setUp() at this stage, the core setup will be run and I will still miss my module from loading before the actual test.

So the caveat is that instead of calling parent::setUp, I will call directly the 'ancestor' DrupalWebtestCase::setUp function, with my setup, and skip the call to parent.

Like this:


public function setUp() {
  // Enable required modules.
  $modules = array(

  // Insert 300 log messages.
  for ($i = 0; $i < 300; $i++) {
    watchdog('pager_test', $this->randomString(), NULL, WATCHDOG_DEBUG);

  $this->admin_user = $this->drupalCreateUser(array(
    'access site reports',



That's all - class inheritance will do the magic and bring the rest of the test functions in.

Anybody sees other options?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.