mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Remove import code.
This commit is contained in:
@@ -128,7 +128,6 @@ class UserControllerTest extends TestCase
|
||||
$repository->shouldReceive('getUserData')->andReturn(
|
||||
[
|
||||
'export_jobs_success' => 0,
|
||||
'import_jobs_success' => 0,
|
||||
'attachments_size' => 0,
|
||||
]
|
||||
);
|
||||
|
@@ -39,7 +39,6 @@ use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Configuration;
|
||||
use FireflyIII\Models\CurrencyExchangeRate;
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Models\PiggyBankEvent;
|
||||
use FireflyIII\Models\Preference;
|
||||
@@ -52,7 +51,6 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionJournalLink;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Transformers\TransactionTransformer;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
use Log;
|
||||
@@ -72,21 +70,6 @@ use RuntimeException;
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function getRandomPiggyBankEvent(): PiggyBankEvent
|
||||
{
|
||||
return PiggyBankEvent::inRandomOrder()->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function getRandomImportJob(): ImportJob
|
||||
{
|
||||
return $this->user()->importJobs()->inRandomOrder()->first();
|
||||
}
|
||||
/**
|
||||
* @return Recurrence
|
||||
*/
|
||||
|
@@ -28,11 +28,6 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
||||
use FireflyIII\Http\Middleware\Binder;
|
||||
use FireflyIII\Import\Prerequisites\BunqPrerequisites;
|
||||
use FireflyIII\Import\Prerequisites\FakePrerequisites;
|
||||
use FireflyIII\Import\Prerequisites\PrerequisitesInterface;
|
||||
use FireflyIII\Import\Prerequisites\SpectrePrerequisites;
|
||||
use FireflyIII\Import\Prerequisites\YnabPrerequisites;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\AvailableBudget;
|
||||
use FireflyIII\Models\Preference;
|
||||
@@ -950,59 +945,6 @@ class BinderTest extends TestCase
|
||||
$this->assertEquals(Response::HTTP_NOT_FOUND, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Middleware\Binder
|
||||
* @covers \FireflyIII\Models\ImportJob
|
||||
*/
|
||||
public function testImportJob(): void
|
||||
{
|
||||
Log::info(sprintf('Now in test %s.', __METHOD__));
|
||||
Route::middleware(Binder::class)->any(
|
||||
'/_test/binder/{importJob}', function () {
|
||||
return 'OK';
|
||||
}
|
||||
);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get('/_test/binder/testImport');
|
||||
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Middleware\Binder
|
||||
* @covers \FireflyIII\Models\ImportJob
|
||||
*/
|
||||
public function testImportJobNotFound(): void
|
||||
{
|
||||
Log::info(sprintf('Now in test %s.', __METHOD__));
|
||||
Route::middleware(Binder::class)->any(
|
||||
'/_test/binder/{importJob}', function () {
|
||||
return 'OK';
|
||||
}
|
||||
);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get('/_test/binder/0');
|
||||
$this->assertEquals(Response::HTTP_NOT_FOUND, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Middleware\Binder
|
||||
* @covers \FireflyIII\Models\ImportJob
|
||||
*/
|
||||
public function testImportJobNotLoggedIn(): void
|
||||
{
|
||||
Log::info(sprintf('Now in test %s.', __METHOD__));
|
||||
Route::middleware(Binder::class)->any(
|
||||
'/_test/binder/{importJob}', function () {
|
||||
return 'OK';
|
||||
}
|
||||
);
|
||||
|
||||
$response = $this->get('/_test/binder/testImport');
|
||||
$this->assertEquals(Response::HTTP_NOT_FOUND, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Middleware\Binder
|
||||
* @covers \FireflyIII\Support\Binder\JournalList
|
||||
|
@@ -25,11 +25,9 @@ namespace Tests\Unit\Rules;
|
||||
|
||||
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalAPIRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Rules\IsValidAttachmentModel;
|
||||
@@ -71,24 +69,6 @@ class IsValidAttachmentModelTest extends TestCase
|
||||
$this->assertTrue($engine->passes($attribute, $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Rules\IsValidAttachmentModel
|
||||
*/
|
||||
public function testImportJob(): void
|
||||
{
|
||||
$job = $this->getRandomImportJob();
|
||||
$jobRepos = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
$jobRepos->shouldReceive('setUser')->atLeast()->once();
|
||||
$jobRepos->shouldReceive('find')->atLeast()->once()->withArgs([$job->id])->andReturn($job);
|
||||
|
||||
$value = $job->id;
|
||||
$attribute = 'not-important';
|
||||
$this->be($this->user());
|
||||
$engine = new IsValidAttachmentModel(ImportJob::class);
|
||||
$this->assertTrue($engine->passes($attribute, $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Rules\IsValidAttachmentModel
|
||||
*/
|
||||
|
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ImportJobTransformerTest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Transformers;
|
||||
|
||||
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Transformers\ImportJobTransformer;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class ImportJobTransformerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class ImportJobTransformerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Log::info(sprintf('Now in %s.', get_class($this)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic coverage
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\ImportJobTransformer
|
||||
*/
|
||||
public function testBasic(): void
|
||||
{
|
||||
|
||||
$job = ImportJob::first();
|
||||
$job->tag_id = 1;
|
||||
$parameters = new ParameterBag;
|
||||
$transformer = app(ImportJobTransformer::class);
|
||||
$transformer->setParameters($parameters);
|
||||
|
||||
$result = $transformer->transform($job);
|
||||
|
||||
$this->assertEquals($job->key, $result['key']);
|
||||
$this->assertEquals($job->tag_id, $result['tag_id']);
|
||||
$this->assertEquals(json_encode($job->configuration), $result['configuration']);
|
||||
$this->assertEquals(json_encode($job->extended_status), $result['extended_status']);
|
||||
$this->assertEquals(json_encode($job->transactions), $result['transactions']);
|
||||
$this->assertEquals(json_encode($job->errors), $result['errors']);
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user