### Eclipse Workspace Patch 1.0 #P simpletest Index: INSTALL.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/INSTALL.txt,v retrieving revision 1.6 diff -u -r1.6 INSTALL.txt --- INSTALL.txt 21 Jan 2008 09:00:37 -0000 1.6 +++ INSTALL.txt 20 Mar 2008 00:02:11 -0000 @@ -9,11 +9,12 @@ 3. Uncompress it inside your SimpleTest module directory, so the official SimpleTest files are located at: sites/all/modules/simpletest/simpletest -4. Go to Administer >> Site building >> Modules (admin/build/modules) and +4. Ensure that the script has write access to simpletest/tests/files. +5. Go to Administer >> Site building >> Modules (admin/build/modules) and enable the SimpleTest module. -5. Go to Administer >> Site building >> SimpleTest (admin/build/simpletest) to +6. Go to Administer >> Site building >> SimpleTest (admin/build/simpletest) to begin using the module. -6. (Optional) Go to Administer >> Help >> SimpleTest (admin/help/simpletest) +7. (Optional) Go to Administer >> Help >> SimpleTest (admin/help/simpletest) for more information on how to use the SimpleTest module. -7. (Optional) Go to Administer >> Site configuration >> SimpleTest settings +8. (Optional) Go to Administer >> Site configuration >> SimpleTest settings (admin/settings/simpletest) to configure advanced settings. Index: drupal_test_case.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/drupal_test_case.php,v retrieving revision 1.57 diff -u -r1.57 drupal_test_case.php --- drupal_test_case.php 17 Mar 2008 23:57:29 -0000 1.57 +++ drupal_test_case.php 20 Mar 2008 00:02:11 -0000 @@ -117,6 +117,34 @@ } /** + * Get a file that can be used in tests. + * + * @param string $type File type, possible values: 'binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'. + * @param integer $size File size in bytes to match. Please check the tests/files folder. + * @return array List of files that match filter. + */ + function drupalGetTestFiles($type, $size = NULL) { + $files = array(); + + // Make sure type is valid. + if (in_array($type, array('binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'))) { + $path = drupal_get_path('module', 'simpletest') .'/tests/files'; + $files = file_scan_directory($path, $type .'\-.*'); + + // If size is set then remove any files that are not of that size. + if ($size !== NULL) { + foreach ($files as $file) { + $stats = stat($file->filename); + if ($stats['size'] != $size) { + unset($files[$file->filename]); + } + } + } + } + return $files; + } + + /** * @abstract Checks to see if we need to send * a http-auth header to authenticate * when browsing a site. Index: tests/files/sql-2.sql =================================================================== RCS file: tests/files/sql-2.sql diff -N tests/files/sql-2.sql --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/files/sql-2.sql 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,1 @@ +SELECT invalid_field FROM {invalid_table} Index: tests/files/php-1.txt =================================================================== RCS file: tests/files/php-1.txt diff -N tests/files/php-1.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/files/php-1.txt 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,3 @@ + Index: tests/files/html-1.txt =================================================================== RCS file: tests/files/html-1.txt diff -N tests/files/html-1.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/files/html-1.txt 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,1 @@ +