[development] Variable overriding in SimpleTest environments

nan wich nan_wich at bellsouth.net
Sun Feb 27 01:26:00 UTC 2011


Are you sure something like this wouldn't be better with hook_requirements()?
 
Nancy
 
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.




________________________________
From: Christian López Espínola <clopez at emergya.es>
To: development at drupal.org
Sent: Sat, February 26, 2011 6:02:08 PM
Subject: [development] Variable overriding in SimpleTest environments

Hi,

I'm trying to build with SimpleTest some acceptance tests for the D6 based sites 
I'm developing.

For achieving this, I am creating a module that checks if configuration values 
are the correct ones, with tests like this one:

  public function testFileDirectoryPathIsTheRightOne () {
    $dirpath = variable_get('file_directory_path', 'sites/default/files'); // 
tried file_directory_path() too instead of reading the variable.
    $this->pass($dirpath);
    $this->assertEqual(
      'sites/default/files',
      $dirpath,
      'The file directory path is correct'
    );
  }

But (obviously) the simpletest environment that is being built overrides this 
setting (p.e.: file_directory_path() and the variable 'file_directory_path' have 
the value sites/default/files/simpletest/275031).

Is any way of checking the values of the original site? I'm thinking about 
checking that $dirpath begins with 'sites/default/files', but not sure if there 
is a better way of assuring this).

Thanks for your time!


-- Christian López Espínola
Área de Proyectos

Emergya Consultoría
Tfno: +34 954 51 75 77
Fax: +34 954 51 64 73
www.emergya.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110226/7034ea1c/attachment-0001.html 


More information about the development mailing list