function VoteUpDownTestCase::writeFile in Vote Up/Down 6
Write the given data to the given filename, relative to the Drupal temporary directory. This method is really useful for determining what was in the HTML page that DrupalWebTestCase actually saw.
Parameters
$filename: The filename to write (defaults to out.html).
$data: The data that will be written to the above file (defaults to the content of the current page).
File
- tests/
vote_up_down.test, line 435 - Test file for Vote Up/Down.
Class
Code
function writeFile($filename = 'out.html', $data = NULL) {
$data = $data == NULL ? $this
->drupalGetContent() : $data;
$filename = file_directory_temp() . '/' . $filename;
$this
->assertTrue(file_put_contents($filename, $data), t('Wrote content to %filename', array(
'%filename' => $filename,
)));
drupal_set_message("Wrote content to {$filename}");
}