- Enables check for writable export file

This commit is contained in:
Vlad
2016-02-16 17:32:41 -05:00
parent 854736fac7
commit 636fa38ab6
3 changed files with 11 additions and 1 deletions

View File

@@ -148,7 +148,7 @@ define(
.done(function (response) {
MailPoet.Modal.loading(false);
if (response.result === false) {
MailPoet.Notice.error(response.error);
MailPoet.Notice.error(response.errors);
} else {
resultMessage = MailPoetI18n.exportMessage
.replace('%1$s', '<strong>' + response.data.totalExported + '</strong>')

View File

@@ -41,6 +41,9 @@ class Export {
$subscriber_custom_fields
);
try {
if(is_writable($this->export_file)) {
throw new \Exception(__("Couldn't save export file on the server."));
}
if($this->export_format_option === 'csv') {
$CSV_file = fopen($this->export_file, 'w');
$format_CSV = function($row) {

View File

@@ -211,6 +211,13 @@ class ExportCest {
expect(count($subscribers))->equals(2);
}
function itRequiresWritableExportFile() {
$this->export->export_file = '/dev/random';
$result = $this->export->process();
expect($result['errors'][0])
->equals("Couldn't save export file on the server.");
}
function itCanProcess() {
$this->export->export_file = $this->export->getExportFile('csv');
$this->export->export_format_option = 'csv';