mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-08-29 01:13:08 +00:00
Fix transaction controller tests
This commit is contained in:
@@ -144,7 +144,7 @@ class SingleController extends Controller
|
|||||||
{
|
{
|
||||||
$what = strtolower($what);
|
$what = strtolower($what);
|
||||||
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
|
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
|
||||||
$assetAccounts = $this->groupedAccountList();
|
$assetAccounts = $this->groupedActiveAccountList();
|
||||||
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());
|
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());
|
||||||
$piggyBanks = $this->piggyBanks->getPiggyBanksWithAmount();
|
$piggyBanks = $this->piggyBanks->getPiggyBanksWithAmount();
|
||||||
$piggies = ExpandedForm::makeSelectListWithEmpty($piggyBanks);
|
$piggies = ExpandedForm::makeSelectListWithEmpty($piggyBanks);
|
||||||
@@ -413,7 +413,7 @@ class SingleController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function groupedAccountList(): array
|
private function groupedActiveAccountList(): array
|
||||||
{
|
{
|
||||||
$accounts = $this->accounts->getActiveAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $this->accounts->getActiveAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$return = [];
|
$return = [];
|
||||||
@@ -430,6 +430,26 @@ class SingleController extends Controller
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function groupedAccountList(): array
|
||||||
|
{
|
||||||
|
$accounts = $this->accounts->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
|
$return = [];
|
||||||
|
/** @var Account $account */
|
||||||
|
foreach ($accounts as $account) {
|
||||||
|
$type = $account->getMeta('accountRole');
|
||||||
|
if (strlen($type) === 0) {
|
||||||
|
$type = 'no_account_type';
|
||||||
|
}
|
||||||
|
$key = strval(trans('firefly.opt_group_' . $type));
|
||||||
|
$return[$key][$account->id] = $account->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
|
@@ -107,6 +107,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
|
||||||
*/
|
*/
|
||||||
public function testEdit()
|
public function testEdit()
|
||||||
{
|
{
|
||||||
@@ -126,6 +127,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
|
||||||
*/
|
*/
|
||||||
public function testEditCashDeposit()
|
public function testEditCashDeposit()
|
||||||
{
|
{
|
||||||
@@ -151,6 +153,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
|
||||||
*/
|
*/
|
||||||
public function testEditCashWithdrawal()
|
public function testEditCashWithdrawal()
|
||||||
{
|
{
|
||||||
@@ -176,6 +179,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
|
||||||
*/
|
*/
|
||||||
public function testEditRedirect()
|
public function testEditRedirect()
|
||||||
{
|
{
|
||||||
@@ -193,6 +197,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
|
||||||
*/
|
*/
|
||||||
public function testEditTransferWithForeignAmount()
|
public function testEditTransferWithForeignAmount()
|
||||||
{
|
{
|
||||||
@@ -221,6 +226,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
|
||||||
*/
|
*/
|
||||||
public function testEditWithForeignAmount()
|
public function testEditWithForeignAmount()
|
||||||
{
|
{
|
||||||
@@ -249,6 +255,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedActiveAccountList
|
||||||
*/
|
*/
|
||||||
public function testStoreError()
|
public function testStoreError()
|
||||||
{
|
{
|
||||||
@@ -277,6 +284,7 @@ class SingleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedActiveAccountList
|
||||||
*/
|
*/
|
||||||
public function testStoreSuccess()
|
public function testStoreSuccess()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user