Commit f1463d37 authored by xjm's avatar xjm

Issue #2299361 by trgreen17, wadmiraal, naveenvalecha, er.pushpinderrana,...

Issue #2299361 by trgreen17, wadmiraal, naveenvalecha, er.pushpinderrana, neetu morwani, jhodgdon, joachim: description of drupalGetTestFiles() is vague and has a typo; simpletest_generate_file() needs help too
parent 291e4f55
......@@ -487,16 +487,23 @@ function simpletest_classloader_register() {
}
/**
* Generates test file.
* Generates a test file.
*
* @param string $filename
* The name of the file, including the path.
* The name of the file, including the path. The suffix '.txt' is appended to
* the supplied file name and the file is put into the public:// files
* directory.
* @param int $width
* The number of characters on one line.
* @param int $lines
* The number of lines in the file.
* @param string $type
* (optional) The type, for example: "text", "binary", or "binary-text".
* (optional) The type, one of:
* - text: The generated file contains random ASCII characters.
* - binary: The generated file contains random characters whose codes are in
* the range of 0 to 31.
* - binary-text: The generated file contains random sequence of '0' and '1'
* values.
*
* @return string
* The name of the file, including the path.
......
......@@ -458,16 +458,37 @@ protected function findBlockInstance(Block $block) {
}
/**
* Gets a list files that can be used in tests.
* Gets a list of files that can be used in tests.
*
* The first time this method is called, it will call
* simpletest_generate_file() to generate binary and ASCII text files in the
* public:// directory. It will also copy all files in
* core/modules/simpletest/files to public://. These contain image, SQL, PHP,
* JavaScript, and HTML files.
*
* All filenames are prefixed with their type and have appropriate extensions:
* - text-*.txt
* - binary-*.txt
* - html-*.html and html-*.txt
* - image-*.png, image-*.jpg, and image-*.gif
* - javascript-*.txt and javascript-*.script
* - php-*.txt and php-*.php
* - sql-*.txt and sql-*.sql
*
* Any subsequent calls will not generate any new files, or copy the files
* over again. However, if a test class adds a new file to public:// that
* is prefixed with one of the above types, it will get returned as well, even
* on subsequent calls.
*
* @param $type
* File type, possible values: 'binary', 'html', 'image', 'javascript',
* 'php', 'sql', 'text'.
* @param $size
* File size in bytes to match. Please check the tests/files folder.
* (optional) File size in bytes to match. Defaults to NULL, which will not
* filter the returned list by size.
*
* @return
* List of files that match filter.
* List of files in public:// that match the filter(s).
*/
protected function drupalGetTestFiles($type, $size = NULL) {
if (empty($this->generatedTestFiles)) {
......@@ -478,7 +499,7 @@ protected function drupalGetTestFiles($type, $size = NULL) {
simpletest_generate_file('binary-' . $count++, 64, $line, 'binary');
}
// Generate text test files.
// Generate ASCII text test files.
$lines = array(16, 256, 1024, 2048, 20480);
$count = 0;
foreach ($lines as $line) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment