mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Improve test coverage.
This commit is contained in:
@@ -24,10 +24,8 @@ namespace Tests\Feature\Controllers\Transaction;
|
||||
|
||||
use Amount;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
@@ -193,8 +191,6 @@ class ConvertControllerTest extends TestCase
|
||||
$validator->shouldReceive('validateDestination')->atLeast()->once()->andReturn(true);
|
||||
|
||||
|
||||
|
||||
|
||||
$data = ['source_account_id' => 1];
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('transactions.convert.index.post', ['transfer', $deposit->id]), $data);
|
||||
|
@@ -26,9 +26,9 @@ use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Preferences;
|
||||
use Tests\TestCase;
|
||||
use Mockery;
|
||||
|
||||
/**
|
||||
* Class CreateControllerTest
|
||||
@@ -56,7 +56,7 @@ class CreateControllerTest extends TestCase
|
||||
$empty = new Preference;
|
||||
$empty->data = [];
|
||||
|
||||
$userRepos->shouldReceive('hasRole')->atLeast()->once()->withArgs([Mockery::any(),'owner'])->andReturn(true);
|
||||
$userRepos->shouldReceive('hasRole')->atLeast()->once()->withArgs([Mockery::any(), 'owner'])->andReturn(true);
|
||||
$accountRepos->shouldReceive('getCashAccount')->atLeast()->once()->andReturn($cash);
|
||||
|
||||
Preferences::shouldReceive('get')->withArgs(['transaction_journal_optional_fields', []])->atLeast()->once()->andReturn($empty);
|
||||
|
@@ -53,9 +53,9 @@ class IndexControllerTest extends TestCase
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->mockDefaultSession();
|
||||
$group = $this->getRandomWithdrawalGroup();
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$collector = $this->mock(GroupCollectorInterface::class);
|
||||
$group = $this->getRandomWithdrawalGroup();
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$collector = $this->mock(GroupCollectorInterface::class);
|
||||
|
||||
// generic set for the info blocks:
|
||||
$groupArray = [$this->getRandomWithdrawalAsArray()];
|
||||
@@ -95,9 +95,9 @@ class IndexControllerTest extends TestCase
|
||||
public function testIndexAll(): void
|
||||
{
|
||||
$this->mockDefaultSession();
|
||||
$group = $this->getRandomWithdrawalGroup();
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$collector = $this->mock(GroupCollectorInterface::class);
|
||||
$group = $this->getRandomWithdrawalGroup();
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$collector = $this->mock(GroupCollectorInterface::class);
|
||||
|
||||
// role?
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->andReturn(true);
|
||||
|
@@ -25,7 +25,6 @@ namespace Tests\Feature\Controllers\Transaction;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionJournalLink;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -60,8 +59,6 @@ class LinkControllerTest extends TestCase
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
|
||||
|
||||
|
||||
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
@@ -80,7 +77,6 @@ class LinkControllerTest extends TestCase
|
||||
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
|
||||
|
||||
|
||||
$linkRepos->shouldReceive('get')->atLeast()->once()->andReturn(new Collection);
|
||||
|
||||
$this->be($this->user());
|
||||
@@ -94,8 +90,8 @@ class LinkControllerTest extends TestCase
|
||||
public function testDestroy(): void
|
||||
{
|
||||
$this->mockDefaultSession();
|
||||
$link = $this->getRandomLink();
|
||||
$repository = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
$link = $this->getRandomLink();
|
||||
$repository = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
|
||||
Preferences::shouldReceive('mark')->once();
|
||||
|
||||
@@ -203,7 +199,7 @@ class LinkControllerTest extends TestCase
|
||||
$repository = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
$journalRepos = $this->mockDefaultSession();
|
||||
|
||||
$data = [
|
||||
$data = [
|
||||
'link_other' => $withdrawal->id,
|
||||
'link_type' => '1_inward',
|
||||
];
|
||||
@@ -224,8 +220,8 @@ class LinkControllerTest extends TestCase
|
||||
public function testSwitchLink(): void
|
||||
{
|
||||
$this->mockDefaultSession();
|
||||
$link = $this->getRandomLink();
|
||||
$repository = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
$link = $this->getRandomLink();
|
||||
$repository = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
$this->mock(UserRepositoryInterface::class);
|
||||
|
||||
|
||||
|
@@ -172,13 +172,13 @@ class MassControllerTest extends TestCase
|
||||
$this->session(['transactions.mass-edit.uri' => 'http://localhost']);
|
||||
|
||||
$data = [
|
||||
'journals' => [$deposit->id],
|
||||
'description' => [$deposit->id => 'Updated salary thing'],
|
||||
'amount' => [$deposit->id => 1600],
|
||||
'date' => [$deposit->id => '2014-07-24'],
|
||||
'source_name' => [$deposit->id => 'Job'],
|
||||
'destination_id' => [$deposit->id => 1],
|
||||
'category' => [$deposit->id => 'Salary'],
|
||||
'journals' => [$deposit->id],
|
||||
'description' => [$deposit->id => 'Updated salary thing'],
|
||||
'amount' => [$deposit->id => 1600],
|
||||
'date' => [$deposit->id => '2014-07-24'],
|
||||
'source_name' => [$deposit->id => 'Job'],
|
||||
'destination_id' => [$deposit->id => 1],
|
||||
'category' => [$deposit->id => 'Salary'],
|
||||
];
|
||||
|
||||
$this->be($this->user());
|
||||
|
Reference in New Issue
Block a user