mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
This should fix tests
This commit is contained in:
parent
d618ddc8c5
commit
2db8d25038
@ -287,7 +287,7 @@ class JsonController extends Controller
|
||||
{
|
||||
$pref = Preferences::get('tour', true);
|
||||
if (!$pref) {
|
||||
throw new FireflyException('Cannot find preference for tour. Exit.');
|
||||
throw new FireflyException('Cannot find preference for tour. Exit.'); // @codeCoverageIgnore
|
||||
}
|
||||
$headers = ['main-content', 'sidebar-toggle', 'account-menu', 'budget-menu', 'report-menu', 'transaction-menu', 'option-menu', 'main-content-end'];
|
||||
$steps = [];
|
||||
|
@ -113,7 +113,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
*/
|
||||
public function findByCode(string $currencyCode): TransactionCurrency
|
||||
{
|
||||
$currency = TransactionCurrency::whereCode($currencyCode)->first();
|
||||
$currency = TransactionCurrency::where('code', $currencyCode)->first();
|
||||
if (is_null($currency)) {
|
||||
$currency = new TransactionCurrency;
|
||||
}
|
||||
@ -170,7 +170,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
*/
|
||||
public function getCurrencyByPreference(Preference $preference): TransactionCurrency
|
||||
{
|
||||
$preferred = TransactionCurrency::whereCode($preference->data)->first();
|
||||
$preferred = TransactionCurrency::where('code', $preference->data)->first();
|
||||
if (is_null($preferred)) {
|
||||
$preferred = TransactionCurrency::first();
|
||||
}
|
||||
|
@ -430,8 +430,8 @@ Route::group(
|
||||
Route::get('tour', ['uses' => 'JsonController@tour', 'as' => 'tour']);
|
||||
Route::get('box/in', ['uses' => 'JsonController@boxIn', 'as' => 'box.in']);
|
||||
Route::get('box/out', ['uses' => 'JsonController@boxOut', 'as' => 'box.out']);
|
||||
Route::get('box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'box.paid']);
|
||||
Route::get('box/bills-paid', ['uses' => 'JsonController@boxBillsPaid', 'as' => 'box.unpaid']);
|
||||
Route::get('box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'box.unpaid']);
|
||||
Route::get('box/bills-paid', ['uses' => 'JsonController@boxBillsPaid', 'as' => 'box.paid']);
|
||||
Route::get('transaction-journals/all', ['uses' => 'JsonController@allTransactionJournals', 'as' => 'all-transaction-journals']);
|
||||
Route::get('transaction-journals/{what}', ['uses' => 'JsonController@transactionJournals', 'as' => 'transaction-journals']);
|
||||
Route::get('transaction-types', ['uses' => 'JsonController@transactionTypes', 'as' => 'transaction-types']);
|
||||
|
@ -54,6 +54,8 @@ class JavascriptControllerTest extends TestCase
|
||||
*/
|
||||
public function testVariables(string $range)
|
||||
{
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('javascript.variables'));
|
||||
|
@ -14,12 +14,14 @@ namespace Tests\Feature\Controllers;
|
||||
use Amount;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
@ -33,9 +35,9 @@ use Tests\TestCase;
|
||||
*/
|
||||
class JsonControllerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::action
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::__construct
|
||||
*/
|
||||
public function testAction()
|
||||
{
|
||||
@ -48,6 +50,36 @@ class JsonControllerTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::allAccounts
|
||||
*/
|
||||
public function testAllAccounts()
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('getAccountsByType')
|
||||
->withArgs([[AccountType::REVENUE, AccountType::EXPENSE, AccountType::BENEFICIARY, AccountType::DEFAULT, AccountType::ASSET]])
|
||||
->andReturn(new Collection);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('json.all-accounts'));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::allTransactionJournals()
|
||||
*/
|
||||
public function testAllTransactionJournals()
|
||||
{
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$collector->shouldReceive('setLimit')->withArgs([100])->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->withArgs([1])->andReturnSelf();
|
||||
$collector->shouldReceive('getJournals')->andReturn(new Collection);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('json.all-transaction-journals'));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::boxBillsPaid
|
||||
*/
|
||||
@ -57,12 +89,12 @@ class JsonControllerTest extends TestCase
|
||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$billRepos->shouldReceive('getBillsUnpaidInRange')->andReturn('100');
|
||||
$billRepos->shouldReceive('getBillsPaidInRange')->andReturn('-100');
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('json.box.paid'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'bills-unpaid']);
|
||||
$response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'bills-paid']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,13 +106,13 @@ class JsonControllerTest extends TestCase
|
||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$billRepos->shouldReceive('getBillsPaidInRange')->andReturn('-100');
|
||||
$billRepos->shouldReceive('getBillsUnpaidInRange')->andReturn('100');
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('json.box.unpaid'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'bills-paid']);
|
||||
$response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'bills-unpaid']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,6 +159,23 @@ class JsonControllerTest extends TestCase
|
||||
$response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'out']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::budgets
|
||||
*/
|
||||
public function testBudgets()
|
||||
{
|
||||
// mock stuff
|
||||
$budget = factory(Budget::class)->make();
|
||||
$categoryRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$categoryRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget]));
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('json.budgets'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson([$budget->name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::categories
|
||||
*/
|
||||
@ -231,6 +280,22 @@ class JsonControllerTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::transactionTypes
|
||||
*/
|
||||
public function testTransactionTypes()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$journalRepos->shouldReceive('getTransactionTypes')->once()->andReturn(new Collection);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('json.transaction-types', ['deposit']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::transactionJournals
|
||||
*/
|
||||
|
@ -38,6 +38,7 @@ class PreferencesControllerTest extends TestCase
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$google->shouldReceive('generateSecretKey')->andReturn('secret');
|
||||
$google->shouldReceive('getQRCodeInline')->andReturn('long-data-url');
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('preferences.code'));
|
||||
$response->assertStatus(200);
|
||||
|
@ -19,9 +19,15 @@ use FireflyIII\Generator\Report\Standard\YearReportGenerator as SYRG;
|
||||
use FireflyIII\Generator\Report\Tag\YearReportGenerator as TYRG;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Tests\TestCase;
|
||||
|
||||
@ -130,6 +136,7 @@ class ReportControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::options
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::noReportOptions
|
||||
*/
|
||||
public function testOptions()
|
||||
{
|
||||
@ -149,35 +156,48 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||
$budget = factory(Budget::class)->make();
|
||||
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget]));
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('reports.options', ['budget']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($budget->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::options
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::categoryReportOptions
|
||||
*/
|
||||
public function testOptionsCategory()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$category = factory(Category::class)->make();
|
||||
$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]));
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('reports.options', ['default']));
|
||||
$response = $this->get(route('reports.options', ['category']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::options
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::tagReportOptions
|
||||
*/
|
||||
public function testOptionsTag()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$tag = factory(Tag::class)->make();
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$tagRepos->shouldReceive('get')->andReturn(new Collection([$tag]));
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('reports.options', ['default']));
|
||||
$response = $this->get(route('reports.options', ['tag']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
@ -195,7 +215,7 @@ class ReportControllerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::categoryReport
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::tagReport
|
||||
*/
|
||||
public function testTagReport()
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ class RuleControllerTest extends TestCase
|
||||
public function testCreate()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -51,7 +51,7 @@ class RuleControllerTest extends TestCase
|
||||
public function testDelete()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -66,8 +66,8 @@ class RuleControllerTest extends TestCase
|
||||
public function testDestroy()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('destroy');
|
||||
|
||||
@ -85,8 +85,8 @@ class RuleControllerTest extends TestCase
|
||||
public function testDown()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('moveDown');
|
||||
|
||||
@ -102,8 +102,8 @@ class RuleControllerTest extends TestCase
|
||||
public function testEdit()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getPrimaryTrigger')->andReturn(new Rule);
|
||||
|
||||
@ -128,11 +128,9 @@ class RuleControllerTest extends TestCase
|
||||
$ruleGroupRepos->shouldReceive('store');
|
||||
$repository->shouldReceive('getFirstRuleGroup')->andReturn(new RuleGroup);
|
||||
$ruleGroupRepos->shouldReceive('getRuleGroupsWithRules')->andReturn(new Collection);
|
||||
|
||||
$repository->shouldReceive('count')->andReturn(0);
|
||||
$repository->shouldReceive('store');
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('rules.index'));
|
||||
$response->assertStatus(200);
|
||||
@ -145,14 +143,11 @@ class RuleControllerTest extends TestCase
|
||||
public function testReorderRuleActions()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$data = [
|
||||
'triggers' => [1, 2, 3],
|
||||
];
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$data = ['triggers' => [1, 2, 3],];
|
||||
$repository->shouldReceive('reorderRuleActions');
|
||||
|
||||
$this->be($this->user());
|
||||
@ -166,14 +161,11 @@ class RuleControllerTest extends TestCase
|
||||
public function testReorderRuleTriggers()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$data = [
|
||||
'triggers' => [1, 2, 3],
|
||||
];
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$data = ['triggers' => [1, 2, 3],];
|
||||
$repository->shouldReceive('reorderRuleTriggers');
|
||||
|
||||
$this->be($this->user());
|
||||
@ -187,10 +179,13 @@ class RuleControllerTest extends TestCase
|
||||
public function testStore()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$ruleGroupRepos->shouldReceive('find')->andReturn(new RuleGroup)->once();
|
||||
$repository->shouldReceive('store')->andReturn(new Rule);
|
||||
|
||||
$this->session(['rules.create.url' => 'http://localhost']);
|
||||
$data = [
|
||||
@ -212,10 +207,6 @@ class RuleControllerTest extends TestCase
|
||||
1 => 'C',
|
||||
],
|
||||
];
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$repository->shouldReceive('store')->andReturn(new Rule);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('rules.store', [1]), $data);
|
||||
$response->assertStatus(302);
|
||||
@ -261,10 +252,13 @@ class RuleControllerTest extends TestCase
|
||||
public function testUpdate()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$ruleGroupRepos->shouldReceive('find')->andReturn(new RuleGroup)->once();
|
||||
$repository->shouldReceive('update');
|
||||
|
||||
$data = [
|
||||
'rule_group_id' => 1,
|
||||
@ -286,10 +280,6 @@ class RuleControllerTest extends TestCase
|
||||
],
|
||||
];
|
||||
$this->session(['rules.edit.url' => 'http://localhost']);
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$repository->shouldReceive('update');
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('rules.update', [1]), $data);
|
||||
$response->assertStatus(302);
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Jobs\ExecuteRuleGroupOnExistingTransactions;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@ -30,11 +31,14 @@ class RuleGroupControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::create
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::__construct
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -51,6 +55,7 @@ class RuleGroupControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('get')->andReturn(new Collection);
|
||||
|
||||
@ -67,8 +72,9 @@ class RuleGroupControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy');
|
||||
|
||||
$this->session(['rule-groups.delete.url' => 'http://localhost']);
|
||||
@ -87,6 +93,7 @@ class RuleGroupControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('moveDown');
|
||||
|
||||
@ -103,8 +110,11 @@ class RuleGroupControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('rule-groups.edit', [1]));
|
||||
$response->assertStatus(200);
|
||||
@ -117,11 +127,14 @@ class RuleGroupControllerTest extends TestCase
|
||||
public function testExecute()
|
||||
{
|
||||
// mock stuff
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection);
|
||||
|
||||
$this->expectsJobs(ExecuteRuleGroupOnExistingTransactions::class);
|
||||
|
||||
$this->session(['first' => new Carbon('2010-01-01')]);
|
||||
$data = [
|
||||
'accounts' => [1],
|
||||
@ -142,8 +155,9 @@ class RuleGroupControllerTest extends TestCase
|
||||
public function testSelectTransactions()
|
||||
{
|
||||
// mock stuff
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
|
||||
|
||||
@ -161,16 +175,18 @@ class RuleGroupControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->session(['rule-groups.create.url' => 'http://localhost']);
|
||||
$repository->shouldReceive('store')->andReturn(new RuleGroup);
|
||||
$repository->shouldReceive('find')->andReturn(new RuleGroup);
|
||||
$data = [
|
||||
'title' => 'A',
|
||||
'description' => '',
|
||||
];
|
||||
|
||||
$repository->shouldReceive('store')->andReturn(new RuleGroup);
|
||||
$repository->shouldReceive('find')->andReturn(new RuleGroup);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('rule-groups.store', [1]), $data);
|
||||
@ -186,6 +202,7 @@ class RuleGroupControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('moveUp');
|
||||
|
||||
@ -203,6 +220,7 @@ class RuleGroupControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$data = [
|
||||
|
Loading…
Reference in New Issue
Block a user