mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expand tests.
This commit is contained in:
parent
1adb0f2f0e
commit
9515ce6807
@ -20,7 +20,10 @@ install:
|
||||
- mv storage/database/databasecopy.sqlite storage/database/database.sqlite
|
||||
|
||||
script:
|
||||
- phpunit
|
||||
- phpunit -c phpunit.coverage.xml
|
||||
|
||||
after_success:
|
||||
- travis_retry php vendor/bin/coveralls -x storage/build/clover.xml
|
||||
|
||||
# safelist
|
||||
branches:
|
||||
|
@ -43,12 +43,12 @@ class Help implements HelpInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $language
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFromGithub(string $language, string $route): string
|
||||
public function getFromGithub(string $route, string $language): string
|
||||
{
|
||||
|
||||
$uri = sprintf('https://raw.githubusercontent.com/firefly-iii/help/master/%s/%s.md', $language, $route);
|
||||
|
@ -29,12 +29,12 @@ interface HelpInterface
|
||||
public function getFromCache(string $route, string $language): string;
|
||||
|
||||
/**
|
||||
* @param string $language
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFromGithub(string $language, string $route): string;
|
||||
public function getFromGithub(string $route, string $language): string;
|
||||
|
||||
/**
|
||||
* @param string $route
|
||||
|
@ -17,6 +17,7 @@ use Cache;
|
||||
use FireflyIII\Http\Requests\CurrencyFormRequest;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
use Preferences;
|
||||
@ -30,6 +31,11 @@ use View;
|
||||
class CurrencyController extends Controller
|
||||
{
|
||||
|
||||
/** @var CurrencyRepositoryInterface */
|
||||
protected $repository;
|
||||
|
||||
/** @var UserRepositoryInterface */
|
||||
protected $userRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -43,6 +49,8 @@ class CurrencyController extends Controller
|
||||
function ($request, $next) {
|
||||
View::share('title', trans('firefly.currencies'));
|
||||
View::share('mainTitleIcon', 'fa-usd');
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@ -52,10 +60,16 @@ class CurrencyController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
if (!$this->userRepository->hasRole(auth()->user(), 'owner')) {
|
||||
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
}
|
||||
|
||||
$subTitleIcon = 'fa-plus';
|
||||
$subTitle = trans('firefly.create_currency');
|
||||
|
||||
@ -92,15 +106,22 @@ class CurrencyController extends Controller
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CurrencyRepositoryInterface $repository
|
||||
* @param TransactionCurrency $currency
|
||||
* @param Request $request
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
*/
|
||||
public function delete(Request $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
|
||||
public function delete(Request $request, TransactionCurrency $currency)
|
||||
{
|
||||
if (!$repository->canDeleteCurrency($currency)) {
|
||||
if (!$this->userRepository->hasRole(auth()->user(), 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
if (!$this->repository->canDeleteCurrency($currency)) {
|
||||
$request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
@ -118,21 +139,28 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CurrencyRepositoryInterface $repository
|
||||
* @param TransactionCurrency $currency
|
||||
* @param Request $request
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function destroy(Request $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
|
||||
public function destroy(Request $request, TransactionCurrency $currency)
|
||||
{
|
||||
if (!$repository->canDeleteCurrency($currency)) {
|
||||
if (!$this->userRepository->hasRole(auth()->user(), 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
if (!$this->repository->canDeleteCurrency($currency)) {
|
||||
$request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
}
|
||||
|
||||
$repository->destroy($currency);
|
||||
$this->repository->destroy($currency);
|
||||
$request->session()->flash('success', trans('firefly.deleted_currency', ['name' => $currency->name]));
|
||||
|
||||
return redirect($this->getPreviousUri('currencies.delete.uri'));
|
||||
@ -142,10 +170,18 @@ class CurrencyController extends Controller
|
||||
* @param Request $request
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
*/
|
||||
public function edit(Request $request, TransactionCurrency $currency)
|
||||
{
|
||||
if (!$this->userRepository->hasRole(auth()->user(), 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
$subTitle = trans('breadcrumbs.edit_currency', ['name' => $currency->name]);
|
||||
$currency->symbol = htmlentities($currency->symbol);
|
||||
@ -163,74 +199,79 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CurrencyRepositoryInterface $repository
|
||||
* @param Request $request
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function index(Request $request, CurrencyRepositoryInterface $repository)
|
||||
public function index(Request $request)
|
||||
{
|
||||
$currencies = $repository->get();
|
||||
$defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR')));
|
||||
|
||||
|
||||
if (!auth()->user()->hasRole('owner')) {
|
||||
$currencies = $this->repository->get();
|
||||
$defaultCurrency = $this->repository->getCurrencyByPreference(Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR')));
|
||||
if (!$this->userRepository->hasRole(auth()->user(), 'owner')) {
|
||||
$request->session()->flash('info', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
|
||||
}
|
||||
|
||||
|
||||
return view('currencies.index', compact('currencies', 'defaultCurrency'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CurrencyFormRequest $request
|
||||
*
|
||||
* @param CurrencyFormRequest $request
|
||||
* @param CurrencyRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function store(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository)
|
||||
public function store(CurrencyFormRequest $request)
|
||||
{
|
||||
if (!auth()->user()->hasRole('owner')) {
|
||||
if (!$this->userRepository->hasRole(auth()->user(), 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.');
|
||||
|
||||
return redirect($this->getPreviousUri('currencies.create.uri'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
$data = $request->getCurrencyData();
|
||||
$currency = $repository->store($data);
|
||||
$currency = $this->repository->store($data);
|
||||
$request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name]));
|
||||
|
||||
if (intval($request->get('create_another')) === 1) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->put('currencies.create.fromStore', true);
|
||||
|
||||
return redirect(route('currencies.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return redirect($this->getPreviousUri('currencies.create.uri'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CurrencyFormRequest $request
|
||||
* @param CurrencyRepositoryInterface $repository
|
||||
* @param TransactionCurrency $currency
|
||||
* @param CurrencyFormRequest $request
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function update(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
|
||||
public function update(CurrencyFormRequest $request, TransactionCurrency $currency)
|
||||
{
|
||||
$data = $request->getCurrencyData();
|
||||
if (auth()->user()->hasRole('owner')) {
|
||||
$currency = $repository->update($currency, $data);
|
||||
if (!$this->userRepository->hasRole(auth()->user(), 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
$data = $request->getCurrencyData();
|
||||
$currency = $this->repository->update($currency, $data);
|
||||
$request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name]));
|
||||
Preferences::mark();
|
||||
|
||||
|
||||
if (intval($request->get('return_to_edit')) === 1) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->put('currencies.edit.fromUpdate', true);
|
||||
|
||||
return redirect(route('currencies.edit', [$currency->id]));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return redirect($this->getPreviousUri('currencies.edit.uri'));
|
||||
|
@ -58,7 +58,7 @@ class HelpController extends Controller
|
||||
return Response::json($content);
|
||||
}
|
||||
|
||||
$content = $help->getFromGithub($language, $route);
|
||||
$content = $help->getFromGithub($route, $language);
|
||||
$notYourLanguage = '<p><em>' . strval(trans('firefly.help_may_not_be_your_language')) . '</em></p>';
|
||||
|
||||
// get backup language content (try English):
|
||||
@ -66,10 +66,10 @@ class HelpController extends Controller
|
||||
$language = 'en_US';
|
||||
if ($help->inCache($route, $language)) {
|
||||
Log::debug(sprintf('Help text %s was in cache.', $language));
|
||||
$content = $help->getFromCache($route, $language);
|
||||
$content = $notYourLanguage . $help->getFromCache($route, $language);
|
||||
}
|
||||
if (!$help->inCache($route, $language)) {
|
||||
$content = trim($notYourLanguage . $help->getFromGithub($language, $route));
|
||||
$content = trim($notYourLanguage . $help->getFromGithub($route, $language));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ use FireflyIII\Import\Setup\SetupInterface;
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response as LaravelResponse;
|
||||
use Log;
|
||||
@ -87,8 +88,6 @@ class ImportController extends Controller
|
||||
{
|
||||
Log::debug('Now at start of configure()');
|
||||
if (!$this->jobInCorrectStep($job, 'configure')) {
|
||||
Log::debug('Job is not in correct state for configure()', ['status' => $job->status]);
|
||||
|
||||
return $this->redirectToCorrectStep($job);
|
||||
}
|
||||
|
||||
@ -100,8 +99,6 @@ class ImportController extends Controller
|
||||
$subTitleIcon = 'fa-wrench';
|
||||
|
||||
return view('import.' . $job->file_type . '.configure', compact('data', 'job', 'subTitle', 'subTitleIcon'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,8 +142,6 @@ class ImportController extends Controller
|
||||
public function finished(ImportJob $job)
|
||||
{
|
||||
if (!$this->jobInCorrectStep($job, 'finished')) {
|
||||
Log::debug('Job is not in correct state for finished()', ['status' => $job->status]);
|
||||
|
||||
return $this->redirectToCorrectStep($job);
|
||||
}
|
||||
|
||||
@ -224,13 +219,13 @@ class ImportController extends Controller
|
||||
/**
|
||||
* Step 4. Save the configuration.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param ImportJob $job
|
||||
* @param Request $request
|
||||
* @param ImportJobRepositoryInterface $repository
|
||||
* @param ImportJob $job
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function postConfigure(Request $request, ImportJob $job)
|
||||
public function postConfigure(Request $request, ImportJobRepositoryInterface $repository, ImportJob $job)
|
||||
{
|
||||
Log::debug('Now in postConfigure()', ['job' => $job->key]);
|
||||
if (!$this->jobInCorrectStep($job, 'process')) {
|
||||
@ -245,8 +240,7 @@ class ImportController extends Controller
|
||||
$importer->saveImportConfiguration($data, $files);
|
||||
|
||||
// update job:
|
||||
$job->status = 'import_configuration_saved';
|
||||
$job->save();
|
||||
$repository->updateStatus($job, 'import_configuration_saved');
|
||||
|
||||
// return redirect to settings.
|
||||
// this could loop until the user is done.
|
||||
@ -285,12 +279,10 @@ class ImportController extends Controller
|
||||
* @return View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function settings(ImportJob $job)
|
||||
public function settings(ImportJobRepositoryInterface $repository, ImportJob $job)
|
||||
{
|
||||
Log::debug('Now in settings()', ['job' => $job->key]);
|
||||
if (!$this->jobInCorrectStep($job, 'settings')) {
|
||||
Log::debug('Job should not be in settings()');
|
||||
|
||||
return $this->redirectToCorrectStep($job);
|
||||
}
|
||||
Log::debug('Continue in settings()');
|
||||
@ -308,8 +300,7 @@ class ImportController extends Controller
|
||||
}
|
||||
Log::debug('Job does NOT require user config.');
|
||||
|
||||
$job->status = 'settings_complete';
|
||||
$job->save();
|
||||
$repository->updateStatus($job, 'settings_complete');
|
||||
|
||||
// if no more settings, save job and continue to process thing.
|
||||
return redirect(route('import.complete', [$job->key]));
|
||||
@ -350,15 +341,17 @@ class ImportController extends Controller
|
||||
return view('import.status', compact('job', 'subTitle', 'subTitleIcon'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is step 2. It creates an Import Job. Stores the import.
|
||||
*
|
||||
* @param ImportUploadRequest $request
|
||||
* @param ImportJobRepositoryInterface $repository
|
||||
* @param UserRepositoryInterface $userRepository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function upload(ImportUploadRequest $request, ImportJobRepositoryInterface $repository)
|
||||
public function upload(ImportUploadRequest $request, ImportJobRepositoryInterface $repository, UserRepositoryInterface $userRepository)
|
||||
{
|
||||
Log::debug('Now in upload()');
|
||||
// create import job:
|
||||
@ -375,7 +368,7 @@ class ImportController extends Controller
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
// user is demo user, replace upload with prepared file.
|
||||
if (auth()->user()->hasRole('demo')) {
|
||||
if ($userRepository->hasRole(auth()->user(),'demo')) {
|
||||
$stubsDisk = Storage::disk('stubs');
|
||||
$content = $stubsDisk->get('demo-import.csv');
|
||||
$contentEncrypted = Crypt::encrypt($content);
|
||||
@ -384,14 +377,13 @@ class ImportController extends Controller
|
||||
|
||||
// also set up prepared configuration.
|
||||
$configuration = json_decode($stubsDisk->get('demo-configuration.json'), true);
|
||||
$job->configuration = $configuration;
|
||||
$job->save();
|
||||
$repository->setConfiguration($job, $configuration);
|
||||
Log::debug('Set configuration for demo user', $configuration);
|
||||
|
||||
// also flash info
|
||||
Session::flash('info', trans('demo.import-configure-security'));
|
||||
}
|
||||
if (!auth()->user()->hasRole('demo')) {
|
||||
if (!$userRepository->hasRole(auth()->user(),'demo')) {
|
||||
// user is not demo, process original upload:
|
||||
$disk->put($newName, $contentEncrypted);
|
||||
Log::debug('Uploaded file', ['name' => $upload->getClientOriginalName(), 'size' => $upload->getSize(), 'mime' => $upload->getClientMimeType()]);
|
||||
@ -411,18 +403,14 @@ class ImportController extends Controller
|
||||
$configRaw = $configFileObject->fread($configFileObject->getSize());
|
||||
$configuration = json_decode($configRaw, true);
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if (!is_null($configuration) && is_array($configuration)) {
|
||||
Log::debug('Found configuration', $configuration);
|
||||
$job->configuration = $configuration;
|
||||
$job->save();
|
||||
$repository->setConfiguration($job, $configuration);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// if user is demo user, replace config with prepared config:
|
||||
|
||||
|
||||
return redirect(route('import.configure', [$job->key]));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -440,6 +428,7 @@ class ImportController extends Controller
|
||||
return $job->status === 'import_status_never_started';
|
||||
case 'settings':
|
||||
case 'store-settings':
|
||||
Log::debug(sprintf('Job %d with key %s has status %s', $job->id, $job->key, $job->status));
|
||||
return $job->status === 'import_configuration_saved';
|
||||
case 'finished':
|
||||
return $job->status === 'import_complete';
|
||||
@ -449,7 +438,7 @@ class ImportController extends Controller
|
||||
return ($job->status === 'settings_complete') || ($job->status === 'import_running');
|
||||
}
|
||||
|
||||
return false;
|
||||
return false; // @codeCoverageIgnore
|
||||
|
||||
}
|
||||
|
||||
@ -475,7 +464,7 @@ class ImportController extends Controller
|
||||
|
||||
return $importer;
|
||||
}
|
||||
throw new FireflyException(sprintf('"%s" is not a valid file type', $type));
|
||||
throw new FireflyException(sprintf('"%s" is not a valid file type', $type)); // @codeCoverageIgnore
|
||||
|
||||
}
|
||||
|
||||
@ -507,7 +496,7 @@ class ImportController extends Controller
|
||||
return redirect(route('import.finished', [$job->key]));
|
||||
}
|
||||
|
||||
throw new FireflyException('Cannot redirect for job state ' . $job->status);
|
||||
throw new FireflyException('Cannot redirect for job state ' . $job->status); // @codeCoverageIgnore
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class JavascriptController extends Controller
|
||||
|
||||
switch ($viewRange) {
|
||||
default:
|
||||
throw new FireflyException('The date picker does not yet support "' . $viewRange . '".');
|
||||
throw new FireflyException('The date picker does not yet support "' . $viewRange . '".'); // @codeCoverageIgnore
|
||||
case '1D':
|
||||
case 'custom':
|
||||
$format = (string)trans('config.month_and_day');
|
||||
|
@ -86,6 +86,20 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
* @param array $configuration
|
||||
*
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function setConfiguration(ImportJob $job, array $configuration): ImportJob
|
||||
{
|
||||
$job->configuration = $configuration;
|
||||
$job->save();
|
||||
|
||||
return $job;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
@ -93,4 +107,18 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
* @param string $status
|
||||
*
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function updateStatus(ImportJob $job, string $status): ImportJob
|
||||
{
|
||||
$job->status = $status;
|
||||
$job->save();
|
||||
|
||||
return $job;
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,24 @@ interface ImportJobRepositoryInterface
|
||||
*/
|
||||
public function findByKey(string $key): ImportJob;
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
* @param array $configuration
|
||||
*
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function setConfiguration(ImportJob $job, array $configuration): ImportJob;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
* @param string $status
|
||||
*
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function updateStatus(ImportJob $job, string $status): ImportJob;
|
||||
}
|
||||
|
@ -147,4 +147,15 @@ class UserRepository implements UserRepositoryInterface
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $role
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRole(User $user, string $role): bool
|
||||
{
|
||||
return $user->hasRole($role);
|
||||
}
|
||||
}
|
||||
|
@ -79,4 +79,12 @@ interface UserRepositoryInterface
|
||||
* @return array
|
||||
*/
|
||||
public function getUserData(User $user): array;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $role
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRole(User $user, string $role): bool;
|
||||
}
|
||||
|
@ -72,7 +72,8 @@
|
||||
"symfony/css-selector": "3.1.*",
|
||||
"symfony/dom-crawler": "3.1.*",
|
||||
"barryvdh/laravel-debugbar": "2.*",
|
||||
"barryvdh/laravel-ide-helper": "2.*"
|
||||
"barryvdh/laravel-ide-helper": "2.*",
|
||||
"satooshi/php-coveralls": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
503
composer.lock
generated
503
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5286d8b4bfb450a5cecae36d2f67a862",
|
||||
"content-hash": "3570b1bf4768d7a7db0667317e82c668",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
@ -974,16 +974,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "1.0.35",
|
||||
"version": "1.0.36",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem.git",
|
||||
"reference": "dda7f3ab94158a002d9846a97dc18ebfb7acc062"
|
||||
"reference": "d9c1698582dfbfbd092ec9c5c3325f862cdb3297"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/dda7f3ab94158a002d9846a97dc18ebfb7acc062",
|
||||
"reference": "dda7f3ab94158a002d9846a97dc18ebfb7acc062",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d9c1698582dfbfbd092ec9c5c3325f862cdb3297",
|
||||
"reference": "d9c1698582dfbfbd092ec9c5c3325f862cdb3297",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1053,20 +1053,20 @@
|
||||
"sftp",
|
||||
"storage"
|
||||
],
|
||||
"time": "2017-02-09T11:33:58+00:00"
|
||||
"time": "2017-03-18T16:02:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.22.0",
|
||||
"version": "1.22.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558"
|
||||
"reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558",
|
||||
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0",
|
||||
"reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1131,7 +1131,7 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-11-26T00:15:39+00:00"
|
||||
"time": "2017-03-13T07:08:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mtdowling/cron-expression",
|
||||
@ -1232,16 +1232,16 @@
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v2.0.9",
|
||||
"version": "v2.0.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "6968531206671f94377b01dc7888d5d1b858a01b"
|
||||
"reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/6968531206671f94377b01dc7888d5d1b858a01b",
|
||||
"reference": "6968531206671f94377b01dc7888d5d1b858a01b",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d",
|
||||
"reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1276,7 +1276,7 @@
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2017-03-03T20:43:42+00:00"
|
||||
"time": "2017-03-13T16:27:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pragmarx/google2fa",
|
||||
@ -1388,21 +1388,21 @@
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
"version": "3.5.2",
|
||||
"version": "3.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ramsey/uuid.git",
|
||||
"reference": "5677cfe02397dd6b58c861870dfaa5d9007d3954"
|
||||
"reference": "0b7bdfb180e72c8d76e75a649ced67e392201458"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid/zipball/5677cfe02397dd6b58c861870dfaa5d9007d3954",
|
||||
"reference": "5677cfe02397dd6b58c861870dfaa5d9007d3954",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid/zipball/0b7bdfb180e72c8d76e75a649ced67e392201458",
|
||||
"reference": "0b7bdfb180e72c8d76e75a649ced67e392201458",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"paragonie/random_compat": "^1.0|^2.0",
|
||||
"php": ">=5.4"
|
||||
"php": "^5.4 || ^7.0"
|
||||
},
|
||||
"replace": {
|
||||
"rhumsaa/uuid": "self.version"
|
||||
@ -1466,7 +1466,7 @@
|
||||
"identifier",
|
||||
"uuid"
|
||||
],
|
||||
"time": "2016-11-22T19:21:44+00:00"
|
||||
"time": "2017-03-18T15:38:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rcrowe/twigbridge",
|
||||
@ -1637,16 +1637,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870"
|
||||
"reference": "28fb243a2b5727774ca309ec2d92da240f1af0dd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/0e5e6899f82230fcb1153bcaf0e106ffaa44b870",
|
||||
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/28fb243a2b5727774ca309ec2d92da240f1af0dd",
|
||||
"reference": "28fb243a2b5727774ca309ec2d92da240f1af0dd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1696,7 +1696,7 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-16T14:07:22+00:00"
|
||||
"time": "2017-03-06T19:30:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
@ -1753,16 +1753,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9"
|
||||
"reference": "b90c9f91ad8ac37d9f114e369042d3226b34dc1a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/9b98854cb45bc59d100b7d4cc4cf9e05f21026b9",
|
||||
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/b90c9f91ad8ac37d9f114e369042d3226b34dc1a",
|
||||
"reference": "b90c9f91ad8ac37d9f114e369042d3226b34dc1a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1806,31 +1806,31 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-16T16:34:18+00:00"
|
||||
"time": "2017-02-18T17:28:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v3.2.4",
|
||||
"version": "v2.8.18",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "9137eb3a3328e413212826d63eeeb0217836e2b6"
|
||||
"reference": "bb4ec47e8e109c1c1172145732d0aa468d967cd0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9137eb3a3328e413212826d63eeeb0217836e2b6",
|
||||
"reference": "9137eb3a3328e413212826d63eeeb0217836e2b6",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bb4ec47e8e109c1c1172145732d0aa468d967cd0",
|
||||
"reference": "bb4ec47e8e109c1c1172145732d0aa468d967cd0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.8|~3.0",
|
||||
"symfony/dependency-injection": "~2.8|~3.0",
|
||||
"symfony/expression-language": "~2.8|~3.0",
|
||||
"symfony/stopwatch": "~2.8|~3.0"
|
||||
"symfony/config": "^2.0.5|~3.0.0",
|
||||
"symfony/dependency-injection": "~2.6|~3.0.0",
|
||||
"symfony/expression-language": "~2.6|~3.0.0",
|
||||
"symfony/stopwatch": "~2.3|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/dependency-injection": "",
|
||||
@ -1839,7 +1839,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
"dev-master": "2.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -1866,20 +1866,20 @@
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-02T20:32:22+00:00"
|
||||
"time": "2017-02-21T08:33:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6"
|
||||
"reference": "92d7476d2df60cd851a3e13e078664b1deb8ce10"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6",
|
||||
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/92d7476d2df60cd851a3e13e078664b1deb8ce10",
|
||||
"reference": "92d7476d2df60cd851a3e13e078664b1deb8ce10",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1915,20 +1915,20 @@
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-02T20:32:22+00:00"
|
||||
"time": "2017-02-21T09:12:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "a90da6dd679605d88c9803a57a6fc1fb7a19a6e0"
|
||||
"reference": "c57009887010eb4e58bfca2970314a5b820b24b9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/a90da6dd679605d88c9803a57a6fc1fb7a19a6e0",
|
||||
"reference": "a90da6dd679605d88c9803a57a6fc1fb7a19a6e0",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/c57009887010eb4e58bfca2970314a5b820b24b9",
|
||||
"reference": "c57009887010eb4e58bfca2970314a5b820b24b9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1968,20 +1968,20 @@
|
||||
],
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-16T22:46:52+00:00"
|
||||
"time": "2017-03-04T12:23:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "4cd0d4bc31819095c6ef13573069f621eb321081"
|
||||
"reference": "bc909e85b8585c9edf043d0fca871308c41bb9b4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/4cd0d4bc31819095c6ef13573069f621eb321081",
|
||||
"reference": "4cd0d4bc31819095c6ef13573069f621eb321081",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/bc909e85b8585c9edf043d0fca871308c41bb9b4",
|
||||
"reference": "bc909e85b8585c9edf043d0fca871308c41bb9b4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2050,7 +2050,7 @@
|
||||
],
|
||||
"description": "Symfony HttpKernel Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-16T23:59:56+00:00"
|
||||
"time": "2017-03-10T18:35:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
@ -2221,16 +2221,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856"
|
||||
"reference": "68bfa8c83f24c0ac04ea7193bcdcda4519f41892"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856",
|
||||
"reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/68bfa8c83f24c0ac04ea7193bcdcda4519f41892",
|
||||
"reference": "68bfa8c83f24c0ac04ea7193bcdcda4519f41892",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2266,20 +2266,20 @@
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-16T14:07:22+00:00"
|
||||
"time": "2017-03-04T12:23:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/routing.git",
|
||||
"reference": "af464432c177dbcdbb32295113b7627500331f2d"
|
||||
"reference": "d6605f9a5767bc5bc4895e1c762ba93964608aee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/af464432c177dbcdbb32295113b7627500331f2d",
|
||||
"reference": "af464432c177dbcdbb32295113b7627500331f2d",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/d6605f9a5767bc5bc4895e1c762ba93964608aee",
|
||||
"reference": "d6605f9a5767bc5bc4895e1c762ba93964608aee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2341,20 +2341,20 @@
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2017-01-28T02:37:08+00:00"
|
||||
"time": "2017-03-02T15:58:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "d6825c6bb2f1da13f564678f9f236fe8242c0029"
|
||||
"reference": "0e1b15ce8fbf3890f4ccdac430ed5e07fdfe0690"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/d6825c6bb2f1da13f564678f9f236fe8242c0029",
|
||||
"reference": "d6825c6bb2f1da13f564678f9f236fe8242c0029",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/0e1b15ce8fbf3890f4ccdac430ed5e07fdfe0690",
|
||||
"reference": "0e1b15ce8fbf3890f4ccdac430ed5e07fdfe0690",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2367,7 +2367,7 @@
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.8|~3.0",
|
||||
"symfony/intl": "~2.8|~3.0",
|
||||
"symfony/intl": "^2.8.18|^3.2.5",
|
||||
"symfony/yaml": "~2.8|~3.0"
|
||||
},
|
||||
"suggest": {
|
||||
@ -2405,26 +2405,29 @@
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-16T22:46:52+00:00"
|
||||
"time": "2017-03-04T12:23:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20"
|
||||
"reference": "4100f347aff890bc16b0b4b42843b599db257b2d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/cb50260b674ee1c2d4ab49f2395a42e0b4681e20",
|
||||
"reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/4100f347aff890bc16b0b4b42843b599db257b2d",
|
||||
"reference": "4100f347aff890bc16b0b4b42843b599db257b2d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"twig/twig": "~1.20|~2.0"
|
||||
},
|
||||
@ -2468,7 +2471,7 @@
|
||||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"time": "2017-02-16T22:46:52+00:00"
|
||||
"time": "2017-02-20T13:45:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tijsverkoyen/css-to-inline-styles",
|
||||
@ -2951,6 +2954,102 @@
|
||||
],
|
||||
"time": "2016-04-29T12:21:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzle/guzzle",
|
||||
"version": "v3.9.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle3.git",
|
||||
"reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9",
|
||||
"reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"php": ">=5.3.3",
|
||||
"symfony/event-dispatcher": "~2.1"
|
||||
},
|
||||
"replace": {
|
||||
"guzzle/batch": "self.version",
|
||||
"guzzle/cache": "self.version",
|
||||
"guzzle/common": "self.version",
|
||||
"guzzle/http": "self.version",
|
||||
"guzzle/inflection": "self.version",
|
||||
"guzzle/iterator": "self.version",
|
||||
"guzzle/log": "self.version",
|
||||
"guzzle/parser": "self.version",
|
||||
"guzzle/plugin": "self.version",
|
||||
"guzzle/plugin-async": "self.version",
|
||||
"guzzle/plugin-backoff": "self.version",
|
||||
"guzzle/plugin-cache": "self.version",
|
||||
"guzzle/plugin-cookie": "self.version",
|
||||
"guzzle/plugin-curlauth": "self.version",
|
||||
"guzzle/plugin-error-response": "self.version",
|
||||
"guzzle/plugin-history": "self.version",
|
||||
"guzzle/plugin-log": "self.version",
|
||||
"guzzle/plugin-md5": "self.version",
|
||||
"guzzle/plugin-mock": "self.version",
|
||||
"guzzle/plugin-oauth": "self.version",
|
||||
"guzzle/service": "self.version",
|
||||
"guzzle/stream": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/cache": "~1.3",
|
||||
"monolog/monolog": "~1.0",
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
"psr/log": "~1.0",
|
||||
"symfony/class-loader": "~2.1",
|
||||
"zendframework/zend-cache": "2.*,<2.3",
|
||||
"zendframework/zend-log": "2.*,<2.3"
|
||||
},
|
||||
"suggest": {
|
||||
"guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Guzzle": "src/",
|
||||
"Guzzle\\Tests": "tests/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Guzzle Community",
|
||||
"homepage": "https://github.com/guzzle/guzzle/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"client",
|
||||
"curl",
|
||||
"framework",
|
||||
"http",
|
||||
"http client",
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"abandoned": "guzzlehttp/guzzle",
|
||||
"time": "2015-03-18T18:23:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "hamcrest/hamcrest-php",
|
||||
"version": "v1.2.2",
|
||||
@ -3624,16 +3723,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "5.7.15",
|
||||
"version": "5.7.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "b99112aecc01f62acf3d81a3f59646700a1849e5"
|
||||
"reference": "dafc78e2a7d12139b0e97078d1082326bd09363d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b99112aecc01f62acf3d81a3f59646700a1849e5",
|
||||
"reference": "b99112aecc01f62acf3d81a3f59646700a1849e5",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/dafc78e2a7d12139b0e97078d1082326bd09363d",
|
||||
"reference": "dafc78e2a7d12139b0e97078d1082326bd09363d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3702,7 +3801,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2017-03-02T15:22:43+00:00"
|
||||
"time": "2017-03-15T13:02:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
@ -3763,6 +3862,64 @@
|
||||
],
|
||||
"time": "2016-12-08T20:27:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "satooshi/php-coveralls",
|
||||
"version": "v1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/satooshi/php-coveralls.git",
|
||||
"reference": "da51d304fe8622bf9a6da39a8446e7afd432115c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/da51d304fe8622bf9a6da39a8446e7afd432115c",
|
||||
"reference": "da51d304fe8622bf9a6da39a8446e7afd432115c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"ext-simplexml": "*",
|
||||
"guzzle/guzzle": "^2.8|^3.0",
|
||||
"php": ">=5.3.3",
|
||||
"psr/log": "^1.0",
|
||||
"symfony/config": "^2.1|^3.0",
|
||||
"symfony/console": "^2.1|^3.0",
|
||||
"symfony/stopwatch": "^2.0|^3.0",
|
||||
"symfony/yaml": "^2.0|^3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/http-kernel": "Allows Symfony integration"
|
||||
},
|
||||
"bin": [
|
||||
"bin/coveralls"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Satooshi\\": "src/Satooshi/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kitamura Satoshi",
|
||||
"email": "with.no.parachute@gmail.com",
|
||||
"homepage": "https://www.facebook.com/satooshi.jp"
|
||||
}
|
||||
],
|
||||
"description": "PHP client library for Coveralls API",
|
||||
"homepage": "https://github.com/satooshi/php-coveralls",
|
||||
"keywords": [
|
||||
"ci",
|
||||
"coverage",
|
||||
"github",
|
||||
"test"
|
||||
],
|
||||
"time": "2016-01-20T17:35:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit-reverse-lookup",
|
||||
"version": "1.0.1",
|
||||
@ -4278,16 +4435,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/class-loader",
|
||||
"version": "v3.2.4",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/class-loader.git",
|
||||
"reference": "2847d56f518ad5721bf85aa9174b3aa3fd12aa03"
|
||||
"reference": "c29a5bc6ca14cfff1f5e3d7781ed74b6e898d2b9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/class-loader/zipball/2847d56f518ad5721bf85aa9174b3aa3fd12aa03",
|
||||
"reference": "2847d56f518ad5721bf85aa9174b3aa3fd12aa03",
|
||||
"url": "https://api.github.com/repos/symfony/class-loader/zipball/c29a5bc6ca14cfff1f5e3d7781ed74b6e898d2b9",
|
||||
"reference": "c29a5bc6ca14cfff1f5e3d7781ed74b6e898d2b9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4330,7 +4487,63 @@
|
||||
],
|
||||
"description": "Symfony ClassLoader Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-21T17:06:35+00:00"
|
||||
"time": "2017-02-18T17:28:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/config.git",
|
||||
"reference": "741d6d4cd1414d67d48eb71aba6072b46ba740c2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/config/zipball/741d6d4cd1414d67d48eb71aba6072b46ba740c2",
|
||||
"reference": "741d6d4cd1414d67d48eb71aba6072b46ba740c2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"symfony/filesystem": "~2.8|~3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/yaml": "~3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/yaml": "To use the yaml reference dumper"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Config\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Config Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-03-01T18:18:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
@ -4389,17 +4602,115 @@
|
||||
"time": "2017-01-21T17:13:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.2.4",
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8"
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "bc0f17bed914df2cceb989972c3b996043c4da4a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8",
|
||||
"reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/bc0f17bed914df2cceb989972c3b996043c4da4a",
|
||||
"reference": "bc0f17bed914df2cceb989972c3b996043c4da4a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Filesystem\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-03-06T19:30:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/stopwatch",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/stopwatch.git",
|
||||
"reference": "c5ee0f8650c84b4d36a5f76b3b504233feaabf75"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/c5ee0f8650c84b4d36a5f76b3b504233feaabf75",
|
||||
"reference": "c5ee0f8650c84b4d36a5f76b3b504233feaabf75",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Stopwatch\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Stopwatch Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-18T17:28:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/093e416ad096355149e265ea2e4cc1f9ee40ab1a",
|
||||
"reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4441,7 +4752,7 @@
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-02-16T22:46:52+00:00"
|
||||
"time": "2017-03-07T16:47:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
@ -34,6 +34,27 @@ $factory->define(
|
||||
);
|
||||
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\ImportJob::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->numberBetween(1, 10),
|
||||
'user_id' => 1,
|
||||
'key' => $faker->words(1, true),
|
||||
'file_type' => 'csv',
|
||||
'status' => 'import_status_never_started',
|
||||
'configuration' => null,
|
||||
'extended_status' => [
|
||||
'total_steps' => 0,
|
||||
'steps_done' => 0,
|
||||
'import_count' => 0,
|
||||
'importTag' => 0,
|
||||
'errors' => [],
|
||||
],
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\TransactionJournal::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
|
@ -1,77 +0,0 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'csv_column_roles_title'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>{{ 'csv_column_roles_text'|_ }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('csv.initial_parse') }}" method="post">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'csv_column_roles_table'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:20%;">{{ 'csv_column_name'|_ }}</th>
|
||||
<th style="width:40%;">{{ 'csv_column_example'|_ }}</th>
|
||||
<th style="width:30%;">{{ 'csv_column_role'|_ }}</th>
|
||||
<th style="width:10%;">{{ 'csv_do_map_value'|_ }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for index,header in headers %}
|
||||
<tr>
|
||||
<td>{{ header }}</td>
|
||||
<td><code>{{ example[index] }}</code></td>
|
||||
<td>
|
||||
{{ Form.select(('role['~index~']'), availableRoles,roles[index],{class: 'form-control'}) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Form.checkbox(('map['~index~']'),1,map[index]) }}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
<a href="{{ route('csv.index') }}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> {{ 'csv_go_back'|_ }}</a>
|
||||
<button type="submit" class="btn btn-success pull-right">
|
||||
{{ 'csv_continue'|_ }} <i class="fa fa-arrow-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,44 +0,0 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'csv_download_config_title'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>
|
||||
{{ 'csv_download_config_text'|_ }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="{{ route('csv.download-config') }}" class="btn btn-info"><i class="fa fa-download"></i> {{ 'csv_do_download_config'|_ }}</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{ 'csv_more_information_text'|_ }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
<a href="{{ route('csv.column-roles') }}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> {{ 'csv_go_back'|_ }}</a>
|
||||
<a href="{{ route('csv.process') }}" class="btn btn-success pull-right">{{ 'csv_continue'|_ }} <i class="fa fa-arrow-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -1,96 +0,0 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'csv_index_title'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ 'csv_index_text'|_ }}
|
||||
<p class="text-info">{{ 'csv_index_beta_warning'|_ }}</p>
|
||||
{% if unsupported|length > 0 %}
|
||||
<p class="text-danger">{{ 'csv_index_unsupported_warning'|_ }}</p>
|
||||
<ul>
|
||||
{% for message in unsupported %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="form-horizontal" action="{{ route('csv.upload') }}" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'csv_upload_form'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
|
||||
{{ ExpandedForm.checkbox('has_headers',1,null,{helpText: 'csv_header_help'|_}) }}
|
||||
{{ ExpandedForm.text('date_format','Ymd',{helpText: trans('firefly.csv_date_help', {dateExample: phpdate('Ymd')}) }) }}
|
||||
|
||||
{{ ExpandedForm.file('csv',{helpText: 'csv_csv_file_help'|_}) }}
|
||||
|
||||
{{ ExpandedForm.select('csv_delimiter', delimiters, 0, {helpText: 'csv_delimiter_help'|_} ) }}
|
||||
|
||||
{{ ExpandedForm.file('csv_config',{helpText: 'csv_csv_config_file_help'|_}) }}
|
||||
|
||||
{{ ExpandedForm.select('csv_import_account', accounts, 0, {helpText: 'csv_import_account_help'|_} ) }}
|
||||
|
||||
{{ ExpandedForm.multiCheckbox('specifix', specifix) }}
|
||||
|
||||
|
||||
|
||||
{% if not uploadPossible %}
|
||||
<div class="form-group" id="csv_holder">
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<pre>{{ path }}</pre>
|
||||
<p class="text-danger">
|
||||
{{ 'csv_upload_not_writeable'|_ }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
<button type="submit" class="pull-right btn btn-success">
|
||||
{{ 'csv_upload_button'|_ }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
@ -1,82 +0,0 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'csv_map_title'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>
|
||||
{{ 'csv_map_text'|_ }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('csv.save_mapping') }}" method="post">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
|
||||
|
||||
{% for index,columnName in map %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ Config.get('csv.roles.'~columnName~'.name') }}</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:50%;">{{ 'csv_field_value'|_ }}</th>
|
||||
<th>{{ 'csv_field_mapped_to'|_ }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for value in values[index] %}
|
||||
<tr>
|
||||
<td><code>{{ value }}</code></td>
|
||||
<td>
|
||||
{{ Form.select('mapping['~index~']['~value~']',options[index], mapped[index][value], {class: 'form-control'}) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
<a href="{{ route('csv.column-roles') }}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> {{ 'csv_go_back'|_ }}</a>
|
||||
<button type="submit" class="btn btn-success pull-right">
|
||||
{{ 'csv_continue'|_ }} <i class="fa fa-arrow-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
@ -1,58 +0,0 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'csv_process_title'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>
|
||||
|
||||
{{ trans('firefly.csv_process_text',{rows: rows}) }}
|
||||
</p>
|
||||
|
||||
{% if errors|length > 0 %}
|
||||
<p class="text-danger">{{ Lang.choice('firefly.csv_import_with_errors',errors|length,{errors: errors|length}) }}</p>
|
||||
<ul>
|
||||
{% for index,err in errors %}
|
||||
<li>{{ 'csv_row'|_ }} #{{ index }}: {{ err }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p>
|
||||
{{ trans('firefly.csv_error_see_logs') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
|
||||
{{ trans('firefly.csv_process_new_entries',{imported: imported}) }}
|
||||
</p>
|
||||
|
||||
{% if journals|length > 0 %}
|
||||
<ul>
|
||||
{% for journal in journals %}
|
||||
<li>#{{ journal.id }}: <a href="{{ route('transactions.show', [journal.id]) }}">{{ journal.description }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<a href="{{ route('csv.index') }}" class="btn btn-warning">{{ 'csv_start_over'|_ }}</a>
|
||||
<a href="{{ route('index') }}" class="btn btn-success">{{ 'csv_to_index'|_ }}</a>
|
||||
<a href="{{ route('csv.download-config') }}" class="btn btn-info"><i class="fa fa-download"></i> {{ 'csv_do_download_config'|_ }}</a>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -659,10 +659,6 @@ Route::group(
|
||||
Route::group(
|
||||
['middleware' => 'user-full-auth', 'prefix' => 'transactions', 'as' => 'transactions.'], function () {
|
||||
Route::get('{what}/{moment?}', ['uses' => 'TransactionController@index', 'as' => 'index'])->where(['what' => 'withdrawal|deposit|transfers|transfer']);
|
||||
// Route::get('{what}/all', ['uses' => 'TransactionController@indexAll', 'as' => 'index.all'])->where(['what' => 'withdrawal|deposit|transfers|transfer']);
|
||||
// Route::get('{what}/{date}', ['uses' => 'TransactionController@indexByDate', 'as' => 'index.date'])->where(
|
||||
// ['what' => 'withdrawal|deposit|transfers|transfer']
|
||||
// );
|
||||
Route::get('show/{tj}', ['uses' => 'TransactionController@show', 'as' => 'show']);
|
||||
Route::post('reorder', ['uses' => 'TransactionController@reorder', 'as' => 'reorder']);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Tests\TestCase;
|
||||
|
||||
@ -26,14 +27,80 @@ use Tests\TestCase;
|
||||
class CurrencyControllerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::delete
|
||||
*/
|
||||
public function testCannotDelete()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('canDeleteCurrency')->andReturn(false);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.delete', [2]));
|
||||
$response->assertStatus(302);
|
||||
// has bread crumb
|
||||
$response->assertSessionHas('error');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::destroy
|
||||
*/
|
||||
public function testCannotDestroy()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$repository->shouldReceive('canDeleteCurrency')->andReturn(false);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
|
||||
$this->session(['currencies.delete.uri' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('currencies.destroy', [1]));
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('error');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::create
|
||||
*/
|
||||
public function testCannotCreate()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(false);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.create'));
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('error');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.create'));
|
||||
@ -48,7 +115,10 @@ class CurrencyControllerTest extends TestCase
|
||||
public function testDefaultCurrency()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -64,9 +134,12 @@ class CurrencyControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('canDeleteCurrency')->andReturn(true);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.delete', [2]));
|
||||
@ -81,12 +154,14 @@ class CurrencyControllerTest extends TestCase
|
||||
public function testDestroy()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$repository->shouldReceive('canDeleteCurrency')->andReturn(true);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$repository->shouldReceive('canDeleteCurrency')->andReturn(true);
|
||||
$repository->shouldReceive('destroy')->andReturn(true)->once();
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
|
||||
$this->session(['currencies.delete.uri' => 'http://localhost']);
|
||||
@ -102,8 +177,12 @@ class CurrencyControllerTest extends TestCase
|
||||
public function testEdit()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.edit', [2]));
|
||||
@ -121,9 +200,12 @@ class CurrencyControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getCurrencyByPreference')->andReturn(new TransactionCurrency);
|
||||
$repository->shouldReceive('get')->andReturn(new Collection);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.index'));
|
||||
@ -132,6 +214,57 @@ class CurrencyControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::index
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::__construct
|
||||
*/
|
||||
public function testIndexNoRights()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getCurrencyByPreference')->andReturn(new TransactionCurrency);
|
||||
$repository->shouldReceive('get')->andReturn(new Collection);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(false);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.index'));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
$response->assertSessionHas('info');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::store
|
||||
*/
|
||||
public function testStoreNoRights()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('store')->andReturn(new TransactionCurrency);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->session(['currencies.create.uri' => 'http://localhost']);
|
||||
$data = [
|
||||
'name' => 'XX',
|
||||
'code' => 'XXX',
|
||||
'symbol' => 'x',
|
||||
'decimal_places' => 2,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('currencies.store'), $data);
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::store
|
||||
*/
|
||||
@ -139,9 +272,12 @@ class CurrencyControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('store')->andReturn(new TransactionCurrency);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->session(['currencies.create.uri' => 'http://localhost']);
|
||||
$data = [
|
||||
@ -163,9 +299,12 @@ class CurrencyControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('update')->andReturn(new TransactionCurrency);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->session(['currencies.edit.uri' => 'http://localhost']);
|
||||
$data = [
|
||||
|
@ -48,6 +48,24 @@ class ExportControllerTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ExportController::download
|
||||
* @expectedExceptionMessage Against all expectations
|
||||
*/
|
||||
public function testDownloadFailed()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(ExportJobRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$repository->shouldReceive('exists')->once()->andReturn(false);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('export.download', ['testExport']));
|
||||
$response->assertStatus(500);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ExportController::getStatus
|
||||
*/
|
||||
@ -103,11 +121,13 @@ class ExportControllerTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'export_start_range' => '2015-01-01',
|
||||
'export_end_range' => '2015-01-21',
|
||||
'exportFormat' => 'csv',
|
||||
'accounts' => [1],
|
||||
'job' => 'testExport',
|
||||
'export_start_range' => '2015-01-01',
|
||||
'export_end_range' => '2015-01-21',
|
||||
'exportFormat' => 'csv',
|
||||
'accounts' => [1],
|
||||
'include_attachments' => '1',
|
||||
'include_old_uploads' => '1',
|
||||
'job' => 'testExport',
|
||||
];
|
||||
|
||||
$accountRepos->shouldReceive('getAccountsById')->withArgs([$data['accounts']])->andReturn(new Collection);
|
||||
@ -117,6 +137,8 @@ class ExportControllerTest extends TestCase
|
||||
$processor->shouldReceive('convertJournals')->once();
|
||||
$processor->shouldReceive('exportJournals')->once();
|
||||
$processor->shouldReceive('createZipFile')->once();
|
||||
$processor->shouldReceive('collectOldUploads')->once();
|
||||
$processor->shouldReceive('collectAttachments')->once();
|
||||
|
||||
$repository->shouldReceive('changeStatus')->andReturn(true);
|
||||
$repository->shouldReceive('findByKey')->andReturn(new ExportJob);
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
use FireflyIII\Helpers\Help\HelpInterface;
|
||||
use FireflyIII\Models\Preference;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
@ -24,18 +25,112 @@ class HelpControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HelpController::show
|
||||
* @covers \FireflyIII\Http\Controllers\HelpController::__construct
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
$help = $this->mock(HelpInterface::class);
|
||||
$help->shouldReceive('hasRoute')->andReturn(true)->once();
|
||||
$help->shouldReceive('inCache')->andReturn(false)->once();
|
||||
$help->shouldReceive('getFromGithub')->andReturn('Help content here.')->once();
|
||||
$help->shouldReceive('getFromGithub')->andReturn('Recent new content here.')->once();
|
||||
$help->shouldReceive('putInCache')->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('help.show', ['index']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('Recent new content here.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HelpController::show
|
||||
*/
|
||||
public function testShowBackupFromCache()
|
||||
{
|
||||
// force pref in dutch for test
|
||||
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
|
||||
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'nl_NL',]);
|
||||
|
||||
$help = $this->mock(HelpInterface::class);
|
||||
$help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once();
|
||||
$help->shouldReceive('inCache')->withArgs(['index', 'nl_NL'])->andReturn(false)->once();
|
||||
$help->shouldReceive('getFromGithub')->withArgs(['index', 'nl_NL'])->andReturn('')->once();
|
||||
|
||||
// is US in cache?
|
||||
$help->shouldReceive('inCache')->withArgs(['index', 'en_US'])->andReturn(true)->twice();
|
||||
$help->shouldReceive('getFromCache')->withArgs(['index', 'en_US'])->andReturn('US from cache.')->once();
|
||||
|
||||
// put US in cache:
|
||||
$help->shouldReceive('putInCache')->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('help.show', ['index']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('US from cache.'); // Dutch translation
|
||||
|
||||
// put English back:
|
||||
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
|
||||
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'en_US',]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HelpController::show
|
||||
*/
|
||||
public function testShowBackupFromGithub()
|
||||
{
|
||||
// force pref in dutch for test
|
||||
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
|
||||
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'nl_NL',]);
|
||||
|
||||
$help = $this->mock(HelpInterface::class);
|
||||
$help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once();
|
||||
$help->shouldReceive('inCache')->withArgs(['index', 'nl_NL'])->andReturn(false)->once();
|
||||
$help->shouldReceive('getFromGithub')->withArgs(['index', 'nl_NL'])->andReturn('')->once();
|
||||
|
||||
// is US in cache?
|
||||
$help->shouldReceive('inCache')->withArgs(['index', 'en_US'])->andReturn(false)->twice();
|
||||
$help->shouldReceive('getFromGithub')->withArgs(['index', 'en_US'])->andReturn('')->once();
|
||||
|
||||
// put US in cache:
|
||||
$help->shouldReceive('putInCache')->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('help.show', ['index']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('Er is geen hulptekst voor deze pagina.'); // Dutch
|
||||
|
||||
// put English back:
|
||||
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
|
||||
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'en_US',]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HelpController::show
|
||||
*/
|
||||
public function testShowCached()
|
||||
{
|
||||
$help = $this->mock(HelpInterface::class);
|
||||
$help->shouldReceive('hasRoute')->andReturn(true)->once();
|
||||
$help->shouldReceive('inCache')->andReturn(true)->once();
|
||||
$help->shouldReceive('getFromCache')->andReturn('Cached help content here.')->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('help.show', ['index']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('Cached help content here.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HelpController::show
|
||||
*/
|
||||
public function testShowNoRoute()
|
||||
{
|
||||
$help = $this->mock(HelpInterface::class);
|
||||
$help->shouldReceive('hasRoute')->andReturn(false)->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('help.show', ['index']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('There is no help for this route.');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,6 +51,30 @@ class HomeControllerTest extends TestCase
|
||||
$response->assertSessionHas('warning', '91 days of data may take a while to load.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::dateRange
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::__construct
|
||||
*/
|
||||
public function testDateRangeCustom()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
|
||||
$args = [
|
||||
'start' => '2012-01-01',
|
||||
'end' => '2012-04-01',
|
||||
'label' => 'Custom range',
|
||||
];
|
||||
|
||||
$response = $this->post(route('daterange'), $args);
|
||||
$response->assertStatus(200);
|
||||
$response->assertSessionHas('warning', '91 days of data may take a while to load.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::displayError
|
||||
*/
|
||||
|
@ -13,8 +13,13 @@ namespace Tests\Feature\Controllers;
|
||||
|
||||
use FireflyIII\Import\ImportProcedureInterface;
|
||||
use FireflyIII\Import\Setup\CsvSetup;
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Tests\TestCase;
|
||||
|
||||
@ -25,6 +30,8 @@ use Tests\TestCase;
|
||||
*/
|
||||
class ImportControllerTest extends TestCase
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::complete
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
@ -33,6 +40,7 @@ class ImportControllerTest extends TestCase
|
||||
public function testComplete()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -41,14 +49,33 @@ class ImportControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::complete
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testCompleteWrongJob()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.complete', ['configure']));
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::configure
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::makeImporter
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testConfigure()
|
||||
{
|
||||
$setup = $this->mock(CsvSetup::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$setup->shouldReceive('setJob')->once();
|
||||
@ -61,12 +88,31 @@ class ImportControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::configure
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::makeImporter
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testConfigureWrongJob()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.configure', ['settings']));
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::download
|
||||
*/
|
||||
public function testDownload()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -83,10 +129,13 @@ class ImportControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::finished
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testFinished()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -95,6 +144,23 @@ class ImportControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::finished
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testFinishedWrongJob()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.finished', ['configure']));
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::index
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::__construct
|
||||
@ -102,6 +168,7 @@ class ImportControllerTest extends TestCase
|
||||
public function testIndex()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -115,6 +182,7 @@ class ImportControllerTest extends TestCase
|
||||
public function testJson()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -122,17 +190,53 @@ class ImportControllerTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::json
|
||||
*/
|
||||
public function testJsonFinished()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$tag = factory(Tag::class)->make();
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$tagRepos->shouldReceive('find')->once()->andReturn($tag);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.json', ['finished']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::json
|
||||
*/
|
||||
public function testJsonRunning()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.json', ['running']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::postConfigure
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testPostConfigure()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$importer = $this->mock(CsvSetup::class);
|
||||
$importer->shouldReceive('setJob')->once();
|
||||
$importer->shouldReceive('saveImportConfiguration')->once();
|
||||
$repository->shouldReceive('updateStatus')->once();
|
||||
|
||||
$data = [];
|
||||
$this->be($this->user());
|
||||
@ -141,17 +245,39 @@ class ImportControllerTest extends TestCase
|
||||
$response->assertRedirect(route('import.settings', ['p-configure']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::postConfigure
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testPostConfigureWrongJob()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$data = [];
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('import.process-configuration', ['finished']), $data);
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('import.finished', ['finished']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::postSettings
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testPostSettings()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$importer = $this->mock(CsvSetup::class);
|
||||
$importer->shouldReceive('setJob')->once();
|
||||
$importer->shouldReceive('storeSettings')->once();
|
||||
|
||||
$data = [];
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('import.post-settings', ['p-settings']), $data);
|
||||
@ -159,29 +285,110 @@ class ImportControllerTest extends TestCase
|
||||
$response->assertRedirect(route('import.settings', ['p-settings']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::postSettings
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testPostSettingsWrongJob()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$data = [];
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('import.post-settings', ['configure']), $data);
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('import.configure', ['configure']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::settings
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testSettings()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$importer = $this->mock(CsvSetup::class);
|
||||
$importer->shouldReceive('setJob')->once();
|
||||
$importer->shouldReceive('requireUserSettings')->once()->andReturn(false);
|
||||
$repository->shouldReceive('updateStatus')->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.settings', ['settings']));
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('import.complete', ['settings']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::settings
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testSettingsUserSettings()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$importer = $this->mock(CsvSetup::class);
|
||||
$importer->shouldReceive('setJob')->once();
|
||||
$importer->shouldReceive('requireUserSettings')->once()->andReturn(true);
|
||||
|
||||
$importer->shouldReceive('getDataForSettings')->once()->andReturn([]);
|
||||
$importer->shouldReceive('getViewForSettings')->once()->andReturn('error');
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.settings', ['settings']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::settings
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testSettingsWrongJob()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.settings', ['configure']));
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('import.configure', ['configure']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::settings
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testSettingsWrongJobAgain()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.settings', ['complete']));
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('import.complete', ['complete']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::start
|
||||
*/
|
||||
public function testStart()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
/** @var ImportProcedureInterface $procedure */
|
||||
@ -196,11 +403,13 @@ class ImportControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::status
|
||||
* Implement testStatus().
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testStatus()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
// complete
|
||||
@ -209,18 +418,90 @@ class ImportControllerTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::status
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::jobInCorrectStep
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::redirectToCorrectStep
|
||||
*/
|
||||
public function testStatusWrongJob()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
// complete
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.status', ['configure']));
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('import.configure', ['configure']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::upload
|
||||
*/
|
||||
public function testUpload()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$job = factory(ImportJob::class)->make();
|
||||
|
||||
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->andReturn(false);
|
||||
$repository->shouldReceive('create')->andReturn($job);
|
||||
|
||||
$path = resource_path('stubs/csv.csv');
|
||||
$file = new UploadedFile($path, 'upload.csv', filesize($path), 'text/csv', null, true);
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('import.upload'), ['import_file_type' => 'csv', 'import_file' => $file]);
|
||||
|
||||
$path = resource_path('stubs/csv.csv');
|
||||
$file = new UploadedFile($path, 'upload.csv', filesize($path), 'text/csv', null, true);
|
||||
$response = $this->post(route('import.upload'), [], [], ['import_file' => $file], ['Accept' => 'application/json']);
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::upload
|
||||
*/
|
||||
public function testUploadDemo()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$job = factory(ImportJob::class)->make();
|
||||
|
||||
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->andReturn(true);
|
||||
$repository->shouldReceive('create')->andReturn($job);
|
||||
$repository->shouldReceive('setConfiguration')->andReturn($job);
|
||||
|
||||
$path = resource_path('stubs/csv.csv');
|
||||
$file = new UploadedFile($path, 'upload.csv', filesize($path), 'text/csv', null, true);
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('import.upload'), ['import_file_type' => 'csv', 'import_file' => $file]);
|
||||
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::upload
|
||||
*/
|
||||
public function testUploadWithConfig()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$job = factory(ImportJob::class)->make();
|
||||
|
||||
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->andReturn(false);
|
||||
$repository->shouldReceive('create')->andReturn($job);
|
||||
|
||||
$path = resource_path('stubs/csv.csv');
|
||||
$file = new UploadedFile($path, 'upload.csv', filesize($path), 'text/csv', null, true);
|
||||
$configPath = resource_path('stubs/demo-configuration.json');
|
||||
$configFile = new UploadedFile($path, 'configuration.json', filesize($configPath), 'application/json', null, true);
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('import.upload'), ['import_file_type' => 'csv', 'import_file' => $file, 'configuration_file' => $configFile]);
|
||||
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user