mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Update some tests.
This commit is contained in:
@@ -87,6 +87,8 @@ class EditControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('1')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('monthly')->atLeast()->once();
|
||||
|
||||
$accountRepos->shouldReceive('getLocation')->atLeast()->once()->andReturnNull();
|
||||
|
||||
// get all types:
|
||||
$accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Debt'])->andReturn(AccountType::find(11))->once();
|
||||
$accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Loan'])->andReturn(AccountType::find(9))->once();
|
||||
@@ -131,6 +133,8 @@ class EditControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('monthly');
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->andReturn($euro)->once();
|
||||
|
||||
$accountRepos->shouldReceive('getLocation')->atLeast()->once()->andReturnNull();
|
||||
|
||||
// get all types:
|
||||
$accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Debt'])->andReturn(AccountType::find(11))->once();
|
||||
$accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Loan'])->andReturn(AccountType::find(9))->once();
|
||||
@@ -176,6 +180,8 @@ class EditControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('monthly');
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->andReturn($euro)->once();
|
||||
|
||||
$accountRepos->shouldReceive('getLocation')->atLeast()->once()->andReturnNull();
|
||||
|
||||
// mock default session stuff
|
||||
$this->mockDefaultSession();
|
||||
|
||||
|
@@ -72,8 +72,13 @@ class IndexControllerTest extends TestCase
|
||||
// mock hasRole for user repository:
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
$repository->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]));
|
||||
$repository->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$account]));
|
||||
$repository->shouldReceive('getInactiveAccountsByType')->andReturn(new Collection);
|
||||
|
||||
$repository->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro);
|
||||
$repository->shouldReceive('getLocation')->atLeast()->once()->andReturnNull();
|
||||
//
|
||||
|
||||
Steam::shouldReceive('balancesByAccounts')->andReturn([$account->id => '100']);
|
||||
Steam::shouldReceive('getLastActivities')->andReturn([]);
|
||||
|
||||
|
@@ -87,6 +87,7 @@ class ShowControllerTest extends TestCase
|
||||
|
||||
$repository->shouldReceive('getAccountCurrency')->andReturn($euro)->atLeast()->once();
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(clone $date)->once();
|
||||
$repository->shouldReceive('getLocation')->atLeast()->once()->andReturnNull();
|
||||
|
||||
// list size
|
||||
$pref = new Preference;
|
||||
@@ -143,11 +144,14 @@ class ShowControllerTest extends TestCase
|
||||
$repository->shouldReceive('isLiability')->andReturn(false)->atLeast()->once();
|
||||
$repository->shouldReceive('getAccountCurrency')->andReturn($euro)->atLeast()->once();
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(clone $date)->once();
|
||||
$repository->shouldReceive('getLocation')->atLeast()->once()->andReturnNull();
|
||||
|
||||
// list size
|
||||
$pref = new Preference;
|
||||
$pref->data = 50;
|
||||
Preferences::shouldReceive('get')->withArgs(['listPageSize', 50])->atLeast()->once()->andReturn($pref);
|
||||
Preferences::shouldReceive('lastActivity')->atLeast()->once()->andReturn('md512345');
|
||||
Amount::shouldReceive('formatAnything')->atLeast()->once()->andReturn('x');
|
||||
|
||||
// mock hasRole for user repository:
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->andReturn(true)->atLeast()->once();
|
||||
|
@@ -27,8 +27,8 @@ use FireflyConfig;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Configuration;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequest;
|
||||
use FireflyIII\Services\Github\Object\Release;
|
||||
use FireflyIII\Services\Github\Request\UpdateRequest;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -64,10 +64,13 @@ class UpdateControllerTest extends TestCase
|
||||
$this->mockDefaultSession();
|
||||
|
||||
// mock update calls.
|
||||
$config = new Configuration;
|
||||
$config->data = -1;
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['permission_update_check', -1])->once()->andReturn($config);
|
||||
$config = new Configuration;
|
||||
$config->data = -1;
|
||||
$channelConfig = new Configuration;
|
||||
$channelConfig->data = 'stable';
|
||||
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['permission_update_check', -1])->once()->andReturn($config);
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['update_channel', 'stable'])->once()->andReturn($channelConfig);
|
||||
// call service
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('admin.update-check'));
|
||||
@@ -91,6 +94,8 @@ class UpdateControllerTest extends TestCase
|
||||
// mock update calls
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['permission_update_check', 1])->once()->andReturn(new Configuration);
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['update_channel','stable'])->once()->andReturn(new Configuration);
|
||||
//FireflyConfig::shouldReceive('get')->withArgs(['update_channel', 'stable'])->once()->andReturn($channelConfig);
|
||||
|
||||
// call service
|
||||
$this->be($this->user());
|
||||
@@ -115,23 +120,26 @@ class UpdateControllerTest extends TestCase
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
|
||||
$this->mockDefaultSession();
|
||||
|
||||
// set some data
|
||||
$version = config('firefly.version');
|
||||
$date = new Carbon;
|
||||
$date->subDays(5);
|
||||
$releases = [
|
||||
new Release(['id' => 'x', 'title' => $version . '.1', 'content' => '', 'updated' => $date]),
|
||||
$return = [
|
||||
'version' => '2.0.0',
|
||||
'date' => '2020-01-01'
|
||||
];
|
||||
|
||||
// set some data
|
||||
$updater = $this->mock(UpdateRequest::class);
|
||||
$updater->shouldReceive('call')->andReturnNull();
|
||||
$updater->shouldReceive('getReleases')->andReturn($releases);
|
||||
$updater->shouldReceive('getVersion')->withArgs(['stable'])->atLeast()->once()
|
||||
->andReturn($return);
|
||||
|
||||
|
||||
$channelConfig = new Configuration;
|
||||
$channelConfig->data = 'stable';
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['update_channel', 'stable'])->atleast()->once()->andReturn($channelConfig);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('admin.update-check.manual'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($version);
|
||||
$response->assertSee('which was released on');
|
||||
$response->assertSee($version . '.1');
|
||||
$response->assertSee(config('firefly.version'));
|
||||
$response->assertSee('which is newer than the latest release');
|
||||
}
|
||||
|
||||
|
||||
@@ -149,21 +157,24 @@ class UpdateControllerTest extends TestCase
|
||||
$this->mockDefaultSession();
|
||||
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
|
||||
$channelConfig = new Configuration;
|
||||
$channelConfig->data = 'stable';
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['update_channel', 'stable'])->atleast()->once()->andReturn($channelConfig);
|
||||
|
||||
$date = new Carbon;
|
||||
$date->subDays(5);
|
||||
$version = config('firefly.version');
|
||||
$releases = [
|
||||
new Release(['id' => 'x', 'title' => $version, 'content' => '', 'updated' => $date]),
|
||||
$return = [
|
||||
'version' => config('firefly.version'),
|
||||
'date' => '2020-01-01'
|
||||
];
|
||||
|
||||
// set some data
|
||||
$updater = $this->mock(UpdateRequest::class);
|
||||
$updater->shouldReceive('call')->andReturnNull();
|
||||
$updater->shouldReceive('getReleases')->andReturn($releases);
|
||||
$updater->shouldReceive('getVersion')->withArgs(['stable'])->atLeast()->once()
|
||||
->andReturn($return);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('admin.update-check.manual'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($version);
|
||||
$response->assertSee(config('firefly.version'));
|
||||
$response->assertSee('the latest available release');
|
||||
}
|
||||
|
||||
@@ -180,11 +191,15 @@ class UpdateControllerTest extends TestCase
|
||||
$this->mockDefaultSession();
|
||||
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
|
||||
$channelConfig = new Configuration;
|
||||
$channelConfig->data = 'stable';
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['update_channel', 'stable'])->atleast()->once()->andReturn($channelConfig);
|
||||
|
||||
$releases = [];
|
||||
$updater = $this->mock(UpdateRequest::class);
|
||||
$updater->shouldReceive('call')->andThrow(FireflyException::class, 'Something broke.');
|
||||
$updater->shouldReceive('getReleases')->andReturn($releases);
|
||||
$updater->shouldReceive('getVersion')->withArgs(['stable'])->atLeast()->once()
|
||||
->andThrow(new FireflyException('Something broke.'));
|
||||
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('admin.update-check.manual'));
|
||||
@@ -206,19 +221,24 @@ class UpdateControllerTest extends TestCase
|
||||
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
|
||||
|
||||
$version = config('firefly.version') . '-alpha';
|
||||
$releases = [
|
||||
new Release(['id' => 'x', 'title' => $version, 'content' => '', 'updated' => new Carbon]),
|
||||
$channelConfig = new Configuration;
|
||||
$channelConfig->data = 'stable';
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['update_channel', 'stable'])->atleast()->once()->andReturn($channelConfig);
|
||||
|
||||
$return = [
|
||||
'version' => '100',
|
||||
'date' => '2020-01-01'
|
||||
];
|
||||
|
||||
// set some data
|
||||
$updater = $this->mock(UpdateRequest::class);
|
||||
$updater->shouldReceive('call')->andReturnNull();
|
||||
$updater->shouldReceive('getReleases')->andReturn($releases);
|
||||
$updater->shouldReceive('getVersion')->withArgs(['stable'])->atLeast()->once()
|
||||
->andReturn($return);
|
||||
|
||||
// expect a new release (because of .1)
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('admin.update-check.manual'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($version);
|
||||
$response->assertSee('which is newer than the');
|
||||
$response->assertSee('A new version of Firefly III is available');
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
use Amount;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\Bill;
|
||||
@@ -216,6 +217,7 @@ class BillControllerTest extends TestCase
|
||||
|
||||
|
||||
$repository->shouldReceive('getRulesForBill')->andReturn(new Collection([$rule]));
|
||||
$repository->shouldReceive('unlinkAll')->atLeast()->once();
|
||||
|
||||
//calls for transaction matcher:
|
||||
$matcher = $this->mock(TransactionMatcher::class);
|
||||
@@ -394,7 +396,7 @@ class BillControllerTest extends TestCase
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
|
||||
$this->mock(AttachmentHelperInterface::class);
|
||||
$repository->shouldReceive('store')->andReturn(null);
|
||||
$repository->shouldReceive('store')->andThrow(new FireflyException('Could not store.'));
|
||||
|
||||
$data = [
|
||||
'name' => 'New Bill ' . $this->randomInt(),
|
||||
@@ -425,8 +427,8 @@ class BillControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
|
||||
$repository->shouldReceive('store')->andReturn(new Bill);
|
||||
$bill = $this->getRandomBill();
|
||||
$repository->shouldReceive('store')->andReturn($bill);
|
||||
$attachHelper->shouldReceive('saveAttachmentsForModel');
|
||||
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
|
||||
Preferences::shouldReceive('mark')->atLeast()->once();
|
||||
|
@@ -196,6 +196,7 @@ class ShowControllerTest extends TestCase
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getPaginatedGroups')->andReturn(new LengthAwarePaginator([], 0, 10))->atLeast()->once();
|
||||
$collector->shouldReceive('withAccountInformation')->andReturnSelf()->atLeast()->once();
|
||||
|
||||
$blRepos->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]))->atLeast()->once();
|
||||
$opsRepos->shouldReceive('spentInPeriod')->andReturn('-1')->atLeast()->once();
|
||||
|
@@ -86,6 +86,8 @@ class NoCategoryControllerTest extends TestCase
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withoutCategory')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getExtractedJournals')->andReturn([])->atLeast()->once();
|
||||
$collector->shouldReceive('withAccountInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getPaginatedGroups')->andReturn(new LengthAwarePaginator([], 0, 10))->atLeast()->once();
|
||||
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->atLeast()->once();
|
||||
@@ -128,6 +130,8 @@ class NoCategoryControllerTest extends TestCase
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withoutCategory')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withAccountInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getPaginatedGroups')->andReturn(new LengthAwarePaginator([], 0, 10))->atLeast()->once();
|
||||
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->atLeast()->once();
|
||||
@@ -171,6 +175,8 @@ class NoCategoryControllerTest extends TestCase
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withoutCategory')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withAccountInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getPaginatedGroups')->andReturn(new LengthAwarePaginator([], 0, 10))->atLeast()->once();
|
||||
$collector->shouldReceive('getExtractedJournals')->andReturn([])->atLeast()->once();
|
||||
|
||||
|
@@ -84,8 +84,11 @@ class BudgetControllerTest extends TestCase
|
||||
Preferences::shouldReceive('lastActivity')->atLeast()->once()->andReturn('md512345');
|
||||
|
||||
$repository->shouldReceive('firstUseDate')->andReturn($date)->atLeast()->once();
|
||||
$opsRepos->shouldReceive('spentInPeriod')->andReturn('-100')->atLeast()->once();
|
||||
$generator->shouldReceive('singleSet')->andReturn([])->atLeast()->once();
|
||||
$opsRepos->shouldReceive('sumExpenses')->andReturn([])->atLeast()->once();
|
||||
|
||||
|
||||
// multiSet
|
||||
$generator->shouldReceive('multiSet')->andReturn([])->atLeast()->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
@@ -169,9 +172,10 @@ class BudgetControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection([$destination]))->atLeast()->once();
|
||||
$collector->shouldReceive('setBudget')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setCurrency')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getExtractedJournals')->andReturn([$withdrawal])->atLeast()->once();
|
||||
|
||||
$generator->shouldReceive('pieChart')->atLeast()->once()->andReturn([]);
|
||||
$generator->shouldReceive('multiCurrencyPieChart')->atLeast()->once()->andReturn([]);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
@@ -206,10 +210,11 @@ class BudgetControllerTest extends TestCase
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getExtractedJournals')->andReturn([$withdrawal])->atLeast()->once();
|
||||
$collector->shouldReceive('setCurrency')->andReturnSelf()->atLeast()->once();
|
||||
|
||||
$catRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]))->atLeast()->once();
|
||||
|
||||
$generator->shouldReceive('pieChart')->andReturn([])->atLeast()->once();
|
||||
$generator->shouldReceive('multiCurrencyPieChart')->andReturn([])->atLeast()->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
@@ -245,11 +250,12 @@ class BudgetControllerTest extends TestCase
|
||||
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setBudget')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setCurrency')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getExtractedJournals')->andReturn([$withdrawal])->atLeast()->once();
|
||||
|
||||
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection([$destination]))->atLeast()->once();
|
||||
|
||||
$generator->shouldReceive('pieChart')->once()->andReturn([]);
|
||||
$generator->shouldReceive('multiCurrencyPieChart')->once()->andReturn([]);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
@@ -282,12 +288,13 @@ class BudgetControllerTest extends TestCase
|
||||
|
||||
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]))->atLeast()->once();
|
||||
$blRepos->shouldReceive('getBudgetLimits')->atLeast()->once()->andReturn(new Collection([$budgetLimit]));
|
||||
$opsRepos->shouldReceive('spentInPeriod')->andReturn('-100')->atLeast()->once();
|
||||
//$opsRepos->shouldReceive('spentInPeriod')->andReturn('-100')->atLeast()->once();
|
||||
$opsRepos->shouldReceive('sumExpenses')->atLeast()->once()->andReturn($this->budgetSumExpenses());
|
||||
|
||||
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('withoutBudget')->andReturnSelf()->atLeast()->once();
|
||||
$collector->shouldReceive('getSum')->andReturn('-100')->atLeast()->once();
|
||||
//$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->andReturnSelf()->atLeast()->once();
|
||||
//$collector->shouldReceive('setRange')->andReturnSelf()->atLeast()->once();
|
||||
//$collector->shouldReceive('withoutBudget')->andReturnSelf()->atLeast()->once();
|
||||
//$collector->shouldReceive('getSum')->andReturn('-100')->atLeast()->once();
|
||||
|
||||
$generator->shouldReceive('multiSet')->andReturn([])->atLeast()->once();
|
||||
|
||||
@@ -323,12 +330,13 @@ class BudgetControllerTest extends TestCase
|
||||
|
||||
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]))->once();
|
||||
$blRepos->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection([$limit1, $limit2]));
|
||||
$opsRepos->shouldReceive('spentInPeriod')->andReturn('-100')->atLeast()->once();
|
||||
//$opsRepos->shouldReceive('spentInPeriod')->andReturn('-100')->atLeast()->once();
|
||||
|
||||
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withoutBudget')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getSum')->andReturn('-100')->atLeast()->once();
|
||||
// $collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->andReturnSelf()->once();
|
||||
// $collector->shouldReceive('setRange')->andReturnSelf()->once();
|
||||
// $collector->shouldReceive('withoutBudget')->andReturnSelf()->once();
|
||||
// $collector->shouldReceive('getSum')->andReturn('-100')->atLeast()->once();
|
||||
$opsRepos->shouldReceive('sumExpenses')->atLeast()->once()->andReturn($this->budgetSumExpenses());
|
||||
|
||||
$generator->shouldReceive('multiSet')->once()->andReturn([]);
|
||||
|
||||
@@ -362,13 +370,7 @@ class BudgetControllerTest extends TestCase
|
||||
|
||||
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]))->atLeast()->once();
|
||||
$blRepos->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection);
|
||||
$opsRepos->shouldReceive('spentInPeriod')->andReturn('-100')->atLeast()->once();
|
||||
|
||||
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withoutBudget')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getSum')->andReturn('-100')->atLeast()->once();
|
||||
|
||||
$opsRepos->shouldReceive('sumExpenses')->atLeast()->once()->andReturn($this->budgetSumExpenses());
|
||||
$generator->shouldReceive('multiSet')->once()->andReturn([]);
|
||||
|
||||
$this->be($this->user());
|
||||
|
@@ -22,6 +22,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
@@ -84,6 +85,7 @@ class CurrencyControllerTest extends TestCase
|
||||
$euro = $this->getEuro();
|
||||
|
||||
$repository->shouldReceive('currencyInUse')->andReturn(true);
|
||||
$repository->shouldReceive('currencyInUseAt')->andReturn('something');
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
@@ -450,7 +452,7 @@ class CurrencyControllerTest extends TestCase
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
|
||||
|
||||
$repository->shouldReceive('store')->andReturnNull();
|
||||
$repository->shouldReceive('store')->andThrow(new FireflyException('Could not store'));
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
|
||||
$this->session(['currencies.create.uri' => 'http://localhost']);
|
||||
|
@@ -134,6 +134,8 @@ class HomeControllerTest extends TestCase
|
||||
$collector->shouldReceive('setAccounts')->atLeast()->once()->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->atLeast()->once()->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->atLeast()->once()->andReturnSelf();
|
||||
$collector->shouldReceive('withAccountInformation')->atLeast()->once()->andReturnSelf();
|
||||
|
||||
$collector->shouldReceive('setPage')->atLeast()->once()->andReturnSelf();
|
||||
$collector->shouldReceive('getGroups')->atLeast()->once()->andReturn(new Collection);
|
||||
|
||||
|
@@ -54,7 +54,7 @@ class CallbackControllerTest extends TestCase
|
||||
public function testYnabBasic(): void
|
||||
{
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
$importJob = $this->getRandomImportJob();
|
||||
// config for job:
|
||||
$config = [];
|
||||
$newConfig = ['auth_code' => 'abc'];
|
||||
@@ -62,7 +62,7 @@ class CallbackControllerTest extends TestCase
|
||||
$this->mockDefaultSession();
|
||||
|
||||
// mock calls.
|
||||
$repository->shouldReceive('findByKey')->andReturn(new ImportJob)->once();
|
||||
$repository->shouldReceive('findByKey')->andReturn($importJob)->once();
|
||||
$repository->shouldReceive('getConfiguration')->andReturn($config)->once();
|
||||
$repository->shouldReceive('setConfiguration')->once()->withArgs([Mockery::any(), $newConfig]);
|
||||
|
||||
|
Reference in New Issue
Block a user