mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 02:57:45 +00:00
Improve test coverage.
This commit is contained in:
@@ -26,7 +26,6 @@ namespace FireflyIII\Transformers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Log;
|
||||
|
||||
@@ -65,11 +64,14 @@ class AccountTransformer extends AbstractTransformer
|
||||
$this->repository->setUser($account->user);
|
||||
|
||||
// get account type:
|
||||
$accountType = $this->repository->getAccountType($account);
|
||||
$fullType = $this->repository->getAccountType($account);
|
||||
$accountType = (string)config(sprintf('firefly.shortNamesByFullName.%s', $fullType));
|
||||
$liabilityType = (string)config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));
|
||||
$liabilityType = '' === $liabilityType ? null : $liabilityType;
|
||||
|
||||
// get account role (will only work if the type is asset. TODO test me.
|
||||
// get account role (will only work if the type is asset.
|
||||
$accountRole = $this->repository->getMetaValue($account, 'accountRole');
|
||||
if ($accountType !== AccountType::ASSET || '' === (string)$accountRole) {
|
||||
if ('asset' !== $accountType || '' === (string)$accountRole) {
|
||||
$accountRole = null;
|
||||
}
|
||||
|
||||
@@ -93,52 +95,63 @@ class AccountTransformer extends AbstractTransformer
|
||||
|
||||
$monthlyPaymentDate = null;
|
||||
$creditCardType = null;
|
||||
if ('ccAsset' === $accountRole && $accountType === AccountType::ASSET) {
|
||||
if ('ccAsset' === $accountRole && 'asset' === $accountType) {
|
||||
$creditCardType = $this->repository->getMetaValue($account, 'ccType');
|
||||
$monthlyPaymentDate = $this->repository->getMetaValue($account, 'ccMonthlyPaymentDate');
|
||||
}
|
||||
|
||||
$openingBalance = null;
|
||||
$openingBalanceDate = null;
|
||||
if (\in_array($accountType, [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], true)) {
|
||||
if (\in_array($accountType, ['asset', 'liabilities'], true)) {
|
||||
$amount = $this->repository->getOpeningBalanceAmount($account);
|
||||
$openingBalance = null === $amount ? null : round($amount, $decimalPlaces);
|
||||
$openingBalanceDate = $this->repository->getOpeningBalanceDate($account);
|
||||
}
|
||||
$interest = $this->repository->getMetaValue($account, 'interest');
|
||||
$interestPeriod = $this->repository->getMetaValue($account, 'interest_period');
|
||||
$liabilityAmount = null;
|
||||
$liabilityStart = null;
|
||||
if (null !== $liabilityType) {
|
||||
$liabilityAmount = $openingBalance;
|
||||
$liabilityStart = $openingBalanceDate;
|
||||
}
|
||||
|
||||
$interest = null;
|
||||
$interestPeriod = null;
|
||||
if ('liabilities' === $accountType) {
|
||||
$interest = $this->repository->getMetaValue($account, 'interest');
|
||||
$interestPeriod = $this->repository->getMetaValue($account, 'interest_period');
|
||||
}
|
||||
$includeNetworth = '0' !== $this->repository->getMetaValue($account, 'include_net_worth');
|
||||
|
||||
$data = [
|
||||
'id' => (int)$account->id,
|
||||
'created_at' => $account->created_at->toAtomString(),
|
||||
'updated_at' => $account->updated_at->toAtomString(),
|
||||
'active' => $account->active,
|
||||
'name' => $account->name,
|
||||
'type' => $accountType,
|
||||
'account_role' => $accountRole,
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
'currency_symbol' => $currencySymbol,
|
||||
'currency_dp' => $decimalPlaces,
|
||||
'current_balance' => round(app('steam')->balance($account, $date), $decimalPlaces),
|
||||
'current_balance_date' => $date->format('Y-m-d'),
|
||||
'notes' => $this->repository->getNoteText($account),
|
||||
'monthly_payment_date' => $monthlyPaymentDate,
|
||||
'credit_card_type' => $creditCardType,
|
||||
'account_number' => $this->repository->getMetaValue($account, 'accountNumber'),
|
||||
'iban' => '' === $account->iban ? null : $account->iban,
|
||||
'bic' => $this->repository->getMetaValue($account, 'BIC'),
|
||||
'virtual_balance' => round($account->virtual_balance, $decimalPlaces),
|
||||
'opening_balance' => $openingBalance,
|
||||
'opening_balance_date' => $openingBalanceDate,
|
||||
'liability_type' => $accountType,
|
||||
'liability_amount' => $openingBalance,
|
||||
'liability_start_date' => $openingBalanceDate,
|
||||
'interest' => $interest,
|
||||
'interest_period' => $interestPeriod,
|
||||
'include_net_worth' => $includeNetworth,
|
||||
'links' => [
|
||||
'id' => (int)$account->id,
|
||||
'created_at' => $account->created_at->toAtomString(),
|
||||
'updated_at' => $account->updated_at->toAtomString(),
|
||||
'active' => $account->active,
|
||||
'name' => $account->name,
|
||||
'type' => $accountType,
|
||||
'account_role' => $accountRole,
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
'currency_symbol' => $currencySymbol,
|
||||
'currency_decimal_places' => $decimalPlaces,
|
||||
'current_balance' => round(app('steam')->balance($account, $date), $decimalPlaces),
|
||||
'current_balance_date' => $date->format('Y-m-d'),
|
||||
'notes' => $this->repository->getNoteText($account),
|
||||
'monthly_payment_date' => $monthlyPaymentDate,
|
||||
'credit_card_type' => $creditCardType,
|
||||
'account_number' => $this->repository->getMetaValue($account, 'accountNumber'),
|
||||
'iban' => '' === $account->iban ? null : $account->iban,
|
||||
'bic' => $this->repository->getMetaValue($account, 'BIC'),
|
||||
'virtual_balance' => round($account->virtual_balance, $decimalPlaces),
|
||||
'opening_balance' => $openingBalance,
|
||||
'opening_balance_date' => $openingBalanceDate,
|
||||
'liability_type' => $liabilityType,
|
||||
'liability_amount' => $liabilityAmount,
|
||||
'liability_start_date' => $liabilityStart,
|
||||
'interest' => $interest,
|
||||
'interest_period' => $interestPeriod,
|
||||
'include_net_worth' => $includeNetworth,
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/accounts/' . $account->id,
|
||||
|
@@ -63,7 +63,7 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
'currency_id' => $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_dp' => $currency->decimal_places,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'start' => $availableBudget->start_date->format('Y-m-d'),
|
||||
'end' => $availableBudget->end_date->format('Y-m-d'),
|
||||
'amount' => round($availableBudget->amount, $currency->decimal_places),
|
||||
|
@@ -74,7 +74,7 @@ class BillTransformer extends AbstractTransformer
|
||||
'currency_id' => $bill->transaction_currency_id,
|
||||
'currency_code' => $bill->transactionCurrency->code,
|
||||
'currency_symbol' => $bill->transactionCurrency->symbol,
|
||||
'currency_dp' => $bill->transactionCurrency->decimal_places,
|
||||
'currency_decimal_places' => $bill->transactionCurrency->decimal_places,
|
||||
'name' => $bill->name,
|
||||
'amount_min' => round((float)$bill->amount_min, 2),
|
||||
'amount_max' => round((float)$bill->amount_max, 2),
|
||||
|
@@ -116,7 +116,7 @@ class CategoryTransformer extends AbstractTransformer
|
||||
$return[] = [
|
||||
'currency_code' => $code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_dp' => $currency->decimal_places,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'amount' => round($earned, $currency->decimal_places),
|
||||
];
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class CategoryTransformer extends AbstractTransformer
|
||||
$return[] = [
|
||||
'currency_code' => $code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_dp' => $currency->decimal_places,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'amount' => round($spent, $currency->decimal_places),
|
||||
];
|
||||
}
|
||||
|
@@ -64,12 +64,12 @@ class CurrencyExchangeRateTransformer extends AbstractTransformer
|
||||
'from_currency_name' => $rate->fromCurrency->name,
|
||||
'from_currency_code' => $rate->fromCurrency->code,
|
||||
'from_currency_symbol' => $rate->fromCurrency->symbol,
|
||||
'from_currency_dp' => $rate->fromCurrency->decimal_places,
|
||||
'from_currency_decimal_places' => $rate->fromCurrency->decimal_places,
|
||||
'to_currency_id' => $rate->toCurrency->id,
|
||||
'to_currency_name' => $rate->toCurrency->name,
|
||||
'to_currency_code' => $rate->toCurrency->code,
|
||||
'to_currency_symbol' => $rate->toCurrency->symbol,
|
||||
'to_currency_dp' => $rate->toCurrency->decimal_places,
|
||||
'to_currency_decimal_places' => $rate->toCurrency->decimal_places,
|
||||
'date' => $rate->date->format('Y-m-d'),
|
||||
'rate' => (float)$rate->rate,
|
||||
'amount' => $result,
|
||||
|
@@ -89,7 +89,7 @@ class PiggyBankEventTransformer extends AbstractTransformer
|
||||
'currency_id' => $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_dp' => $currency->decimal_places,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'transaction_id' => $transactionId,
|
||||
'links' => [
|
||||
[
|
||||
|
@@ -102,7 +102,7 @@ class PiggyBankTransformer extends AbstractTransformer
|
||||
'currency_id' => $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_dp' => $currency->decimal_places,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'target_amount' => $targetAmount,
|
||||
'percentage' => $percentage,
|
||||
'current_amount' => $currentAmount,
|
||||
|
@@ -36,9 +36,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -268,27 +266,27 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
$foreignAmount = round($transaction->foreign_amount, $foreignCurrencyDp);
|
||||
}
|
||||
$transactionArray = [
|
||||
'currency_id' => $transaction->transaction_currency_id,
|
||||
'currency_code' => $transaction->transactionCurrency->code,
|
||||
'currency_symbol' => $transaction->transactionCurrency->symbol,
|
||||
'currency_dp' => $transaction->transactionCurrency->decimal_places,
|
||||
'foreign_currency_id' => $transaction->foreign_currency_id,
|
||||
'foreign_currency_code' => $foreignCurrencyCode,
|
||||
'foreign_currency_symbol' => $foreignCurrencySymbol,
|
||||
'foreign_currency_dp' => $foreignCurrencyDp,
|
||||
'source_id' => $transaction->source_id,
|
||||
'source_name' => null === $sourceAccount ? '' : $sourceAccount->name,
|
||||
'destination_id' => $transaction->destination_id,
|
||||
'destination_name' => null === $destinationAccount ? '' : $destinationAccount->name,
|
||||
'amount' => $amount,
|
||||
'foreign_amount' => $foreignAmount,
|
||||
'description' => $transaction->description,
|
||||
'meta' => $this->getTransactionMeta($transaction),
|
||||
'currency_id' => $transaction->transaction_currency_id,
|
||||
'currency_code' => $transaction->transactionCurrency->code,
|
||||
'currency_symbol' => $transaction->transactionCurrency->symbol,
|
||||
'currency_decimal_places' => $transaction->transactionCurrency->decimal_places,
|
||||
'foreign_currency_id' => $transaction->foreign_currency_id,
|
||||
'foreign_currency_code' => $foreignCurrencyCode,
|
||||
'foreign_currency_symbol' => $foreignCurrencySymbol,
|
||||
'foreign_currency_decimal_places' => $foreignCurrencyDp,
|
||||
'source_id' => $transaction->source_id,
|
||||
'source_name' => null === $sourceAccount ? '' : $sourceAccount->name,
|
||||
'destination_id' => $transaction->destination_id,
|
||||
'destination_name' => null === $destinationAccount ? '' : $destinationAccount->name,
|
||||
'amount' => $amount,
|
||||
'foreign_amount' => $foreignAmount,
|
||||
'description' => $transaction->description,
|
||||
'meta' => $this->getTransactionMeta($transaction),
|
||||
];
|
||||
if (null !== $transaction->foreign_currency_id) {
|
||||
$transactionArray['foreign_currency_code'] = $transaction->foreignCurrency->code;
|
||||
$transactionArray['foreign_currency_symbol'] = $transaction->foreignCurrency->symbol;
|
||||
$transactionArray['foreign_currency_dp'] = $transaction->foreignCurrency->decimal_places;
|
||||
$transactionArray['foreign_currency_code'] = $transaction->foreignCurrency->code;
|
||||
$transactionArray['foreign_currency_symbol'] = $transaction->foreignCurrency->symbol;
|
||||
$transactionArray['foreign_currency_decimal_places'] = $transaction->foreignCurrency->decimal_places;
|
||||
}
|
||||
|
||||
// store transaction in recurrence array.
|
||||
|
@@ -28,9 +28,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class TransactionTransformer
|
||||
@@ -80,55 +78,55 @@ class TransactionTransformer extends AbstractTransformer
|
||||
|
||||
|
||||
$data = [
|
||||
'id' => (int)$transaction->id,
|
||||
'created_at' => $transaction->created_at->toAtomString(),
|
||||
'updated_at' => $transaction->updated_at->toAtomString(),
|
||||
'description' => $transaction->description,
|
||||
'transaction_description' => $transaction->transaction_description,
|
||||
'date' => $transaction->date->format('Y-m-d'),
|
||||
'type' => $transaction->transaction_type_type,
|
||||
'identifier' => $transaction->identifier,
|
||||
'journal_id' => (int)$transaction->journal_id,
|
||||
'reconciled' => (bool)$transaction->reconciled,
|
||||
'amount' => round($transaction->transaction_amount, (int)$transaction->transaction_currency_dp),
|
||||
'currency_id' => $transaction->transaction_currency_id,
|
||||
'currency_code' => $transaction->transaction_currency_code,
|
||||
'currency_symbol' => $transaction->transaction_currency_symbol,
|
||||
'currency_dp' => $transaction->transaction_currency_dp,
|
||||
'foreign_amount' => null,
|
||||
'foreign_currency_id' => $transaction->foreign_currency_id,
|
||||
'foreign_currency_code' => $transaction->foreign_currency_code,
|
||||
'foreign_currency_symbol' => $transaction->foreign_currency_symbol,
|
||||
'foreign_currency_dp' => $transaction->foreign_currency_dp,
|
||||
'bill_id' => $transaction->bill_id,
|
||||
'bill_name' => $transaction->bill_name,
|
||||
'category_id' => $categoryId,
|
||||
'category_name' => $categoryName,
|
||||
'budget_id' => $budgetId,
|
||||
'budget_name' => $budgetName,
|
||||
'notes' => $notes,
|
||||
'sepa_cc' => $this->repository->getMetaField($journal, 'sepa-cc'),
|
||||
'sepa_ct_op' => $this->repository->getMetaField($journal, 'sepa-ct-op'),
|
||||
'sepa_ct_id' => $this->repository->getMetaField($journal, 'sepa-ct-ud'),
|
||||
'sepa_db' => $this->repository->getMetaField($journal, 'sepa-db'),
|
||||
'sepa_country' => $this->repository->getMetaField($journal, 'sepa-country'),
|
||||
'sepa_ep' => $this->repository->getMetaField($journal, 'sepa-ep'),
|
||||
'sepa_ci' => $this->repository->getMetaField($journal, 'sepa-ci'),
|
||||
'sepa_batch_id' => $this->repository->getMetaField($journal, 'sepa-batch-id'),
|
||||
'interest_date' => $this->repository->getMetaDateString($journal, 'interest_date'),
|
||||
'book_date' => $this->repository->getMetaDateString($journal, 'book_date'),
|
||||
'process_date' => $this->repository->getMetaDateString($journal, 'process_date'),
|
||||
'due_date' => $this->repository->getMetaDateString($journal, 'due_date'),
|
||||
'payment_date' => $this->repository->getMetaDateString($journal, 'payment_date'),
|
||||
'invoice_date' => $this->repository->getMetaDateString($journal, 'invoice_date'),
|
||||
'internal_reference' => $this->repository->getMetaField($journal, 'internal_reference'),
|
||||
'bunq_payment_id' => $this->repository->getMetaField($journal, 'bunq_payment_id'),
|
||||
'importHashV2' => $this->repository->getMetaField($journal, 'importHashV2'),
|
||||
'recurrence_id' => (int)$this->repository->getMetaField($journal, 'recurrence_id'),
|
||||
'external_id' => $this->repository->getMetaField($journal, 'external_id'),
|
||||
'original_source' => $this->repository->getMetaField($journal, 'original-source'),
|
||||
'tags' => '' === $tags ? null : $tags,
|
||||
'links' => [
|
||||
'id' => (int)$transaction->id,
|
||||
'created_at' => $transaction->created_at->toAtomString(),
|
||||
'updated_at' => $transaction->updated_at->toAtomString(),
|
||||
'description' => $transaction->description,
|
||||
'transaction_description' => $transaction->transaction_description,
|
||||
'date' => $transaction->date->format('Y-m-d'),
|
||||
'type' => $transaction->transaction_type_type,
|
||||
'identifier' => $transaction->identifier,
|
||||
'journal_id' => (int)$transaction->journal_id,
|
||||
'reconciled' => (bool)$transaction->reconciled,
|
||||
'amount' => round($transaction->transaction_amount, (int)$transaction->transaction_currency_dp),
|
||||
'currency_id' => $transaction->transaction_currency_id,
|
||||
'currency_code' => $transaction->transaction_currency_code,
|
||||
'currency_symbol' => $transaction->transaction_currency_symbol,
|
||||
'currency_decimal_places' => $transaction->transaction_currency_dp,
|
||||
'foreign_amount' => null,
|
||||
'foreign_currency_id' => $transaction->foreign_currency_id,
|
||||
'foreign_currency_code' => $transaction->foreign_currency_code,
|
||||
'foreign_currency_symbol' => $transaction->foreign_currency_symbol,
|
||||
'foreign_currency_decimal_places' => $transaction->foreign_currency_dp,
|
||||
'bill_id' => $transaction->bill_id,
|
||||
'bill_name' => $transaction->bill_name,
|
||||
'category_id' => $categoryId,
|
||||
'category_name' => $categoryName,
|
||||
'budget_id' => $budgetId,
|
||||
'budget_name' => $budgetName,
|
||||
'notes' => $notes,
|
||||
'sepa_cc' => $this->repository->getMetaField($journal, 'sepa-cc'),
|
||||
'sepa_ct_op' => $this->repository->getMetaField($journal, 'sepa-ct-op'),
|
||||
'sepa_ct_id' => $this->repository->getMetaField($journal, 'sepa-ct-ud'),
|
||||
'sepa_db' => $this->repository->getMetaField($journal, 'sepa-db'),
|
||||
'sepa_country' => $this->repository->getMetaField($journal, 'sepa-country'),
|
||||
'sepa_ep' => $this->repository->getMetaField($journal, 'sepa-ep'),
|
||||
'sepa_ci' => $this->repository->getMetaField($journal, 'sepa-ci'),
|
||||
'sepa_batch_id' => $this->repository->getMetaField($journal, 'sepa-batch-id'),
|
||||
'interest_date' => $this->repository->getMetaDateString($journal, 'interest_date'),
|
||||
'book_date' => $this->repository->getMetaDateString($journal, 'book_date'),
|
||||
'process_date' => $this->repository->getMetaDateString($journal, 'process_date'),
|
||||
'due_date' => $this->repository->getMetaDateString($journal, 'due_date'),
|
||||
'payment_date' => $this->repository->getMetaDateString($journal, 'payment_date'),
|
||||
'invoice_date' => $this->repository->getMetaDateString($journal, 'invoice_date'),
|
||||
'internal_reference' => $this->repository->getMetaField($journal, 'internal_reference'),
|
||||
'bunq_payment_id' => $this->repository->getMetaField($journal, 'bunq_payment_id'),
|
||||
'importHashV2' => $this->repository->getMetaField($journal, 'importHashV2'),
|
||||
'recurrence_id' => (int)$this->repository->getMetaField($journal, 'recurrence_id'),
|
||||
'external_id' => $this->repository->getMetaField($journal, 'external_id'),
|
||||
'original_source' => $this->repository->getMetaField($journal, 'original-source'),
|
||||
'tags' => '' === $tags ? null : $tags,
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/transactions/' . $transaction->id,
|
||||
|
@@ -86,32 +86,32 @@ use FireflyIII\TransactionRules\Triggers\UserAction;
|
||||
*/
|
||||
|
||||
return [
|
||||
'configuration' => [
|
||||
'configuration' => [
|
||||
'single_user_mode' => true,
|
||||
'is_demo_site' => false,
|
||||
],
|
||||
'encryption' => null === env('USE_ENCRYPTION') || env('USE_ENCRYPTION') === true,
|
||||
'version' => '4.7.9',
|
||||
'api_version' => '0.9.0',
|
||||
'db_version' => 6,
|
||||
'maxUploadSize' => 15242880,
|
||||
'send_error_message' => env('SEND_ERROR_MESSAGE', true),
|
||||
'site_owner' => env('SITE_OWNER', ''),
|
||||
'send_registration_mail' => env('SEND_REGISTRATION_MAIL', true),
|
||||
'demo_username' => env('DEMO_USERNAME', ''),
|
||||
'demo_password' => env('DEMO_PASSWORD', ''),
|
||||
'is_sandstorm' => env('IS_SANDSTORM', 'unknown'),
|
||||
'is_docker' => env('IS_DOCKER', 'unknown'),
|
||||
'bunq_use_sandbox' => env('BUNQ_USE_SANDBOX', false),
|
||||
'fixer_api_key' => env('FIXER_API_KEY', ''),
|
||||
'mapbox_api_key' => env('MAPBOX_API_KEY', ''),
|
||||
'trusted_proxies' => env('TRUSTED_PROXIES', ''),
|
||||
'search_result_limit' => env('SEARCH_RESULT_LIMIT', 50),
|
||||
'send_report_journals' => envNonEmpty('SEND_REPORT_JOURNALS', true),
|
||||
'analytics_id' => env('ANALYTICS_ID', ''),
|
||||
'disable_frame_header' => env('DISABLE_FRAME_HEADER', false),
|
||||
'login_provider' => envNonEmpty('LOGIN_PROVIDER', 'eloquent'),
|
||||
'allowedMimes' => [
|
||||
'encryption' => null === env('USE_ENCRYPTION') || env('USE_ENCRYPTION') === true,
|
||||
'version' => '4.7.9',
|
||||
'api_version' => '0.9.0',
|
||||
'db_version' => 6,
|
||||
'maxUploadSize' => 15242880,
|
||||
'send_error_message' => env('SEND_ERROR_MESSAGE', true),
|
||||
'site_owner' => env('SITE_OWNER', ''),
|
||||
'send_registration_mail' => env('SEND_REGISTRATION_MAIL', true),
|
||||
'demo_username' => env('DEMO_USERNAME', ''),
|
||||
'demo_password' => env('DEMO_PASSWORD', ''),
|
||||
'is_sandstorm' => env('IS_SANDSTORM', 'unknown'),
|
||||
'is_docker' => env('IS_DOCKER', 'unknown'),
|
||||
'bunq_use_sandbox' => env('BUNQ_USE_SANDBOX', false),
|
||||
'fixer_api_key' => env('FIXER_API_KEY', ''),
|
||||
'mapbox_api_key' => env('MAPBOX_API_KEY', ''),
|
||||
'trusted_proxies' => env('TRUSTED_PROXIES', ''),
|
||||
'search_result_limit' => env('SEARCH_RESULT_LIMIT', 50),
|
||||
'send_report_journals' => envNonEmpty('SEND_REPORT_JOURNALS', true),
|
||||
'analytics_id' => env('ANALYTICS_ID', ''),
|
||||
'disable_frame_header' => env('DISABLE_FRAME_HEADER', false),
|
||||
'login_provider' => envNonEmpty('LOGIN_PROVIDER', 'eloquent'),
|
||||
'allowedMimes' => [
|
||||
/* plain files */
|
||||
'text/plain',
|
||||
|
||||
@@ -173,18 +173,18 @@ return [
|
||||
'application/vnd.oasis.opendocument.database',
|
||||
'application/vnd.oasis.opendocument.image',
|
||||
],
|
||||
'list_length' => 10,
|
||||
'export_formats' => [
|
||||
'list_length' => 10,
|
||||
'export_formats' => [
|
||||
'csv' => CsvExporter::class,
|
||||
],
|
||||
'default_export_format' => 'csv',
|
||||
'default_import_format' => 'csv',
|
||||
'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
|
||||
'accountRoles' => ['defaultAsset', 'sharedAsset', 'savingAsset', 'ccAsset', 'cashWalletAsset'],
|
||||
'ccTypes' => [
|
||||
'default_export_format' => 'csv',
|
||||
'default_import_format' => 'csv',
|
||||
'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
|
||||
'accountRoles' => ['defaultAsset', 'sharedAsset', 'savingAsset', 'ccAsset', 'cashWalletAsset'],
|
||||
'ccTypes' => [
|
||||
'monthlyFull' => 'Full payment every month',
|
||||
],
|
||||
'range_to_repeat_freq' => [
|
||||
'range_to_repeat_freq' => [
|
||||
'1D' => 'weekly',
|
||||
'1W' => 'weekly',
|
||||
'1M' => 'monthly',
|
||||
@@ -193,7 +193,7 @@ return [
|
||||
'1Y' => 'yearly',
|
||||
'custom' => 'custom',
|
||||
],
|
||||
'subTitlesByIdentifier' =>
|
||||
'subTitlesByIdentifier' =>
|
||||
[
|
||||
'asset' => 'Asset accounts',
|
||||
'expense' => 'Expense accounts',
|
||||
@@ -202,7 +202,7 @@ return [
|
||||
'liabilities' => 'Liabilities',
|
||||
'liability' => 'Liabilities',
|
||||
],
|
||||
'subIconsByIdentifier' =>
|
||||
'subIconsByIdentifier' =>
|
||||
[
|
||||
'asset' => 'fa-money',
|
||||
'Asset account' => 'fa-money',
|
||||
@@ -217,7 +217,7 @@ return [
|
||||
'Import account' => 'fa-download',
|
||||
'liabilities' => 'fa-ticket',
|
||||
],
|
||||
'accountTypesByIdentifier' =>
|
||||
'accountTypesByIdentifier' =>
|
||||
[
|
||||
'asset' => ['Default account', 'Asset account'],
|
||||
'expense' => ['Expense account', 'Beneficiary account'],
|
||||
@@ -225,7 +225,7 @@ return [
|
||||
'import' => ['Import account'],
|
||||
'liabilities' => ['Loan', 'Debt', 'Credit card', 'Mortgage'],
|
||||
],
|
||||
'accountTypeByIdentifier' =>
|
||||
'accountTypeByIdentifier' =>
|
||||
[
|
||||
'asset' => ['Asset account'],
|
||||
'expense' => ['Expense account'],
|
||||
@@ -237,7 +237,7 @@ return [
|
||||
'liabilities' => ['Loan', 'Debt', 'Mortgage', 'Credit card'],
|
||||
'liability' => ['Loan', 'Debt', 'Mortgage', 'Credit card'],
|
||||
],
|
||||
'shortNamesByFullName' =>
|
||||
'shortNamesByFullName' =>
|
||||
[
|
||||
'Default account' => 'asset',
|
||||
'Asset account' => 'asset',
|
||||
@@ -251,7 +251,13 @@ return [
|
||||
'Debt' => 'liabilities',
|
||||
'Mortgage' => 'liabilities',
|
||||
],
|
||||
'languages' => [
|
||||
'shortLiabilityNameByFullName' => [
|
||||
'Credit card' => 'creditcard',
|
||||
'Loan' => 'loan',
|
||||
'Debt' => 'debt',
|
||||
'Mortgage' => 'mortgage',
|
||||
],
|
||||
'languages' => [
|
||||
// completed languages
|
||||
'en_US' => ['name_locale' => 'English', 'name_english' => 'English'],
|
||||
'es_ES' => ['name_locale' => 'Español', 'name_english' => 'Spanish'], // 2018-10-26: 96%
|
||||
@@ -275,7 +281,7 @@ return [
|
||||
//'sl_SI' => ['name_locale' => 'Slovenian', 'name_english' => 'Slovenian'], // 2018-10-26: 10%
|
||||
//'uk_UA' => ['name_locale' => 'Ukranian', 'name_english' => 'Ukranian'], // 2018-10-26: 3%
|
||||
],
|
||||
'transactionTypesByWhat' => [
|
||||
'transactionTypesByWhat' => [
|
||||
'expenses' => ['Withdrawal'],
|
||||
'withdrawal' => ['Withdrawal'],
|
||||
'revenue' => ['Deposit'],
|
||||
@@ -283,7 +289,7 @@ return [
|
||||
'transfer' => ['Transfer'],
|
||||
'transfers' => ['Transfer'],
|
||||
],
|
||||
'transactionIconsByWhat' => [
|
||||
'transactionIconsByWhat' => [
|
||||
'expenses' => 'fa-long-arrow-left',
|
||||
'withdrawal' => 'fa-long-arrow-left',
|
||||
'revenue' => 'fa-long-arrow-right',
|
||||
@@ -292,7 +298,7 @@ return [
|
||||
'transfers' => 'fa-exchange',
|
||||
|
||||
],
|
||||
'bindables' => [
|
||||
'bindables' => [
|
||||
// models
|
||||
'account' => \FireflyIII\Models\Account::class,
|
||||
'attachment' => \FireflyIII\Models\Attachment::class,
|
||||
@@ -345,7 +351,7 @@ return [
|
||||
|
||||
|
||||
],
|
||||
'rule-triggers' => [
|
||||
'rule-triggers' => [
|
||||
'user_action' => UserAction::class,
|
||||
'from_account_starts' => FromAccountStarts::class,
|
||||
'from_account_ends' => FromAccountEnds::class,
|
||||
@@ -381,7 +387,7 @@ return [
|
||||
'no_notes' => NotesEmpty::class,
|
||||
'any_notes' => NotesAny::class,
|
||||
],
|
||||
'rule-actions' => [
|
||||
'rule-actions' => [
|
||||
'set_category' => SetCategory::class,
|
||||
'clear_category' => ClearCategory::class,
|
||||
'set_budget' => SetBudget::class,
|
||||
@@ -403,7 +409,7 @@ return [
|
||||
'convert_deposit' => ConvertToDeposit::class,
|
||||
'convert_transfer' => ConvertToTransfer::class,
|
||||
],
|
||||
'context-rule-actions' => [
|
||||
'context-rule-actions' => [
|
||||
'set_category',
|
||||
'set_budget',
|
||||
'add_tag',
|
||||
@@ -421,7 +427,7 @@ return [
|
||||
'convert_deposit',
|
||||
'convert_transfer',
|
||||
],
|
||||
'context-rule-triggers' => [
|
||||
'context-rule-triggers' => [
|
||||
'from_account_starts',
|
||||
'from_account_ends',
|
||||
'from_account_is',
|
||||
|
@@ -24,14 +24,11 @@ declare(strict_types=1);
|
||||
namespace Tests\Unit\Transformers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Transformers\AccountTransformer;
|
||||
use Mockery;
|
||||
use Steam;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -41,413 +38,352 @@ use Tests\TestCase;
|
||||
class AccountTransformerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Basic account display.
|
||||
* Check balance on a different date.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testBasic(): void
|
||||
public function testBalanceDate(): void
|
||||
{
|
||||
// mock stuff and get object:
|
||||
$account = $this->getRandomAsset();
|
||||
$euro = TransactionCurrency::find(1);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getMetaValue')->andReturn('1');
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('');
|
||||
$account = factory(Account::class)->make();
|
||||
$transformer = new AccountTransformer(new ParameterBag);
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
$parameters = new ParameterBag;
|
||||
$parameters->set('date', new Carbon('2018-01-01'));
|
||||
|
||||
$transformer = app(AccountTransformer::class);
|
||||
$transformer->setParameters($parameters);
|
||||
|
||||
// following calls are expected:
|
||||
$accountRepos->shouldReceive('setUser')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountType')->andReturn('Asset account')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->andReturn($euro)->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('I am a note')->atLeast()->once();
|
||||
|
||||
// get all kinds of meta values:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('defaultAsset')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('12345')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('NL5X')->atLeast()->once();
|
||||
|
||||
// opening balance:
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->withArgs([Mockery::any()])->andReturnNull()->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->withArgs([Mockery::any()])->andReturnNull()->atLeast()->once();
|
||||
|
||||
|
||||
// steam is also called for the account balance:
|
||||
Steam::shouldReceive('balance')->andReturn('123.45')->atLeast()->once();
|
||||
|
||||
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
// verify all fields.
|
||||
$this->assertEquals($account->id, $result['id']);
|
||||
|
||||
|
||||
$this->assertEquals($account->active, $result['active']);
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('Asset account', $result['type']);
|
||||
$this->assertEquals(12.34, $result['virtual_balance']);
|
||||
$this->assertEquals(12.34, $result['current_balance']);
|
||||
$this->assertNull($result['opening_balance']);
|
||||
$this->assertNull($result['opening_balance_date']);
|
||||
}
|
||||
$this->assertEquals('asset', $result['type']);
|
||||
$this->assertEquals('defaultAsset', $result['account_role']);
|
||||
$this->assertEquals(1, $result['currency_id']);
|
||||
$this->assertEquals('EUR', $result['currency_code']);
|
||||
$this->assertEquals('€', $result['currency_symbol']);
|
||||
$this->assertEquals(2, $result['currency_decimal_places']);
|
||||
|
||||
/**
|
||||
* Basic account display with custom date parameter.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testBasicDate(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getMetaValue')->andReturn('1');
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('');
|
||||
// make new account:
|
||||
$account = Account::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'account_type_id' => 3, // asset account
|
||||
'name' => 'Random name #' . random_int(1, 10000),
|
||||
'virtual_balance' => 12.34,
|
||||
'iban' => 'NL85ABNA0466812694',
|
||||
'active' => 1,
|
||||
'encrypted' => 0,
|
||||
]
|
||||
);
|
||||
$parameterBag = new ParameterBag;
|
||||
$parameterBag->set('date', new Carbon('2018-01-01'));
|
||||
|
||||
$transformer = new AccountTransformer($parameterBag);
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('Asset account', $result['type']);
|
||||
$this->assertEquals(12.34, $result['virtual_balance']);
|
||||
$this->assertEquals(12.34, $result['current_balance']);
|
||||
// date given, so it must match.
|
||||
$this->assertEquals('2018-01-01', $result['current_balance_date']);
|
||||
}
|
||||
$this->assertEquals(123.45, $result['current_balance']);
|
||||
|
||||
/**
|
||||
* Assert account has credit card meta data, should NOT be ignored in output.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testCCDataAsset(): void
|
||||
{
|
||||
// make new account:
|
||||
$account = Account::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'account_type_id' => 3, // asset account
|
||||
'name' => 'Random name #' . random_int(1, 10000),
|
||||
'virtual_balance' => 12.34,
|
||||
'iban' => 'NL85ABNA0466812694',
|
||||
'active' => 1,
|
||||
'encrypted' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
// add a note:
|
||||
$note = Note::create(
|
||||
[
|
||||
'noteable_id' => $account->id,
|
||||
'noteable_type' => Account::class,
|
||||
'title' => null,
|
||||
'text' => 'I am a note #' . random_int(1, 10000),
|
||||
]
|
||||
);
|
||||
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccMonthlyPaymentDate'])->andReturn('2018-02-01');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccType'])->andReturn('monthlyFull');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('123');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('123');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn($note->text);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturn(null);
|
||||
|
||||
// add currency preference:
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'currency_id',
|
||||
'data' => 1, // euro
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
// add credit card meta data (will be ignored)
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'accountRole',
|
||||
'data' => 'ccAsset',
|
||||
]
|
||||
);
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'ccMonthlyPaymentDate',
|
||||
'data' => '2018-02-01',
|
||||
]
|
||||
);
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'ccType',
|
||||
'data' => 'monthlyFull',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$transformer = new AccountTransformer(new ParameterBag);
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('Asset account', $result['type']);
|
||||
$this->assertEquals(12.34, $result['virtual_balance']);
|
||||
$this->assertEquals(12.34, $result['current_balance']);
|
||||
$this->assertEquals(1, $result['currency_id']);
|
||||
$this->assertEquals('EUR', $result['currency_code']);
|
||||
$this->assertEquals($note->text, $result['notes']);
|
||||
$this->assertEquals('2018-02-01', $result['monthly_payment_date']);
|
||||
$this->assertEquals('monthlyFull', $result['credit_card_type']);
|
||||
$this->assertEquals('ccAsset', $result['account_role']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expense account has credit card meta data, should be ignored in output.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testIgnoreCCExpense(): void
|
||||
{
|
||||
|
||||
// make new account:
|
||||
$account = Account::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'account_type_id' => 4, // expense account
|
||||
'name' => 'Random name #' . random_int(1, 10000),
|
||||
'virtual_balance' => 12.34,
|
||||
'iban' => 'NL85ABNA0466812694',
|
||||
'active' => 1,
|
||||
'encrypted' => 0,
|
||||
]
|
||||
);
|
||||
// add a note:
|
||||
$note = Note::create(
|
||||
[
|
||||
'noteable_id' => $account->id,
|
||||
'noteable_type' => Account::class,
|
||||
'title' => null,
|
||||
'text' => 'I am a note #' . random_int(1, 10000),
|
||||
]
|
||||
);
|
||||
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getMetaValue')->andReturn('1');
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn($note->text);
|
||||
|
||||
|
||||
// add currency preference:
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'currency_id',
|
||||
'data' => 1, // euro
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
// add credit card meta data (will be ignored)
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'accountRole',
|
||||
'data' => 'ccAsset',
|
||||
]
|
||||
);
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'ccMonthlyPaymentDate',
|
||||
'data' => '2018-02-01',
|
||||
]
|
||||
);
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'ccType',
|
||||
'data' => 'monthlyFull',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$transformer = new AccountTransformer(new ParameterBag);
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('Expense account', $result['type']);
|
||||
$this->assertEquals(12.34, $result['virtual_balance']);
|
||||
$this->assertEquals(12.34, $result['current_balance']);
|
||||
$this->assertEquals(1, $result['currency_id']);
|
||||
$this->assertEquals('EUR', $result['currency_code']);
|
||||
$this->assertEquals($note->text, $result['notes']);
|
||||
$this->assertEquals('I am a note', $result['notes']);
|
||||
$this->assertNull($result['monthly_payment_date']);
|
||||
$this->assertNull($result['credit_card_type']);
|
||||
$this->assertEquals('12345', $result['account_number']);
|
||||
$this->assertEquals($account->iban, $result['iban']);
|
||||
$this->assertEquals('NL5X', $result['bic']);
|
||||
$this->assertNull($result['liability_type']);
|
||||
$this->assertNull($result['liability_amount']);
|
||||
$this->assertNull($result['liability_start_date']);
|
||||
$this->assertNull($result['interest']);
|
||||
$this->assertNull($result['interest_period']);
|
||||
$this->assertTrue($result['include_net_worth']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a basic asset account, and verify the result in the transformer.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testBasicAsset(): void
|
||||
{
|
||||
// mock stuff and get object:
|
||||
$account = $this->getRandomAsset();
|
||||
$euro = TransactionCurrency::find(1);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$transformer = app(AccountTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
|
||||
// following calls are expected:
|
||||
$accountRepos->shouldReceive('setUser')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountType')->andReturn('Asset account')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->andReturn($euro)->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('I am a note')->atLeast()->once();
|
||||
|
||||
// get all kinds of meta values:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('defaultAsset')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('12345')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('NL5X')->atLeast()->once();
|
||||
|
||||
// opening balance:
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->withArgs([Mockery::any()])->andReturnNull()->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->withArgs([Mockery::any()])->andReturnNull()->atLeast()->once();
|
||||
|
||||
|
||||
// steam is also called for the account balance:
|
||||
Steam::shouldReceive('balance')->andReturn('123.45')->atLeast()->once();
|
||||
|
||||
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
// verify all fields.
|
||||
$this->assertEquals($account->id, $result['id']);
|
||||
$this->assertEquals($account->active, $result['active']);
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('asset', $result['type']);
|
||||
$this->assertEquals('defaultAsset', $result['account_role']);
|
||||
$this->assertEquals(1, $result['currency_id']);
|
||||
$this->assertEquals('EUR', $result['currency_code']);
|
||||
$this->assertEquals('€', $result['currency_symbol']);
|
||||
$this->assertEquals(2, $result['currency_decimal_places']);
|
||||
|
||||
// no date given, so must be today:
|
||||
$this->assertEquals(date('Y-m-d'), $result['current_balance_date']);
|
||||
$this->assertEquals(123.45, $result['current_balance']);
|
||||
|
||||
$this->assertEquals('I am a note', $result['notes']);
|
||||
$this->assertNull($result['monthly_payment_date']);
|
||||
$this->assertNull($result['credit_card_type']);
|
||||
$this->assertEquals('12345', $result['account_number']);
|
||||
$this->assertEquals($account->iban, $result['iban']);
|
||||
$this->assertEquals('NL5X', $result['bic']);
|
||||
$this->assertNull($result['liability_type']);
|
||||
$this->assertNull($result['liability_amount']);
|
||||
$this->assertNull($result['liability_start_date']);
|
||||
$this->assertNull($result['interest']);
|
||||
$this->assertNull($result['interest_period']);
|
||||
$this->assertTrue($result['include_net_worth']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Credit card asset has some extra fields
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testCreditCardAsset(): void
|
||||
{
|
||||
// mock stuff and get object:
|
||||
$account = $this->getRandomAsset();
|
||||
$euro = TransactionCurrency::find(1);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$transformer = app(AccountTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
|
||||
// following calls are expected:
|
||||
$accountRepos->shouldReceive('setUser')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountType')->andReturn('Asset account')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->andReturn($euro)->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('I am a note')->atLeast()->once();
|
||||
|
||||
// get all kinds of meta values:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('12345')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('NL5X')->atLeast()->once();
|
||||
|
||||
// credit card fields:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccType'])->andReturn('monthlyFull')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccMonthlyPaymentDate'])->andReturn('2018-01-01')->atLeast()->once();
|
||||
|
||||
|
||||
// opening balance:
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->withArgs([Mockery::any()])->andReturnNull()->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->withArgs([Mockery::any()])->andReturnNull()->atLeast()->once();
|
||||
|
||||
|
||||
// steam is also called for the account balance:
|
||||
Steam::shouldReceive('balance')->andReturn('123.45')->atLeast()->once();
|
||||
|
||||
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
// verify all fields.
|
||||
$this->assertEquals($account->id, $result['id']);
|
||||
$this->assertEquals($account->active, $result['active']);
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('asset', $result['type']);
|
||||
$this->assertEquals('ccAsset', $result['account_role']);
|
||||
$this->assertEquals(1, $result['currency_id']);
|
||||
$this->assertEquals('EUR', $result['currency_code']);
|
||||
$this->assertEquals('€', $result['currency_symbol']);
|
||||
$this->assertEquals(2, $result['currency_decimal_places']);
|
||||
|
||||
// no date given, so must be today:
|
||||
$this->assertEquals(date('Y-m-d'), $result['current_balance_date']);
|
||||
$this->assertEquals(123.45, $result['current_balance']);
|
||||
|
||||
$this->assertEquals('I am a note', $result['notes']);
|
||||
|
||||
// cc fields must be filled in:
|
||||
$this->assertEquals('2018-01-01', $result['monthly_payment_date']);
|
||||
$this->assertEquals('monthlyFull', $result['credit_card_type']);
|
||||
$this->assertEquals('12345', $result['account_number']);
|
||||
$this->assertEquals($account->iban, $result['iban']);
|
||||
$this->assertEquals('NL5X', $result['bic']);
|
||||
$this->assertNull($result['liability_type']);
|
||||
$this->assertNull($result['liability_amount']);
|
||||
$this->assertNull($result['liability_start_date']);
|
||||
$this->assertNull($result['interest']);
|
||||
$this->assertNull($result['interest_period']);
|
||||
$this->assertTrue($result['include_net_worth']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Liability also has some extra fields.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testLiability(): void
|
||||
{
|
||||
// mock stuff and get object:
|
||||
$account = $this->getRandomAsset();
|
||||
$euro = TransactionCurrency::find(1);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$transformer = app(AccountTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
|
||||
// following calls are expected:
|
||||
$accountRepos->shouldReceive('setUser')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountType')->andReturn('Mortgage')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->andReturn($euro)->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('I am a note')->atLeast()->once();
|
||||
|
||||
// get all kinds of meta values:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('12345')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('NL5X')->atLeast()->once();
|
||||
|
||||
// data for liability
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('3')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('monthly')->atLeast()->once();
|
||||
|
||||
// opening balance:
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->withArgs([Mockery::any()])->andReturn('-1000')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->withArgs([Mockery::any()])->andReturn('2018-01-01')->atLeast()->once();
|
||||
|
||||
|
||||
// steam is also called for the account balance:
|
||||
Steam::shouldReceive('balance')->andReturn('123.45')->atLeast()->once();
|
||||
|
||||
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
// verify all fields.
|
||||
$this->assertEquals($account->id, $result['id']);
|
||||
$this->assertEquals($account->active, $result['active']);
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('liabilities', $result['type']);
|
||||
$this->assertNull($result['account_role']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic account display.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testOpeningBalance(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturn('45.67');
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturn('2018-01-01');
|
||||
$accountRepos->shouldReceive('getMetaValue')->andReturn('1');
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('');
|
||||
// make new account:
|
||||
$account = Account::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'account_type_id' => 3, // asset account
|
||||
'name' => 'Random name #' . random_int(1, 10000),
|
||||
'virtual_balance' => 12.34,
|
||||
'iban' => 'NL85ABNA0466812694',
|
||||
'active' => 1,
|
||||
'encrypted' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
// create opening balance:
|
||||
$journal = TransactionJournal::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'transaction_type_id' => 4, // opening balance
|
||||
'transaction_currency_id' => 1, // EUR
|
||||
'description' => 'Opening',
|
||||
'date' => '2018-01-01',
|
||||
'completed' => 1,
|
||||
'tag_count' => 0,
|
||||
]
|
||||
);
|
||||
$transaction = Transaction::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'transaction_journal_id' => $journal->id,
|
||||
'transaction_currency_id' => 1,
|
||||
'amount' => '45.67',
|
||||
]
|
||||
);
|
||||
|
||||
$transformer = new AccountTransformer(new ParameterBag);
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('Asset account', $result['type']);
|
||||
$this->assertEquals(12.34, $result['virtual_balance']);
|
||||
$this->assertEquals(58.01, $result['current_balance']); // add opening balance.
|
||||
$this->assertEquals(45.67, $result['opening_balance']);
|
||||
$this->assertEquals('2018-01-01', $result['opening_balance_date']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Account has currency preference, should be reflected in output.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testWithCurrency(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getMetaValue')->andReturn('1');
|
||||
$accountRepos->shouldReceive('getNote')->andReturn('');
|
||||
$accountRepos->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('');
|
||||
// make new account:
|
||||
$account = Account::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'account_type_id' => 3, // asset account
|
||||
'name' => 'Random name #' . random_int(1, 10000),
|
||||
'virtual_balance' => 12.34,
|
||||
'iban' => 'NL85ABNA0466812694',
|
||||
'active' => 1,
|
||||
'encrypted' => 0,
|
||||
]
|
||||
);
|
||||
// add currency preference:
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'currency_id',
|
||||
'data' => 1, // euro
|
||||
]
|
||||
);
|
||||
|
||||
$transformer = new AccountTransformer(new ParameterBag);
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('Asset account', $result['type']);
|
||||
$this->assertEquals(12.34, $result['virtual_balance']);
|
||||
$this->assertEquals(12.34, $result['current_balance']);
|
||||
$this->assertEquals(1, $result['currency_id']);
|
||||
$this->assertEquals('EUR', $result['currency_code']);
|
||||
$this->assertEquals('€', $result['currency_symbol']);
|
||||
$this->assertEquals(2, $result['currency_decimal_places']);
|
||||
|
||||
// no date given, so must be today:
|
||||
$this->assertEquals(date('Y-m-d'), $result['current_balance_date']);
|
||||
$this->assertEquals(123.45, $result['current_balance']);
|
||||
$this->assertEquals('I am a note', $result['notes']);
|
||||
$this->assertNull($result['monthly_payment_date']);
|
||||
$this->assertNull($result['credit_card_type']);
|
||||
$this->assertEquals('12345', $result['account_number']);
|
||||
$this->assertEquals($account->iban, $result['iban']);
|
||||
$this->assertEquals('NL5X', $result['bic']);
|
||||
|
||||
// liability fields
|
||||
$this->assertEquals('mortgage', $result['liability_type']);
|
||||
$this->assertEquals('-1000', $result['liability_amount']);
|
||||
$this->assertEquals('2018-01-01', $result['liability_start_date']);
|
||||
$this->assertEquals('3', $result['interest']);
|
||||
$this->assertEquals('monthly', $result['interest_period']);
|
||||
|
||||
$this->assertTrue($result['include_net_worth']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Account has notes, should be reflected in output.
|
||||
* If the account is not an asset account, the role must always be NULL.
|
||||
*
|
||||
* @covers \FireflyIII\Transformers\AccountTransformer
|
||||
*/
|
||||
public function testWithNotes(): void
|
||||
public function testRoleEmpty(): void
|
||||
{
|
||||
// make new account:
|
||||
$account = Account::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'account_type_id' => 3, // asset account
|
||||
'name' => 'Random name #' . random_int(1, 10000),
|
||||
'virtual_balance' => 12.34,
|
||||
'iban' => 'NL85ABNA0466812694',
|
||||
'active' => 1,
|
||||
'encrypted' => 0,
|
||||
]
|
||||
);
|
||||
// add a note:
|
||||
$note = Note::create(
|
||||
[
|
||||
'noteable_id' => $account->id,
|
||||
'noteable_type' => Account::class,
|
||||
'title' => null,
|
||||
'text' => 'I am a note #' . random_int(1, 10000),
|
||||
]
|
||||
);
|
||||
|
||||
// mock stuff and get object:
|
||||
$account = $this->getRandomExpense();
|
||||
$euro = TransactionCurrency::find(1);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getMetaValue')->andReturn('1');
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn($note->text);
|
||||
|
||||
// add currency preference:
|
||||
AccountMeta::create(
|
||||
[
|
||||
'account_id' => $account->id,
|
||||
'name' => 'currency_id',
|
||||
'data' => 1, // euro
|
||||
]
|
||||
);
|
||||
$transformer = app(AccountTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
|
||||
// following calls are expected:
|
||||
$accountRepos->shouldReceive('setUser')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountType')->andReturn('Expense account')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getAccountCurrency')->andReturn($euro)->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn('I am a note')->atLeast()->once();
|
||||
|
||||
// get all kinds of meta values:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('defaultAsset')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('12345')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('NL5X')->atLeast()->once();
|
||||
|
||||
// steam is also called for the account balance:
|
||||
Steam::shouldReceive('balance')->andReturn('123.45')->atLeast()->once();
|
||||
|
||||
|
||||
$transformer = new AccountTransformer(new ParameterBag);
|
||||
$result = $transformer->transform($account);
|
||||
$result = $transformer->transform($account);
|
||||
|
||||
// verify all fields.
|
||||
$this->assertEquals($account->id, $result['id']);
|
||||
$this->assertEquals($account->active, $result['active']);
|
||||
$this->assertEquals($account->name, $result['name']);
|
||||
$this->assertEquals('Asset account', $result['type']);
|
||||
$this->assertEquals(12.34, $result['virtual_balance']);
|
||||
$this->assertEquals(12.34, $result['current_balance']);
|
||||
$this->assertEquals('expense', $result['type']);
|
||||
$this->assertNull($result['account_role']);
|
||||
$this->assertEquals(1, $result['currency_id']);
|
||||
$this->assertEquals('EUR', $result['currency_code']);
|
||||
$this->assertEquals($note->text, $result['notes']);
|
||||
$this->assertEquals('€', $result['currency_symbol']);
|
||||
$this->assertEquals(2, $result['currency_decimal_places']);
|
||||
|
||||
// no date given, so must be today:
|
||||
$this->assertEquals(date('Y-m-d'), $result['current_balance_date']);
|
||||
$this->assertEquals(123.45, $result['current_balance']);
|
||||
|
||||
$this->assertEquals('I am a note', $result['notes']);
|
||||
$this->assertNull($result['monthly_payment_date']);
|
||||
$this->assertNull($result['credit_card_type']);
|
||||
$this->assertEquals('12345', $result['account_number']);
|
||||
$this->assertEquals($account->iban, $result['iban']);
|
||||
$this->assertEquals('NL5X', $result['bic']);
|
||||
$this->assertNull($result['liability_type']);
|
||||
$this->assertNull($result['liability_amount']);
|
||||
$this->assertNull($result['liability_start_date']);
|
||||
$this->assertNull($result['interest']);
|
||||
$this->assertNull($result['interest_period']);
|
||||
$this->assertTrue($result['include_net_worth']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -23,8 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Transformers;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
use FireflyIII\Transformers\AttachmentTransformer;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Tests\TestCase;
|
||||
@@ -41,12 +42,13 @@ class AttachmentTransformerTest extends TestCase
|
||||
*/
|
||||
public function testBasic(): void
|
||||
{
|
||||
$repository = $this->mock(AttachmentRepositoryInterface::class);
|
||||
$md5 = md5('hello' . random_int(1, 10000));
|
||||
$attachment = Attachment::create(
|
||||
[
|
||||
'user_id' => $this->user()->id,
|
||||
'attachable_id' => 1,
|
||||
'attachable_type' => Account::class,
|
||||
'attachable_type' => TransactionJournal::class,
|
||||
'md5' => $md5,
|
||||
'filename' => 'hello.txt',
|
||||
'mime' => 'text/plain',
|
||||
@@ -55,10 +57,20 @@ class AttachmentTransformerTest extends TestCase
|
||||
]
|
||||
);
|
||||
|
||||
$transformer = new AttachmentTransformer(new ParameterBag);
|
||||
$result = $transformer->transform($attachment);
|
||||
$this->assertEquals($md5, $result['md5']);
|
||||
$this->assertEquals('hello.txt', $result['filename']);
|
||||
// expected calls:
|
||||
$repository->shouldReceive('setUser')->atLeast()->once();
|
||||
$repository->shouldReceive('getNoteText')->once()->andReturn('I am a note');
|
||||
|
||||
// make transformer
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
$result = $transformer->transform($attachment);
|
||||
|
||||
// test results
|
||||
$this->assertEquals($attachment->id, $result['id']);
|
||||
$this->assertEquals('TransactionJournal', $result['attachable_type']);
|
||||
$this->assertEquals('I am a note', $result['notes']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user