Updated export unit test

This commit is contained in:
Jonathan Labreuille
2016-08-17 12:51:50 +02:00
parent 876e386966
commit 916ae97f73
2 changed files with 28 additions and 13 deletions

View File

@ -222,21 +222,36 @@ class ExportTest extends MailPoetTest {
}
function testItRequiresWritableExportFile() {
try {
$this->export->export_path = '/fake_folder';
$result = $this->export->process();
expect($result['errors'][0])
$this->export->process();
$this->fail('Export did not throw an exception');
} catch(\Exception $e) {
expect($e->getMessage())
->equals("Couldn't save export file on the server");
}
}
function testItCanProcess() {
try {
$this->export->export_file = $this->export->getExportFile('csv');
$this->export->export_format_option = 'csv';
$result = $this->export->process();
expect($result['result'])->true();
} catch(\Exception $e) {
$this->fail('Export to .csv process threw an exception');
}
expect($result['totalExported'])->equals(3);
expect($result['exportFileURL'])->notEmpty();
try {
$this->export->export_file = $this->export->getExportFile('xlsx');
$this->export->export_format_option = 'xlsx';
$result = $this->export->process();
expect($result['result'])->true();
} catch(\Exception $e) {
$this->fail('Export to .xlsx process threw an exception');
}
expect($result['totalExported'])->equals(3);
expect($result['exportFileURL'])->notEmpty();
}
function _after() {