base.test in Views data export 7.4
File
tests/exporter_tests/base.test
View source
<?php
abstract class ViewsDataExportExporterBaseTest extends DrupalUnitTestCase {
protected function executeFullWrite($exporter, $rows, $row_count, $field_titles) {
$file = fopen('php://memory', 'w+');
foreach ($rows as $row) {
$exporter
->add_row($file, $row, $row_count, $field_titles);
$row_count++;
}
fseek($file, 0);
$contents = '';
while (!feof($file)) {
$contents .= fread($file, 8192);
}
fclose($file);
return $contents;
}
protected function executeBOF($exporter) {
$file = fopen('php://memory', 'w+');
$exporter
->bof($file);
fseek($file, 0);
$contents = '';
while (!feof($file)) {
$contents .= fread($file, 8192);
}
fclose($file);
return $contents;
}
protected function executeEOF($exporter) {
$file = fopen('php://memory', 'w+');
$exporter
->eof($file, 5, 5);
fseek($file, 0);
$contents = '';
while (!feof($file)) {
$contents .= fread($file, 8192);
}
fclose($file);
return $contents;
}
protected function verbose($message) {
return $this
->error($message, 'User notice');
}
public function logVerboseResult($result, $prefix = '') {
$this
->verbose($prefix . '<br><pre>' . check_plain($result) . '</pre>');
}
}