mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expand code coverage.
This commit is contained in:
parent
57b4a5be08
commit
d9f515900c
@ -275,7 +275,12 @@ class JournalFormRequest extends Request
|
|||||||
$selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0);
|
$selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0);
|
||||||
$accountCurrency = (int)($data['destination_account_currency'] ?? 0);
|
$accountCurrency = (int)($data['destination_account_currency'] ?? 0);
|
||||||
$nativeAmount = (string)($data['native_amount'] ?? '');
|
$nativeAmount = (string)($data['native_amount'] ?? '');
|
||||||
|
|
||||||
|
Log::debug('Now in validateDeposit.');
|
||||||
|
Log::debug(sprintf('SelectedCurrency is "%s", accountCurrency is "%s", native amount is "%s".', $selectedCurrency, $accountCurrency, $nativeAmount));
|
||||||
|
|
||||||
if ($selectedCurrency !== $accountCurrency && '' === $nativeAmount && 0 !== $selectedCurrency && 0 !== $accountCurrency) {
|
if ($selectedCurrency !== $accountCurrency && '' === $nativeAmount && 0 !== $selectedCurrency && 0 !== $accountCurrency) {
|
||||||
|
Log::debug('Adding an error about missing native amount.');
|
||||||
$validator->errors()->add('native_amount', (string)trans('validation.numeric_native'));
|
$validator->errors()->add('native_amount', (string)trans('validation.numeric_native'));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -208,8 +208,10 @@ class ReportFormRequest extends Request
|
|||||||
$repository = app(TagRepositoryInterface::class);
|
$repository = app(TagRepositoryInterface::class);
|
||||||
$set = $this->get('tag');
|
$set = $this->get('tag');
|
||||||
$collection = new Collection;
|
$collection = new Collection;
|
||||||
|
Log::debug('Set is:', $set ?? []);
|
||||||
if (\is_array($set)) {
|
if (\is_array($set)) {
|
||||||
foreach ($set as $tagTag) {
|
foreach ($set as $tagTag) {
|
||||||
|
Log::debug(sprintf('Now searching for "%s"', $tagTag));
|
||||||
$tag = $repository->findByTag($tagTag);
|
$tag = $repository->findByTag($tagTag);
|
||||||
if (null !== $tag) {
|
if (null !== $tag) {
|
||||||
$collection->push($tag);
|
$collection->push($tag);
|
||||||
|
@ -27,6 +27,7 @@ use Illuminate\Foundation\Http\FormRequest;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Request.
|
* Class Request.
|
||||||
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.NumberOfChildren)
|
* @SuppressWarnings(PHPMD.NumberOfChildren)
|
||||||
*/
|
*/
|
||||||
|
@ -91,11 +91,13 @@ class Amount implements ConverterInterface
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
Log::debug(sprintf('Final value is: "%s"', $value));
|
Log::debug(sprintf('Final value is: "%s"', $value));
|
||||||
$formatted = sprintf('%01.12f', $value);
|
$formatted = sprintf('%01.12f', $value);
|
||||||
Log::debug(sprintf('Is formatted to : "%s"', $formatted));
|
Log::debug(sprintf('Is formatted to : "%s"', $formatted));
|
||||||
|
|
||||||
return $formatted;
|
return $formatted;
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,6 +132,171 @@ class CreateControllerTest extends TestCase
|
|||||||
$response->assertSessionHas('success');
|
$response->assertSessionHas('success');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Recurring\CreateController
|
||||||
|
* @covers \FireflyIII\Http\Requests\RecurrenceFormRequest
|
||||||
|
*/
|
||||||
|
public function testStoreYearly(): void
|
||||||
|
{
|
||||||
|
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||||
|
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||||
|
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||||
|
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||||
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||||
|
|
||||||
|
$tomorrow = Carbon::create()->addDays(2);
|
||||||
|
$recurrence = $this->user()->recurrences()->first();
|
||||||
|
$data = [
|
||||||
|
'title' => 'hello' . random_int(1, 100000),
|
||||||
|
'first_date' => $tomorrow->format('Y-m-d'),
|
||||||
|
'repetition_type' => 'yearly,2018-01-01',
|
||||||
|
'skip' => 0,
|
||||||
|
'recurring_description' => 'Some descr' . random_int(1, 100000),
|
||||||
|
'active' => '1',
|
||||||
|
'apply_rules' => '1',
|
||||||
|
'foreign_amount' => '1',
|
||||||
|
'foreign_currency_id' => '2',
|
||||||
|
|
||||||
|
// mandatory for transaction:
|
||||||
|
'transaction_description' => 'Some descr',
|
||||||
|
'transaction_type' => 'withdrawal',
|
||||||
|
'transaction_currency_id' => '1',
|
||||||
|
'amount' => '30',
|
||||||
|
|
||||||
|
// mandatory account info:
|
||||||
|
'source_id' => '1',
|
||||||
|
'destination_name' => 'Some Expense',
|
||||||
|
|
||||||
|
// optional fields:
|
||||||
|
'budget_id' => '1',
|
||||||
|
'category' => 'CategoryA',
|
||||||
|
'tags' => 'A,B,C',
|
||||||
|
'create_another' => '1',
|
||||||
|
'repetition_end' => 'times',
|
||||||
|
'repetitions' => 3,
|
||||||
|
];
|
||||||
|
|
||||||
|
$recurringRepos->shouldReceive('store')->andReturn($recurrence)->once();
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$response = $this->post(route('recurring.store'), $data);
|
||||||
|
$response->assertStatus(302);
|
||||||
|
$response->assertSessionHas('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Recurring\CreateController
|
||||||
|
* @covers \FireflyIII\Http\Requests\RecurrenceFormRequest
|
||||||
|
*/
|
||||||
|
public function testStoreMonthly(): void
|
||||||
|
{
|
||||||
|
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||||
|
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||||
|
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||||
|
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||||
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||||
|
|
||||||
|
$tomorrow = Carbon::create()->addDays(2);
|
||||||
|
$recurrence = $this->user()->recurrences()->first();
|
||||||
|
$data = [
|
||||||
|
'title' => 'hello' . random_int(1, 100000),
|
||||||
|
'first_date' => $tomorrow->format('Y-m-d'),
|
||||||
|
'repetition_type' => 'monthly,5',
|
||||||
|
'skip' => 0,
|
||||||
|
'recurring_description' => 'Some descr' . random_int(1, 100000),
|
||||||
|
'active' => '1',
|
||||||
|
'apply_rules' => '1',
|
||||||
|
'foreign_amount' => '1',
|
||||||
|
'foreign_currency_id' => '2',
|
||||||
|
|
||||||
|
// mandatory for transaction:
|
||||||
|
'transaction_description' => 'Some descr',
|
||||||
|
'transaction_type' => 'withdrawal',
|
||||||
|
'transaction_currency_id' => '1',
|
||||||
|
'amount' => '30',
|
||||||
|
|
||||||
|
// mandatory account info:
|
||||||
|
'source_id' => '1',
|
||||||
|
'destination_name' => 'Some Expense',
|
||||||
|
|
||||||
|
// optional fields:
|
||||||
|
'budget_id' => '1',
|
||||||
|
'category' => 'CategoryA',
|
||||||
|
'tags' => 'A,B,C',
|
||||||
|
'create_another' => '1',
|
||||||
|
'repetition_end' => 'times',
|
||||||
|
'repetitions' => 3,
|
||||||
|
];
|
||||||
|
|
||||||
|
$recurringRepos->shouldReceive('store')->andReturn($recurrence)->once();
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$response = $this->post(route('recurring.store'), $data);
|
||||||
|
$response->assertStatus(302);
|
||||||
|
$response->assertSessionHas('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Recurring\CreateController
|
||||||
|
* @covers \FireflyIII\Http\Requests\RecurrenceFormRequest
|
||||||
|
*/
|
||||||
|
public function testStoreNdom(): void
|
||||||
|
{
|
||||||
|
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||||
|
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||||
|
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||||
|
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||||
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||||
|
|
||||||
|
$tomorrow = Carbon::create()->addDays(2);
|
||||||
|
$recurrence = $this->user()->recurrences()->first();
|
||||||
|
$data = [
|
||||||
|
'title' => 'hello' . random_int(1, 100000),
|
||||||
|
'first_date' => $tomorrow->format('Y-m-d'),
|
||||||
|
'repetition_type' => 'ndom,3,5',
|
||||||
|
'skip' => 0,
|
||||||
|
'recurring_description' => 'Some descr' . random_int(1, 100000),
|
||||||
|
'active' => '1',
|
||||||
|
'apply_rules' => '1',
|
||||||
|
'foreign_amount' => '1',
|
||||||
|
'foreign_currency_id' => '2',
|
||||||
|
|
||||||
|
// mandatory for transaction:
|
||||||
|
'transaction_description' => 'Some descr',
|
||||||
|
'transaction_type' => 'withdrawal',
|
||||||
|
'transaction_currency_id' => '1',
|
||||||
|
'amount' => '30',
|
||||||
|
|
||||||
|
// mandatory account info:
|
||||||
|
'source_id' => '1',
|
||||||
|
'destination_name' => 'Some Expense',
|
||||||
|
|
||||||
|
// optional fields:
|
||||||
|
'budget_id' => '1',
|
||||||
|
'category' => 'CategoryA',
|
||||||
|
'tags' => 'A,B,C',
|
||||||
|
'create_another' => '1',
|
||||||
|
'repetition_end' => 'times',
|
||||||
|
'repetitions' => 3,
|
||||||
|
];
|
||||||
|
|
||||||
|
$recurringRepos->shouldReceive('store')->andReturn($recurrence)->once();
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$response = $this->post(route('recurring.store'), $data);
|
||||||
|
$response->assertStatus(302);
|
||||||
|
$response->assertSessionHas('success');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Recurring\CreateController
|
* @covers \FireflyIII\Http\Controllers\Recurring\CreateController
|
||||||
* @covers \FireflyIII\Http\Requests\RecurrenceFormRequest
|
* @covers \FireflyIII\Http\Requests\RecurrenceFormRequest
|
||||||
|
@ -600,6 +600,7 @@ class ReportControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testPostIndexTagOK(): void
|
public function testPostIndexTagOK(): void
|
||||||
{
|
{
|
||||||
|
Log::debug(sprintf('Now in test %s', __METHOD__));
|
||||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
@ -609,13 +610,17 @@ class ReportControllerTest extends TestCase
|
|||||||
|
|
||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
$tag = $this->user()->tags()->find(1);
|
$tag = $this->user()->tags()->find(1);
|
||||||
|
$tag2 = $this->user()->tags()->find(3);
|
||||||
|
|
||||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||||
$tagRepos->shouldReceive('findByTag')->andReturn($tag)->twice();
|
|
||||||
|
$tagRepos->shouldReceive('findByTag')->andReturn($tag, null)->times(4);
|
||||||
|
$tagRepos->shouldReceive('findNull')->andReturn($tag2)->times(3);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'accounts' => ['1'],
|
'accounts' => ['1'],
|
||||||
'tag' => ['housing'],
|
'tag' => ['housing', '3'],
|
||||||
'daterange' => '2016-01-01 - 2016-01-31',
|
'daterange' => '2016-01-01 - 2016-01-31',
|
||||||
'report_type' => 'tag',
|
'report_type' => 'tag',
|
||||||
];
|
];
|
||||||
@ -623,7 +628,44 @@ class ReportControllerTest extends TestCase
|
|||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
$response = $this->post(route('reports.index.post'), $data);
|
$response = $this->post(route('reports.index.post'), $data);
|
||||||
$response->assertStatus(302);
|
$response->assertStatus(302);
|
||||||
$response->assertRedirect(route('reports.report.tag', ['1', $tag->id, '20160101', '20160131']));
|
$response->assertRedirect(route('reports.report.tag', ['1', $tag->id . ',' . $tag2->id, '20160101', '20160131']));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\ReportController
|
||||||
|
* @covers \FireflyIII\Http\Requests\ReportFormRequest
|
||||||
|
*/
|
||||||
|
public function testPostIndexTagOKNoID(): void
|
||||||
|
{
|
||||||
|
Log::debug(sprintf('Now in test %s', __METHOD__));
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||||
|
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||||
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
/** @var Tag $tag */
|
||||||
|
$tag = $this->user()->tags()->find(1);
|
||||||
|
$tag2 = $this->user()->tags()->find(3);
|
||||||
|
|
||||||
|
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||||
|
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||||
|
|
||||||
|
$tagRepos->shouldReceive('findByTag')->andReturn(null)->times(4);
|
||||||
|
$tagRepos->shouldReceive('findNull')->andReturn($tag2)->times(4);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'accounts' => ['1'],
|
||||||
|
'tag' => ['housing', '3'],
|
||||||
|
'daterange' => '2016-01-01 - 2016-01-31',
|
||||||
|
'report_type' => 'tag',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$response = $this->post(route('reports.index.post'), $data);
|
||||||
|
$response->assertStatus(302);
|
||||||
|
$response->assertRedirect(route('reports.report.tag', ['1', $tag2->id . ',' . $tag2->id, '20160101', '20160131']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,17 +154,21 @@ class CreateControllerTest extends TestCase
|
|||||||
'title' => 'A',
|
'title' => 'A',
|
||||||
'trigger' => 'store-journal',
|
'trigger' => 'store-journal',
|
||||||
'description' => 'D',
|
'description' => 'D',
|
||||||
'rule-trigger' => [
|
'rule_triggers' => [
|
||||||
1 => 'from_account_starts',
|
[
|
||||||
|
'name' => 'description_is',
|
||||||
|
'value' => 'A',
|
||||||
|
'stop_processing' => '0',
|
||||||
|
|
||||||
],
|
],
|
||||||
'rule-trigger-value' => [
|
|
||||||
1 => 'B',
|
|
||||||
],
|
],
|
||||||
'rule-action' => [
|
'rule_actions' => [
|
||||||
1 => 'set_category',
|
[
|
||||||
|
'name' => 'set_category',
|
||||||
|
'value' => 'C',
|
||||||
|
'stop_processing' => '0',
|
||||||
|
|
||||||
],
|
],
|
||||||
'rule-action-value' => [
|
|
||||||
1 => 'C',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
|
@ -603,6 +603,47 @@ class SingleControllerTest extends TestCase
|
|||||||
$response->assertSee('<ol class="breadcrumb">');
|
$response->assertSee('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController
|
||||||
|
* @covers \FireflyIII\Http\Requests\JournalFormRequest
|
||||||
|
*/
|
||||||
|
public function testStoreDepositInvalidNative(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||||
|
$attRepos = $this->mock(AttachmentHelperInterface::class);
|
||||||
|
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||||
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
|
||||||
|
|
||||||
|
// mock results:
|
||||||
|
$journal = new TransactionJournal();
|
||||||
|
$journal->id = 1000;
|
||||||
|
$journal->description = 'New deposit';
|
||||||
|
|
||||||
|
// mock attachment helper, trigger an error AND and info thing.
|
||||||
|
$this->session(['transactions.create.uri' => 'http://localhost']);
|
||||||
|
$this->be($this->user());
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'what' => 'deposit',
|
||||||
|
'amount' => '10',
|
||||||
|
'amount_currency_id_amount' => 1,
|
||||||
|
'destination_id' => 1,
|
||||||
|
'destination_account_currency' => 2,
|
||||||
|
'native_amount' => '',
|
||||||
|
'source_name' => 'Some source',
|
||||||
|
'date' => '2016-01-01',
|
||||||
|
'description' => 'Test descr',
|
||||||
|
];
|
||||||
|
$response = $this->post(route('transactions.store', ['deposit']), $data);
|
||||||
|
$response->assertStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController
|
||||||
* @covers \FireflyIII\Http\Requests\JournalFormRequest
|
* @covers \FireflyIII\Http\Requests\JournalFormRequest
|
||||||
@ -875,6 +916,78 @@ class SingleControllerTest extends TestCase
|
|||||||
$response->assertSessionHas('info');
|
$response->assertSessionHas('info');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController
|
||||||
|
* @covers \FireflyIII\Http\Requests\JournalFormRequest
|
||||||
|
*/
|
||||||
|
public function testStoreTransferInvalidSource(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||||
|
$attRepos = $this->mock(AttachmentHelperInterface::class);
|
||||||
|
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||||
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
|
||||||
|
|
||||||
|
$this->session(['transactions.create.uri' => 'http://localhost']);
|
||||||
|
$this->be($this->user());
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'what' => 'transfer',
|
||||||
|
'amount' => '10',
|
||||||
|
'amount_currency_id_amount' => 1,
|
||||||
|
'source_account_currency' => 1,
|
||||||
|
'destination_account_currency' => 2,
|
||||||
|
'source_amount' => '',
|
||||||
|
'destination_id' => 1,
|
||||||
|
'source_id' => 2,
|
||||||
|
'date' => '2016-01-01',
|
||||||
|
'description' => 'Test descr',
|
||||||
|
];
|
||||||
|
$response = $this->post(route('transactions.store', ['transfer']), $data);
|
||||||
|
$response->assertStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController
|
||||||
|
* @covers \FireflyIII\Http\Requests\JournalFormRequest
|
||||||
|
*/
|
||||||
|
public function testStoreWithdrawalInvalidNative(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||||
|
$attRepos = $this->mock(AttachmentHelperInterface::class);
|
||||||
|
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||||
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
|
||||||
|
|
||||||
|
|
||||||
|
$this->session(['transactions.create.uri' => 'http://localhost']);
|
||||||
|
$this->be($this->user());
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'what' => 'withdrawal',
|
||||||
|
'amount' => '10',
|
||||||
|
'source_id' => 1,
|
||||||
|
'amount_currency_id_amount' => 2,
|
||||||
|
'source_account_currency' => 3,
|
||||||
|
'native_amount' => '',
|
||||||
|
'destination_name' => 'Some destination',
|
||||||
|
'date' => '2016-01-01',
|
||||||
|
'description' => 'Test descr',
|
||||||
|
];
|
||||||
|
$response = $this->post(route('transactions.store', ['withdrawal']), $data);
|
||||||
|
$response->assertStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController
|
||||||
* @covers \FireflyIII\Http\Requests\JournalFormRequest
|
* @covers \FireflyIII\Http\Requests\JournalFormRequest
|
||||||
|
Loading…
Reference in New Issue
Block a user