mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Improve test coverage.
This commit is contained in:
@@ -25,6 +25,7 @@ namespace Tests\Feature\Controllers\Json;
|
||||
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Tests\TestCase;
|
||||
@@ -115,6 +116,7 @@ class AutoCompleteControllerTest extends TestCase
|
||||
*/
|
||||
public function testAllJournals(): void
|
||||
{
|
||||
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
|
||||
$journalRepos = $this->mockDefaultSession();
|
||||
$journal = $this->getRandomWithdrawalAsArray();
|
||||
|
||||
@@ -134,6 +136,7 @@ class AutoCompleteControllerTest extends TestCase
|
||||
*/
|
||||
public function testAllJournalsWithId(): void
|
||||
{
|
||||
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
|
||||
$journalRepos = $this->mockDefaultSession();
|
||||
$journal = $this->getRandomWithdrawalAsArray();
|
||||
|
||||
@@ -155,12 +158,13 @@ class AutoCompleteControllerTest extends TestCase
|
||||
*/
|
||||
public function testAllJournalsWithIdNumeric(): void
|
||||
{
|
||||
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
|
||||
$journalRepos = $this->mockDefaultSession();
|
||||
$journal = $this->getRandomWithdrawalAsArray();
|
||||
$journalObject = $this->getRandomWithdrawal();
|
||||
$journalObject = $this->getRandomWithdrawalGroup();
|
||||
|
||||
$journalRepos->shouldReceive('searchJournalDescriptions')->atLeast()->once()->andReturn(new Collection([$journal]));
|
||||
$journalRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($journalObject);
|
||||
$groupRepos->shouldReceive('find')->atLeast()->once()->andReturn($journalObject);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
|
@@ -26,6 +26,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Tests\TestCase;
|
||||
use Amount;
|
||||
|
||||
/**
|
||||
* Class FrontpageControllerTest
|
||||
@@ -57,6 +58,8 @@ class FrontpageControllerTest extends TestCase
|
||||
$repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$piggy]));
|
||||
$repository->shouldReceive('getCurrentAmount')->andReturn('10');
|
||||
|
||||
Amount::shouldReceive('formatAnything')->atLeast()->once()->andReturn('x');
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('json.fp.piggy-banks'));
|
||||
$response->assertStatus(200);
|
||||
|
@@ -35,6 +35,7 @@ use Log;
|
||||
use Mockery;
|
||||
use Preferences;
|
||||
use Tests\TestCase;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -117,9 +118,11 @@ class ReconcileControllerTest extends TestCase
|
||||
$euro = $this->getEuro();
|
||||
$withdrawal = $this->getRandomWithdrawalAsArray();
|
||||
|
||||
Steam::shouldReceive('balance')->atLeast()->once()->andReturn('20');
|
||||
|
||||
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro);
|
||||
Preferences::shouldReceive('lastActivity')->atLeast()->once()->andReturn('md512345');
|
||||
//Preferences::shouldReceive('lastActivity')->atLeast()->once()->andReturn('md512345');
|
||||
Amount::shouldReceive('formatAnything')->andReturn('-100');
|
||||
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
|
||||
|
Reference in New Issue
Block a user