mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-01 11:47:14 -06:00
This fixes the tests.
This commit is contained in:
parent
be201e811d
commit
349d254193
@ -26,7 +26,6 @@ use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface as EJRI;
|
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface as EJRI;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
use Storage;
|
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +144,7 @@ class ExportController extends Controller
|
|||||||
'job' => $job,
|
'job' => $job,
|
||||||
];
|
];
|
||||||
|
|
||||||
$job->change('export_status_make_exporter');
|
$jobs->changeStatus($job, 'export_status_make_exporter');
|
||||||
|
|
||||||
/** @var ProcessorInterface $processor */
|
/** @var ProcessorInterface $processor */
|
||||||
$processor = app(ProcessorInterface::class, [$settings]);
|
$processor = app(ProcessorInterface::class, [$settings]);
|
||||||
@ -153,47 +152,46 @@ class ExportController extends Controller
|
|||||||
/*
|
/*
|
||||||
* Collect journals:
|
* Collect journals:
|
||||||
*/
|
*/
|
||||||
$job->change('export_status_collecting_journals');
|
$jobs->changeStatus($job, 'export_status_collecting_journals');
|
||||||
$processor->collectJournals();
|
$processor->collectJournals();
|
||||||
$job->change('export_status_collected_journals');
|
$jobs->changeStatus($job, 'export_status_collected_journals');
|
||||||
/*
|
/*
|
||||||
* Transform to exportable entries:
|
* Transform to exportable entries:
|
||||||
*/
|
*/
|
||||||
$job->change('export_status_converting_to_export_format');
|
$jobs->changeStatus($job, 'export_status_converting_to_export_format');
|
||||||
$processor->convertJournals();
|
$processor->convertJournals();
|
||||||
$job->change('export_status_converted_to_export_format');
|
$jobs->changeStatus($job, 'export_status_converted_to_export_format');
|
||||||
/*
|
/*
|
||||||
* Transform to (temporary) file:
|
* Transform to (temporary) file:
|
||||||
*/
|
*/
|
||||||
$job->change('export_status_creating_journal_file');
|
$jobs->changeStatus($job, 'export_status_creating_journal_file');
|
||||||
$processor->exportJournals();
|
$processor->exportJournals();
|
||||||
$job->change('export_status_created_journal_file');
|
$jobs->changeStatus($job, 'export_status_created_journal_file');
|
||||||
/*
|
/*
|
||||||
* Collect attachments, if applicable.
|
* Collect attachments, if applicable.
|
||||||
*/
|
*/
|
||||||
if ($settings['includeAttachments']) {
|
if ($settings['includeAttachments']) {
|
||||||
$job->change('export_status_collecting_attachments');
|
$jobs->changeStatus($job, 'export_status_collecting_attachments');
|
||||||
$processor->collectAttachments();
|
$processor->collectAttachments();
|
||||||
$job->change('export_status_collected_attachments');
|
$jobs->changeStatus($job, 'export_status_collected_attachments');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Collect old uploads
|
* Collect old uploads
|
||||||
*/
|
*/
|
||||||
if ($settings['includeOldUploads']) {
|
if ($settings['includeOldUploads']) {
|
||||||
$job->change('export_status_collecting_old_uploads');
|
$jobs->changeStatus($job, 'export_status_collecting_old_uploads');
|
||||||
$processor->collectOldUploads();
|
$processor->collectOldUploads();
|
||||||
$job->change('export_status_collected_old_uploads');
|
$jobs->changeStatus($job, 'export_status_collected_old_uploads');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create ZIP file:
|
* Create ZIP file:
|
||||||
*/
|
*/
|
||||||
$job->change('export_status_creating_zip_file');
|
$jobs->changeStatus($job, 'export_status_creating_zip_file');
|
||||||
$processor->createZipFile();
|
$processor->createZipFile();
|
||||||
$job->change('export_status_created_zip_file');
|
$jobs->changeStatus($job, 'export_status_created_zip_file');
|
||||||
|
$jobs->changeStatus($job, 'export_status_finished');
|
||||||
$job->change('export_status_finished');
|
|
||||||
|
|
||||||
return Response::json('ok');
|
return Response::json('ok');
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,19 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
|||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportJob $job
|
||||||
|
* @param string $status
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function changeStatus(ExportJob $job, string $status): bool
|
||||||
|
{
|
||||||
|
$job->change($status);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -32,6 +32,14 @@ interface ExportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function create(): ExportJob;
|
public function create(): ExportJob;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportJob $job
|
||||||
|
* @param string $status
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function changeStatus(ExportJob $job, string $status): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ExportJob $job
|
* @param ExportJob $job
|
||||||
*
|
*
|
||||||
|
@ -49,11 +49,8 @@ class FireflyConfig
|
|||||||
*/
|
*/
|
||||||
public function get($name, $default = null)
|
public function get($name, $default = null)
|
||||||
{
|
{
|
||||||
Log::debug('Now in FFConfig::get()', ['name' => $name]);
|
|
||||||
$fullName = 'ff-config-' . $name;
|
$fullName = 'ff-config-' . $name;
|
||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
Log::debug('Return cache.');
|
|
||||||
|
|
||||||
return Cache::get($fullName);
|
return Cache::get($fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test.sh
1
test.sh
@ -81,6 +81,7 @@ then
|
|||||||
echo "Will not reset database"
|
echo "Will not reset database"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Copy test database over original"
|
||||||
# take database from copy:
|
# take database from copy:
|
||||||
cp $DATABASECOPY $DATABASE
|
cp $DATABASECOPY $DATABASE
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* See the LICENSE file for details.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
use FireflyIII\Export\Processor;
|
use FireflyIII\Export\Processor;
|
||||||
|
use FireflyIII\Models\ExportJob;
|
||||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,6 +84,10 @@ class ExportControllerTest extends TestCase
|
|||||||
$processor->shouldReceive('exportJournals')->once();
|
$processor->shouldReceive('exportJournals')->once();
|
||||||
$processor->shouldReceive('createZipFile')->once();
|
$processor->shouldReceive('createZipFile')->once();
|
||||||
|
|
||||||
|
$repository = $this->mock(ExportJobRepositoryInterface::class);
|
||||||
|
$repository->shouldReceive('changeStatus')->andReturn(true);
|
||||||
|
$repository->shouldReceive('findByKey')->andReturn(new ExportJob);
|
||||||
|
|
||||||
|
|
||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
$this->call('post', route('export.export'), $data);
|
$this->call('post', route('export.export'), $data);
|
||||||
|
Loading…
Reference in New Issue
Block a user