Hey,
I just noticed that drupalGetTestFiles('image') returns nothing as there are no images in the 'files/simpletest' directory.
I had a look into it and the only place I can see files being put into the 'files/simpletest' directory is in the .install file, which is only creating binary and text files, yet there is a directory in simpletest module directory full of files.
Is it a bug, or am I using the wrong function? Is there a function other than drupalGetTestFiles to reference the test files in the 'modules/simpletest/files' directory?
Cheers,
Deciphered.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 487090.patch | 1.58 KB | dave reid |
Comments
Comment #1
dave reidIt should not be referencing files from modules/simpletest/files...it should be your site's files directory (i.e. sites/yoursite.com/files/simpletest). What do you have in that directory (replace yoursite.com with default or the multisite folder for your site)?
Comment #2
decipheredHi Dave,
I realize this, maybe I was being to general when I said 'files/simpletest', I was of course referring to 'sites/default/files/simpletest' or 'sites/yoursite.com/files/simpletest'.
The directory only has the files that the .install file creates:
binary-1.txt
binary-2.txt
text-1.txt
text-2.txt
text-3.txt
text-4.txt
text-5.txt
Which means that when drupalGetTestFiles scans for any $type other than 'binary' or 'text' it won't return any files, as to be expected as no other files exist.
It appears to me that there is something missing in either simpletest_install or drupalGetTestFiles, such as a file_copy() call to duplicate the test files from 'sites/all/modules/simpletest/files' to 'sites/default/files/simpletest'.
I checked the install file of the DRUPAL 7 version and it looked roughly the same. I have not checked the drupalGetTestFiles in the DRUPAL 7 version, or tested the DRUPAL 7 version.
Comment #3
dave reidI uninstalled SimpleTest then installed it again, and confirmed that it only created the 'generated' files into sites/default/files/simpletest and did not copy any of the files from sites/all/modules/simpletest/files. A look into simpletest_install() shows that the D7-PREG syntax was used in file_scan_directory() instead of the D6-EREG syntax. With this patch, all the files were copied/generated correctly. Patch also fixes the fact that there is no file_unmanaged_copy in D6. It's file_copy(). :) We didn't catch this since the foreach loop never executed.
Give this patch a try!
Comment #4
decipheredWorked like a charm, thanks Dave.
Comment #5
boombatower commentedSeems to be related to #304936: SimpleTest proper installation of test files and removal which just needs to be backported?
Comment #6
dave reidIt will help, but we still need to be using the D6 functions and ereg-style regular expressions in drupal_scan_directory().
Comment #7
boombatower commentedFixed per #567422: Fresh backport of Drupal 7 SimpleTest please reopen if not.