mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 04:34:00 +00:00
Fix test coverage.
This commit is contained in:
@@ -256,9 +256,7 @@ class AccountController extends Controller
|
|||||||
$paginator = $collector->getPaginatedTransactions();
|
$paginator = $collector->getPaginatedTransactions();
|
||||||
$paginator->setPath(route('api.v1.accounts.transactions', [$account->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.accounts.transactions', [$account->id]) . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -260,8 +260,7 @@ class BillController extends Controller
|
|||||||
$paginator = $collector->getPaginatedTransactions();
|
$paginator = $collector->getPaginatedTransactions();
|
||||||
$paginator->setPath(route('api.v1.bills.transactions', [$bill->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.bills.transactions', [$bill->id]) . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -256,9 +256,7 @@ class BudgetController extends Controller
|
|||||||
$paginator = $collector->getPaginatedTransactions();
|
$paginator = $collector->getPaginatedTransactions();
|
||||||
$paginator->setPath(route('api.v1.budgets.transactions', [$budget->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.transactions', [$budget->id]) . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -208,9 +208,7 @@ class BudgetLimitController extends Controller
|
|||||||
$paginator = $collector->getPaginatedTransactions();
|
$paginator = $collector->getPaginatedTransactions();
|
||||||
$paginator->setPath(route('api.v1.budget_limits.transactions', [$budgetLimit->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.budget_limits.transactions', [$budgetLimit->id]) . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -206,9 +206,7 @@ class CategoryController extends Controller
|
|||||||
$paginator = $collector->getPaginatedTransactions();
|
$paginator = $collector->getPaginatedTransactions();
|
||||||
$paginator->setPath(route('api.v1.categories.transactions', [$category->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.categories.transactions', [$category->id]) . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -195,8 +195,7 @@ class CurrencyController extends Controller
|
|||||||
$paginator->setPath(route('api.v1.currencies.transactions', [$currency->code]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.currencies.transactions', [$currency->code]) . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
$journalRepository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $journalRepository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -163,8 +163,7 @@ class ImportController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -218,9 +218,7 @@ class LinkTypeController extends Controller
|
|||||||
$paginator = $collector->getPaginatedTransactions();
|
$paginator = $collector->getPaginatedTransactions();
|
||||||
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -205,9 +205,7 @@ class RecurrenceController extends Controller
|
|||||||
$paginator = $collector->getPaginatedTransactions();
|
$paginator = $collector->getPaginatedTransactions();
|
||||||
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -222,9 +222,7 @@ class RuleController extends Controller
|
|||||||
$manager = new Manager();
|
$manager = new Manager();
|
||||||
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
||||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($matchingTransactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($matchingTransactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -269,10 +269,7 @@ class RuleGroupController extends Controller
|
|||||||
$manager = new Manager();
|
$manager = new Manager();
|
||||||
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
||||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($matchingTransactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
|
|
||||||
$resource = new FractalCollection($matchingTransactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -182,9 +182,7 @@ class TagController extends Controller
|
|||||||
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $repository), 'transactions');
|
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -171,7 +171,7 @@ class TransactionController extends Controller
|
|||||||
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $this->repository), 'transactions');
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
@@ -208,7 +208,7 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$transactions = $collector->getTransactions();
|
$transactions = $collector->getTransactions();
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $this->repository), 'transactions');
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$transactions = $collector->getTransactions();
|
$transactions = $collector->getTransactions();
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $this->repository), 'transactions');
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$transactions = $collector->getTransactions();
|
$transactions = $collector->getTransactions();
|
||||||
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters, $this->repository), 'transactions');
|
$resource = new FractalCollection($transactions, new TransactionTransformer($this->parameters), 'transactions');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ class CurrencyRequest extends Request
|
|||||||
break;
|
break;
|
||||||
case 'PUT':
|
case 'PUT':
|
||||||
case 'PATCH':
|
case 'PATCH':
|
||||||
$currency = $this->route()->parameter('currency');
|
$currency = $this->route()->parameter('currency_code');
|
||||||
$rules['name'] = 'required|between:1,255|unique:transaction_currencies,name,' . $currency->id;
|
$rules['name'] = 'required|between:1,255|unique:transaction_currencies,name,' . $currency->id;
|
||||||
$rules['code'] = 'required|between:1,255|unique:transaction_currencies,code,' . $currency->id;
|
$rules['code'] = 'required|between:1,255|unique:transaction_currencies,code,' . $currency->id;
|
||||||
$rules['symbol'] = 'required|between:1,255|unique:transaction_currencies,symbol,' . $currency->id;
|
$rules['symbol'] = 'required|between:1,255|unique:transaction_currencies,symbol,' . $currency->id;
|
||||||
|
@@ -102,9 +102,9 @@ class RuleRequest extends Request
|
|||||||
'trigger' => 'required|in:store-journal,update-journal',
|
'trigger' => 'required|in:store-journal,update-journal',
|
||||||
'triggers.*.name' => 'required|in:' . implode(',', $validTriggers),
|
'triggers.*.name' => 'required|in:' . implode(',', $validTriggers),
|
||||||
'triggers.*.stop_processing' => [new IsBoolean],
|
'triggers.*.stop_processing' => [new IsBoolean],
|
||||||
'triggers.*.value' => 'required_if:rule_actions.*.type,' . $contextTriggers . '|min:1|ruleTriggerValue',
|
'triggers.*.value' => 'required_if:actions.*.type,' . $contextTriggers . '|min:1|ruleTriggerValue',
|
||||||
'actions.*.name' => 'required|in:' . implode(',', $validActions),
|
'actions.*.name' => 'required|in:' . implode(',', $validActions),
|
||||||
'actions.*.value' => 'required_if:rule_actions.*.type,' . $contextActions . '|ruleActionValue',
|
'actions.*.value' => 'required_if:actions.*.type,' . $contextActions . '|ruleActionValue',
|
||||||
'actions.*.stop_processing' => [new IsBoolean],
|
'actions.*.stop_processing' => [new IsBoolean],
|
||||||
'strict' => [new IsBoolean],
|
'strict' => [new IsBoolean],
|
||||||
'stop_processing' => [new IsBoolean],
|
'stop_processing' => [new IsBoolean],
|
||||||
|
@@ -158,9 +158,9 @@ class EditController extends Controller
|
|||||||
{
|
{
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$actions = [];
|
$actions = [];
|
||||||
|
$currentActions = $rule->ruleActions()->orderBy('order','ASC')->get();
|
||||||
/** @var RuleAction $entry */
|
/** @var RuleAction $entry */
|
||||||
foreach ($rule->ruleActions as $entry) {
|
foreach ($currentActions as $entry) {
|
||||||
$count = ($index + 1);
|
$count = ($index + 1);
|
||||||
try {
|
try {
|
||||||
$actions[] = view(
|
$actions[] = view(
|
||||||
@@ -196,9 +196,9 @@ class EditController extends Controller
|
|||||||
{
|
{
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$triggers = [];
|
$triggers = [];
|
||||||
|
$currentTriggers = $rule->ruleTriggers()->orderBy('order','ASC')->get();
|
||||||
/** @var RuleTrigger $entry */
|
/** @var RuleTrigger $entry */
|
||||||
foreach ($rule->ruleTriggers as $entry) {
|
foreach ($currentTriggers as $entry) {
|
||||||
if ('user_action' !== $entry->trigger_type) {
|
if ('user_action' !== $entry->trigger_type) {
|
||||||
$count = ($index + 1);
|
$count = ($index + 1);
|
||||||
try {
|
try {
|
||||||
|
@@ -155,8 +155,8 @@ class SelectController extends Controller
|
|||||||
$strict = '1' === $request->get('strict');
|
$strict = '1' === $request->get('strict');
|
||||||
/** @var TransactionMatcher $matcher */
|
/** @var TransactionMatcher $matcher */
|
||||||
$matcher = app(TransactionMatcher::class);
|
$matcher = app(TransactionMatcher::class);
|
||||||
$matcher->setLimit($limit);
|
$matcher->setSearchLimit($range);
|
||||||
$matcher->setRange($range);
|
$matcher->setTriggeredLimit($limit);
|
||||||
$matcher->setTriggers($triggers);
|
$matcher->setTriggers($triggers);
|
||||||
$matcher->setStrict($strict);
|
$matcher->setStrict($strict);
|
||||||
try {
|
try {
|
||||||
@@ -222,8 +222,8 @@ class SelectController extends Controller
|
|||||||
|
|
||||||
/** @var TransactionMatcher $matcher */
|
/** @var TransactionMatcher $matcher */
|
||||||
$matcher = app(TransactionMatcher::class);
|
$matcher = app(TransactionMatcher::class);
|
||||||
$matcher->setLimit($limit);
|
$matcher->setTriggeredLimit($limit);
|
||||||
$matcher->setRange($range);
|
$matcher->setSearchLimit($range);
|
||||||
$matcher->setRule($rule);
|
$matcher->setRule($rule);
|
||||||
try {
|
try {
|
||||||
$matchingTransactions = $matcher->findTransactionsByRule();
|
$matchingTransactions = $matcher->findTransactionsByRule();
|
||||||
|
@@ -142,7 +142,7 @@ class MassController extends Controller
|
|||||||
|
|
||||||
$this->rememberPreviousUri('transactions.mass-edit.uri');
|
$this->rememberPreviousUri('transactions.mass-edit.uri');
|
||||||
|
|
||||||
$transformer = new TransactionTransformer(new ParameterBag, $this->repository);
|
$transformer = new TransactionTransformer(new ParameterBag);
|
||||||
/** @var TransactionCollectorInterface $collector */
|
/** @var TransactionCollectorInterface $collector */
|
||||||
$collector = app(TransactionCollectorInterface::class);
|
$collector = app(TransactionCollectorInterface::class);
|
||||||
$collector->setUser($user);
|
$collector->setUser($user);
|
||||||
|
@@ -253,7 +253,7 @@ class TransactionController extends Controller
|
|||||||
$collector->setJournals(new Collection([$journal]));
|
$collector->setJournals(new Collection([$journal]));
|
||||||
$set = $collector->getTransactions();
|
$set = $collector->getTransactions();
|
||||||
$transactions = [];
|
$transactions = [];
|
||||||
$transformer = new TransactionTransformer(new ParameterBag, $this->repository);
|
$transformer = new TransactionTransformer(new ParameterBag);
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$transactions[] = $transformer->transform($transaction);
|
$transactions[] = $transformer->transform($transaction);
|
||||||
|
@@ -58,8 +58,8 @@ class RuleFormRequest extends Request
|
|||||||
'description' => $this->string('description'),
|
'description' => $this->string('description'),
|
||||||
'stop_processing' => $this->boolean('stop_processing'),
|
'stop_processing' => $this->boolean('stop_processing'),
|
||||||
'strict' => $this->boolean('strict'),
|
'strict' => $this->boolean('strict'),
|
||||||
'rule_triggers' => $this->getRuleTriggerData(),
|
'triggers' => $this->getRuleTriggerData(),
|
||||||
'rule_actions' => $this->getRuleActionData(),
|
'actions' => $this->getRuleActionData(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@@ -83,16 +83,16 @@ class RuleFormRequest extends Request
|
|||||||
|
|
||||||
// initial set of rules:
|
// initial set of rules:
|
||||||
$rules = [
|
$rules = [
|
||||||
'title' => 'required|between:1,100|uniqueObjectForUser:rules,title',
|
'title' => 'required|between:1,100|uniqueObjectForUser:rules,title',
|
||||||
'description' => 'between:1,5000|nullable',
|
'description' => 'between:1,5000|nullable',
|
||||||
'stop_processing' => 'boolean',
|
'stop_processing' => 'boolean',
|
||||||
'rule_group_id' => 'required|belongsToUser:rule_groups',
|
'rule_group_id' => 'required|belongsToUser:rule_groups',
|
||||||
'trigger' => 'required|in:store-journal,update-journal',
|
'trigger' => 'required|in:store-journal,update-journal',
|
||||||
'rule_triggers.*.name' => 'required|in:' . implode(',', $validTriggers),
|
'triggers.*.name' => 'required|in:' . implode(',', $validTriggers),
|
||||||
'rule_triggers.*.value' => sprintf('required_if:rule_triggers.*.name,%s|min:1|ruleTriggerValue', $contextTriggers),
|
'triggers.*.value' => sprintf('required_if:triggers.*.name,%s|min:1|ruleTriggerValue', $contextTriggers),
|
||||||
'rule-actions.*.name' => 'required|in:' . implode(',', $validActions),
|
'actions.*.name' => 'required|in:' . implode(',', $validActions),
|
||||||
'rule_actions.*.value' => sprintf('required_if:rule_actions.*.name,%s|min:1|ruleActionValue', $contextActions),
|
'actions.*.value' => sprintf('required_if:actions.*.name,%s|min:1|ruleActionValue', $contextActions),
|
||||||
'strict' => 'in:0,1',
|
'strict' => 'in:0,1',
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var Rule $rule */
|
/** @var Rule $rule */
|
||||||
@@ -111,7 +111,7 @@ class RuleFormRequest extends Request
|
|||||||
private function getRuleActionData(): array
|
private function getRuleActionData(): array
|
||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
$actionData = $this->get('rule_actions');
|
$actionData = $this->get('actions');
|
||||||
if (\is_array($actionData)) {
|
if (\is_array($actionData)) {
|
||||||
foreach ($actionData as $action) {
|
foreach ($actionData as $action) {
|
||||||
$stopProcessing = $action['stop_processing'] ?? '0';
|
$stopProcessing = $action['stop_processing'] ?? '0';
|
||||||
@@ -132,7 +132,7 @@ class RuleFormRequest extends Request
|
|||||||
private function getRuleTriggerData(): array
|
private function getRuleTriggerData(): array
|
||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
$triggerData = $this->get('rule_triggers');
|
$triggerData = $this->get('triggers');
|
||||||
if (\is_array($triggerData)) {
|
if (\is_array($triggerData)) {
|
||||||
foreach ($triggerData as $trigger) {
|
foreach ($triggerData as $trigger) {
|
||||||
$stopProcessing = $trigger['stop_processing'] ?? '0';
|
$stopProcessing = $trigger['stop_processing'] ?? '0';
|
||||||
|
@@ -42,6 +42,7 @@ class TestRuleFormRequest extends Request
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Rules for this request.
|
* Rules for this request.
|
||||||
|
* TODO these rules are not valid anymore.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@@ -222,7 +222,6 @@ trait RequestInformation
|
|||||||
*/
|
*/
|
||||||
protected function getTransactionDataFromJournal(TransactionJournal $journal): array // convert object
|
protected function getTransactionDataFromJournal(TransactionJournal $journal): array // convert object
|
||||||
{
|
{
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
|
||||||
// use collector to collect transactions.
|
// use collector to collect transactions.
|
||||||
$collector = app(TransactionCollectorInterface::class);
|
$collector = app(TransactionCollectorInterface::class);
|
||||||
$collector->setUser(auth()->user());
|
$collector->setUser(auth()->user());
|
||||||
@@ -231,7 +230,7 @@ trait RequestInformation
|
|||||||
$collector->setJournals(new Collection([$journal]));
|
$collector->setJournals(new Collection([$journal]));
|
||||||
$set = $collector->getTransactions();
|
$set = $collector->getTransactions();
|
||||||
$transactions = [];
|
$transactions = [];
|
||||||
$transformer = new TransactionTransformer(new ParameterBag, $repository);
|
$transformer = new TransactionTransformer(new ParameterBag);
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$res = [];
|
$res = [];
|
||||||
@@ -262,7 +261,7 @@ trait RequestInformation
|
|||||||
protected function getValidTriggerList(TestRuleFormRequest $request): array // process input
|
protected function getValidTriggerList(TestRuleFormRequest $request): array // process input
|
||||||
{
|
{
|
||||||
$triggers = [];
|
$triggers = [];
|
||||||
$data = $request->get('rule_triggers');
|
$data = $request->get('triggers');
|
||||||
if (\is_array($data)) {
|
if (\is_array($data)) {
|
||||||
foreach ($data as $index => $triggerInfo) {
|
foreach ($data as $index => $triggerInfo) {
|
||||||
$triggers[] = [
|
$triggers[] = [
|
||||||
|
@@ -51,7 +51,8 @@ trait RuleManagement
|
|||||||
'description' => (string)trans('firefly.default_rule_description'),
|
'description' => (string)trans('firefly.default_rule_description'),
|
||||||
'trigger' => 'store-journal',
|
'trigger' => 'store-journal',
|
||||||
'strict' => true,
|
'strict' => true,
|
||||||
'rule_triggers' => [
|
'active' => true,
|
||||||
|
'triggers' => [
|
||||||
[
|
[
|
||||||
'name' => 'description_is',
|
'name' => 'description_is',
|
||||||
'value' => (string)trans('firefly.default_rule_trigger_description'),
|
'value' => (string)trans('firefly.default_rule_trigger_description'),
|
||||||
@@ -66,7 +67,7 @@ trait RuleManagement
|
|||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'rule_actions' => [
|
'actions' => [
|
||||||
[
|
[
|
||||||
'name' => 'prepend_description',
|
'name' => 'prepend_description',
|
||||||
'value' => (string)trans('firefly.default_rule_action_prepend'),
|
'value' => (string)trans('firefly.default_rule_action_prepend'),
|
||||||
@@ -94,7 +95,7 @@ trait RuleManagement
|
|||||||
{
|
{
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$triggers = [];
|
$triggers = [];
|
||||||
$oldInput = $request->old('rule_actions');
|
$oldInput = $request->old('actions');
|
||||||
if (\is_array($oldInput)) {
|
if (\is_array($oldInput)) {
|
||||||
foreach ($oldInput as $oldAction) {
|
foreach ($oldInput as $oldAction) {
|
||||||
try {
|
try {
|
||||||
@@ -127,7 +128,7 @@ trait RuleManagement
|
|||||||
{
|
{
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$triggers = [];
|
$triggers = [];
|
||||||
$oldInput = $request->old('rule_triggers');
|
$oldInput = $request->old('triggers');
|
||||||
if (\is_array($oldInput)) {
|
if (\is_array($oldInput)) {
|
||||||
foreach ($oldInput as $oldTrigger) {
|
foreach ($oldInput as $oldTrigger) {
|
||||||
try {
|
try {
|
||||||
@@ -162,6 +163,7 @@ trait RuleManagement
|
|||||||
$data = [
|
$data = [
|
||||||
'title' => (string)trans('firefly.default_rule_group_name'),
|
'title' => (string)trans('firefly.default_rule_group_name'),
|
||||||
'description' => (string)trans('firefly.default_rule_group_description'),
|
'description' => (string)trans('firefly.default_rule_group_description'),
|
||||||
|
'active' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
$repository->store($data);
|
$repository->store($data);
|
||||||
|
@@ -120,8 +120,8 @@ class AccountTransformer extends TransformerAbstract
|
|||||||
'id' => (int)$account->id,
|
'id' => (int)$account->id,
|
||||||
'updated_at' => $account->updated_at->toAtomString(),
|
'updated_at' => $account->updated_at->toAtomString(),
|
||||||
'created_at' => $account->created_at->toAtomString(),
|
'created_at' => $account->created_at->toAtomString(),
|
||||||
'name' => $account->name,
|
|
||||||
'active' => 1 === (int)$account->active,
|
'active' => 1 === (int)$account->active,
|
||||||
|
'name' => $account->name,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'account_role' => $role,
|
'account_role' => $role,
|
||||||
'currency_id' => $currencyId,
|
'currency_id' => $currencyId,
|
||||||
|
@@ -51,10 +51,10 @@ class TransactionTransformer extends TransformerAbstract
|
|||||||
* @param ParameterBag $parameters
|
* @param ParameterBag $parameters
|
||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters, JournalRepositoryInterface $repository)
|
public function __construct(ParameterBag $parameters)
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
$this->parameters = $parameters;
|
||||||
$this->repository = $repository;
|
$this->repository = app(JournalRepositoryInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -306,7 +306,7 @@ class FireflyValidator extends Validator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $attribute has the format rule_triggers.%d.value.
|
* $attribute has the format triggers.%d.value.
|
||||||
*
|
*
|
||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
* @param string $value
|
* @param string $value
|
||||||
|
8
public/v1/js/ff/rules/create-edit.js
vendored
8
public/v1/js/ff/rules/create-edit.js
vendored
@@ -162,7 +162,7 @@ function onAddNewAction() {
|
|||||||
"use strict";
|
"use strict";
|
||||||
console.log('Now in onAddNewAction()');
|
console.log('Now in onAddNewAction()');
|
||||||
|
|
||||||
var selectQuery = 'select[name^="rule_actions["][name$="][name]"]';
|
var selectQuery = 'select[name^="actions["][name$="][name]"]';
|
||||||
var selectResult = $(selectQuery);
|
var selectResult = $(selectQuery);
|
||||||
|
|
||||||
console.log('Select query is "' + selectQuery + '" and the result length is ' + selectResult.length);
|
console.log('Select query is "' + selectQuery + '" and the result length is ' + selectResult.length);
|
||||||
@@ -190,7 +190,7 @@ function onAddNewTrigger() {
|
|||||||
"use strict";
|
"use strict";
|
||||||
console.log('Now in onAddNewTrigger()');
|
console.log('Now in onAddNewTrigger()');
|
||||||
|
|
||||||
var selectQuery = 'select[name^="rule_triggers["][name$="][name]"]';
|
var selectQuery = 'select[name^="triggers["][name$="][name]"]';
|
||||||
var selectResult = $(selectQuery);
|
var selectResult = $(selectQuery);
|
||||||
|
|
||||||
console.log('Select query is "' + selectQuery + '" and the result length is ' + selectResult.length);
|
console.log('Select query is "' + selectQuery + '" and the result length is ' + selectResult.length);
|
||||||
@@ -219,7 +219,7 @@ function updateActionInput(selectList) {
|
|||||||
// the actual row this select list is in:
|
// the actual row this select list is in:
|
||||||
var parent = selectList.parent().parent();
|
var parent = selectList.parent().parent();
|
||||||
// the text input we're looking for:
|
// the text input we're looking for:
|
||||||
var inputQuery = 'input[name^="rule_actions["][name$="][value]"]';
|
var inputQuery = 'input[name^="actions["][name$="][value]"]';
|
||||||
var inputResult = parent.find(inputQuery);
|
var inputResult = parent.find(inputQuery);
|
||||||
|
|
||||||
console.log('Searching for children in this row with query "' + inputQuery + '" resulted in ' + inputResult.length + ' results.');
|
console.log('Searching for children in this row with query "' + inputQuery + '" resulted in ' + inputResult.length + ' results.');
|
||||||
@@ -291,7 +291,7 @@ function updateTriggerInput(selectList) {
|
|||||||
// the actual row this select list is in:
|
// the actual row this select list is in:
|
||||||
var parent = selectList.parent().parent();
|
var parent = selectList.parent().parent();
|
||||||
// the text input we're looking for:
|
// the text input we're looking for:
|
||||||
var inputQuery = 'input[name^="rule_triggers["][name$="][value]"]';
|
var inputQuery = 'input[name^="triggers["][name$="][value]"]';
|
||||||
var inputResult = parent.find(inputQuery);
|
var inputResult = parent.find(inputQuery);
|
||||||
|
|
||||||
console.log('Searching for children in this row with query "' + inputQuery + '" resulted in ' + inputResult.length + ' results.');
|
console.log('Searching for children in this row with query "' + inputQuery + '" resulted in ' + inputResult.length + ' results.');
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td style="width:30%;">
|
<td style="width:30%;">
|
||||||
{# todo error when invalid name. #}
|
{# todo error when invalid name. #}
|
||||||
<select name="rule_actions[{{ count }}][name]" class="form-control">
|
<select name="actions[{{ count }}][name]" class="form-control">
|
||||||
{% for key,name in allRuleActions() %}
|
{% for key,name in allRuleActions() %}
|
||||||
<option value="{{ key }}" label="{{ name }}" {% if key == oldAction %} selected{% endif %}>{{ name }}</option>
|
<option value="{{ key }}" label="{{ name }}" {% if key == oldAction %} selected{% endif %}>{{ name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -12,18 +12,18 @@
|
|||||||
</td>
|
</td>
|
||||||
<td style="position: relative;">
|
<td style="position: relative;">
|
||||||
|
|
||||||
<input autocomplete="off" type="text" value="{{ oldValue }}" name="rule_actions[{{ count }}][value]"
|
<input autocomplete="off" type="text" value="{{ oldValue }}" name="actions[{{ count }}][value]"
|
||||||
class="form-control">
|
class="form-control">
|
||||||
{% if errors.has('rule_actions.'~count~'.value') %}
|
{% if errors.has('actions.'~count~'.value') %}
|
||||||
<p class="text-danger">
|
<p class="text-danger">
|
||||||
{{ errors.first('rule_actions.'~count~'.value') }}
|
{{ errors.first('actions.'~count~'.value') }}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%;">
|
<td style="width:20%;">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="rule_actions[{{ count }}][stop_processing]" value="1"
|
<input type="checkbox" name="actions[{{ count }}][stop_processing]" value="1"
|
||||||
{% if oldChecked %}checked{% endif %}
|
{% if oldChecked %}checked{% endif %}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
@@ -3,14 +3,7 @@
|
|||||||
<a href="#" class="btn btn-danger btn-sm remove-trigger"><i class="fa fa-trash"></i></a>
|
<a href="#" class="btn btn-danger btn-sm remove-trigger"><i class="fa fa-trash"></i></a>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:30%;">
|
<td style="width:30%;">
|
||||||
{#
|
<select name="triggers[{{ count }}][name]" class="form-control">
|
||||||
{% if errors.has('rule-trigger.'~count) %}
|
|
||||||
<span class="form-control-feedback"><i class="fa fa-fw fa-remove"></i></span>
|
|
||||||
<p class="text-danger">{{ errors.first('rule-trigger.'~count) }}</p>
|
|
||||||
{% endif %}
|
|
||||||
#}
|
|
||||||
|
|
||||||
<select name="rule_triggers[{{ count }}][name]" class="form-control">
|
|
||||||
{% for key,name in allRuleTriggers() %}
|
{% for key,name in allRuleTriggers() %}
|
||||||
<option value="{{ key }}" label="{{ name }}"
|
<option value="{{ key }}" label="{{ name }}"
|
||||||
{% if key == oldTrigger %}
|
{% if key == oldTrigger %}
|
||||||
@@ -22,17 +15,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td style="position: relative;">
|
<td style="position: relative;">
|
||||||
|
|
||||||
<input autocomplete="off" type="text" value="{{ oldValue }}" name="rule_triggers[{{ count }}][value]" class="form-control">
|
<input autocomplete="off" type="text" value="{{ oldValue }}" name="triggers[{{ count }}][value]" class="form-control">
|
||||||
{% if errors.has('rule_triggers.'~count~'.value') %}
|
{% if errors.has('triggers.'~count~'.value') %}
|
||||||
<p class="text-danger">
|
<p class="text-danger">
|
||||||
{{ errors.first('rule_triggers.'~count~'.value') }}
|
{{ errors.first('triggers.'~count~'.value') }}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%;">
|
<td style="width:20%;">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="rule_triggers[{{ count }}][stop_processing]" value="1"
|
<input type="checkbox" name="triggers[{{ count }}][stop_processing]" value="1"
|
||||||
{% if oldChecked %}checked{% endif %}
|
{% if oldChecked %}checked{% endif %}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
@@ -184,8 +184,9 @@ class AccountControllerTest extends TestCase
|
|||||||
[
|
[
|
||||||
'message' => 'The given data was invalid.',
|
'message' => 'The given data was invalid.',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'cc_monthly_payment_date' => ['The cc monthly payment date field is required when account role is ccAsset.'],
|
'credit_card_type' => ['The credit card type field is required when account role is ccAsset.'],
|
||||||
'cc_type' => ['The cc type field is required when account role is ccAsset.'],
|
'monthly_payment_date' => ['The monthly payment date field is required when account role is ccAsset.'],
|
||||||
|
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@@ -72,7 +72,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->delete('/api/v1/budget_limits/' . $budgetLimit->id);
|
$response = $this->delete('/api/v1/budgets/limits/' . $budgetLimit->id);
|
||||||
$response->assertStatus(204);
|
$response->assertStatus(204);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$params = [
|
$params = [
|
||||||
'budget_id' => $budget->id,
|
'budget_id' => $budget->id,
|
||||||
];
|
];
|
||||||
$response = $this->get('/api/v1/budget_limits?' . http_build_query($params));
|
$response = $this->get('/api/v1/budgets/limits?' . http_build_query($params));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
'start' => '2018-01-01',
|
'start' => '2018-01-01',
|
||||||
'end' => '2018-01-31',
|
'end' => '2018-01-31',
|
||||||
];
|
];
|
||||||
$uri = '/api/v1/budget_limits?' . http_build_query($params);
|
$uri = '/api/v1/budgets/limits?' . http_build_query($params);
|
||||||
$response = $this->get($uri);
|
$response = $this->get($uri);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
@@ -153,7 +153,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
'start' => '2018-01-01',
|
'start' => '2018-01-01',
|
||||||
'end' => '2018-01-31',
|
'end' => '2018-01-31',
|
||||||
];
|
];
|
||||||
$response = $this->get('/api/v1/budget_limits?' . http_build_query($params));
|
$response = $this->get('/api/v1/budgets/limits?' . http_build_query($params));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
@@ -174,15 +174,15 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$budget = $this->user()->budgets()->first();
|
$budget = $this->user()->budgets()->first();
|
||||||
$budgetLimit = BudgetLimit::create(
|
$budgetLimit = BudgetLimit::create(
|
||||||
[
|
[
|
||||||
'budget_id' => $budget->id,
|
'budget_id' => $budget->id,
|
||||||
'start_date' => '2018-01-01',
|
'start_date' => '2018-01-01',
|
||||||
'end_date' => '2018-01-31',
|
'end_date' => '2018-01-31',
|
||||||
'amount' => 1,
|
'amount' => 1,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$response = $this->get('/api/v1/budget_limits/' . $budgetLimit->id);
|
$response = $this->get('/api/v1/budgets/limits/' . $budgetLimit->id);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
@@ -198,18 +198,18 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$budget = $this->user()->budgets()->first();
|
$budget = $this->user()->budgets()->first();
|
||||||
$budgetLimit = BudgetLimit::create(
|
$budgetLimit = BudgetLimit::create(
|
||||||
[
|
[
|
||||||
'budget_id' => $budget->id,
|
'budget_id' => $budget->id,
|
||||||
'start_date' => '2018-01-01',
|
'start_date' => '2018-01-01',
|
||||||
'end_date' => '2018-01-31',
|
'end_date' => '2018-01-31',
|
||||||
'amount' => 1,
|
'amount' => 1,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$data
|
$data
|
||||||
= [
|
= [
|
||||||
'budget_id' => $budget->id,
|
'budget_id' => $budget->id,
|
||||||
'start_date' => '2018-01-01',
|
'start' => '2018-01-01',
|
||||||
'end_date' => '2018-01-31',
|
'end' => '2018-01-31',
|
||||||
'amount' => 1,
|
'amount' => 1,
|
||||||
];
|
];
|
||||||
// mock stuff:
|
// mock stuff:
|
||||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
@@ -221,7 +221,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->once();
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->post('/api/v1/budget_limits', $data);
|
$response = $this->post('/api/v1/budgets/limits', $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
@@ -236,10 +236,10 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$data
|
$data
|
||||||
= [
|
= [
|
||||||
'budget_id' => '1',
|
'budget_id' => '1',
|
||||||
'start_date' => '2018-01-01',
|
'start' => '2018-01-01',
|
||||||
'end_date' => '2018-01-31',
|
'end' => '2018-01-31',
|
||||||
'amount' => 1,
|
'amount' => 1,
|
||||||
];
|
];
|
||||||
// mock stuff:
|
// mock stuff:
|
||||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
@@ -250,7 +250,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->once();
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->post('/api/v1/budget_limits', $data);
|
$response = $this->post('/api/v1/budgets/limits', $data);
|
||||||
$response->assertStatus(500);
|
$response->assertStatus(500);
|
||||||
$response->assertSee('Unknown budget.');
|
$response->assertSee('Unknown budget.');
|
||||||
}
|
}
|
||||||
@@ -266,18 +266,18 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$budget = $this->user()->budgets()->first();
|
$budget = $this->user()->budgets()->first();
|
||||||
$budgetLimit = BudgetLimit::create(
|
$budgetLimit = BudgetLimit::create(
|
||||||
[
|
[
|
||||||
'budget_id' => $budget->id,
|
'budget_id' => $budget->id,
|
||||||
'start_date' => '2018-01-01',
|
'start_date' => '2018-01-01',
|
||||||
'end_date' => '2018-01-31',
|
'end_date' => '2018-01-31',
|
||||||
'amount' => 1,
|
'amount' => 1,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$data
|
$data
|
||||||
= [
|
= [
|
||||||
'budget_id' => $budget->id,
|
'budget_id' => $budget->id,
|
||||||
'start_date' => '2018-01-01',
|
'start' => '2018-01-01',
|
||||||
'end_date' => '2018-01-31',
|
'end' => '2018-01-31',
|
||||||
'amount' => 2,
|
'amount' => 2,
|
||||||
];
|
];
|
||||||
// mock stuff:
|
// mock stuff:
|
||||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
@@ -289,7 +289,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->once();
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->put('/api/v1/budget_limits/' . $budgetLimit->id, $data);
|
$response = $this->put('/api/v1/budgets/limits/' . $budgetLimit->id, $data);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
|
|
||||||
@@ -314,10 +314,10 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
);
|
);
|
||||||
$data
|
$data
|
||||||
= [
|
= [
|
||||||
'budget_id' => $budget->id,
|
'budget_id' => $budget->id,
|
||||||
'start_date' => '2018-01-01',
|
'start' => '2018-01-01',
|
||||||
'end_date' => '2018-01-31',
|
'end' => '2018-01-31',
|
||||||
'amount' => 2,
|
'amount' => 2,
|
||||||
];
|
];
|
||||||
// mock stuff:
|
// mock stuff:
|
||||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
@@ -328,7 +328,7 @@ class BudgetLimitControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->once();
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->put('/api/v1/budget_limits/' . $budgetLimit->id, $data);
|
$response = $this->put('/api/v1/budgets/limits/' . $budgetLimit->id, $data);
|
||||||
$response->assertStatus(500);
|
$response->assertStatus(500);
|
||||||
$response->assertSee('Unknown budget.');
|
$response->assertSee('Unknown budget.');
|
||||||
}
|
}
|
||||||
|
@@ -120,7 +120,6 @@ class ConfigurationControllerTest extends TestCase
|
|||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||||
$data = [
|
$data = [
|
||||||
'name' => 'permission_update_check',
|
|
||||||
'value' => 1,
|
'value' => 1,
|
||||||
|
|
||||||
];
|
];
|
||||||
@@ -157,7 +156,7 @@ class ConfigurationControllerTest extends TestCase
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->post('/api/v1/configuration', $data);
|
$response = $this->post('/api/v1/configuration/permission_update_check', $data);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertExactJson($expected);
|
$response->assertExactJson($expected);
|
||||||
}
|
}
|
||||||
@@ -173,7 +172,6 @@ class ConfigurationControllerTest extends TestCase
|
|||||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'name' => 'single_user_mode',
|
|
||||||
'value' => 'true',
|
'value' => 'true',
|
||||||
|
|
||||||
];
|
];
|
||||||
@@ -210,7 +208,7 @@ class ConfigurationControllerTest extends TestCase
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->post('/api/v1/configuration', $data);
|
$response = $this->post('/api/v1/configuration/single_user_mode', $data);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertExactJson($expected);
|
$response->assertExactJson($expected);
|
||||||
}
|
}
|
||||||
@@ -223,14 +221,11 @@ class ConfigurationControllerTest extends TestCase
|
|||||||
public function testUpdateInvalid(): void
|
public function testUpdateInvalid(): void
|
||||||
{
|
{
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
|
||||||
$data = [
|
$data = [
|
||||||
'name' => 'last_update_check',
|
|
||||||
'value' => 'true',
|
'value' => 'true',
|
||||||
];
|
];
|
||||||
$response = $this->post('/api/v1/configuration', $data);
|
$response = $this->post('/api/v1/configuration/last_update_check', $data);
|
||||||
$response->assertStatus(500);
|
$response->assertStatus(404);
|
||||||
$response->assertSee('You cannot edit this configuration value.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -244,7 +239,7 @@ class ConfigurationControllerTest extends TestCase
|
|||||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(false);
|
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(false);
|
||||||
|
|
||||||
Passport::actingAs($this->emptyUser());
|
Passport::actingAs($this->emptyUser());
|
||||||
$response = $this->post('/api/v1/configuration');
|
$response = $this->post('/api/v1/configuration/single_user_mode');
|
||||||
$response->assertStatus(500);
|
$response->assertStatus(500);
|
||||||
$response->assertSee('No access to method.');
|
$response->assertSee('No access to method.');
|
||||||
}
|
}
|
||||||
|
@@ -73,7 +73,7 @@ class CurrencyControllerTest extends TestCase
|
|||||||
$currency = TransactionCurrency::first();
|
$currency = TransactionCurrency::first();
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->delete('/api/v1/currencies/' . $currency->id);
|
$response = $this->delete('/api/v1/currencies/' . $currency->code);
|
||||||
$response->assertStatus(204);
|
$response->assertStatus(204);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ class CurrencyControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->once();
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->get('/api/v1/currencies/' . $currency->id);
|
$response = $this->get('/api/v1/currencies/' . $currency->code);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertJson(
|
$response->assertJson(
|
||||||
['data' => [
|
['data' => [
|
||||||
@@ -245,7 +245,7 @@ class CurrencyControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->put('/api/v1/currencies/' . $currency->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/currencies/' . $currency->code, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
@@ -285,7 +285,7 @@ class CurrencyControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->put('/api/v1/currencies/' . $currency->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/currencies/' . $currency->code, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
|
@@ -66,16 +66,6 @@ class PreferencesControllerTest extends TestCase
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testShow(): void
|
|
||||||
{
|
|
||||||
/** @var Preference $preference */
|
|
||||||
$preference = $this->user()->preferences()->first();
|
|
||||||
|
|
||||||
$response = $this->get('/api/v1/preferences/' . $preference->id);
|
|
||||||
$response->assertStatus(200);
|
|
||||||
$response->assertSee($preference->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\PreferenceController
|
* @covers \FireflyIII\Api\V1\Controllers\PreferenceController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\PreferenceRequest
|
* @covers \FireflyIII\Api\V1\Requests\PreferenceRequest
|
||||||
@@ -85,7 +75,7 @@ class PreferencesControllerTest extends TestCase
|
|||||||
/** @var Preference $preference */
|
/** @var Preference $preference */
|
||||||
$preference = Preferences::setForUser($this->user(), 'frontPageAccounts', [1, 2, 3]);
|
$preference = Preferences::setForUser($this->user(), 'frontPageAccounts', [1, 2, 3]);
|
||||||
$data = ['data' => '4,5,6'];
|
$data = ['data' => '4,5,6'];
|
||||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertSee($preference->name);
|
$response->assertSee($preference->name);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
@@ -100,7 +90,7 @@ class PreferencesControllerTest extends TestCase
|
|||||||
/** @var Preference $preference */
|
/** @var Preference $preference */
|
||||||
$preference = Preferences::setForUser($this->user(), 'twoFactorAuthEnabled', false);
|
$preference = Preferences::setForUser($this->user(), 'twoFactorAuthEnabled', false);
|
||||||
$data = ['data' => '1'];
|
$data = ['data' => '1'];
|
||||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertSee($preference->name);
|
$response->assertSee($preference->name);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
@@ -115,7 +105,7 @@ class PreferencesControllerTest extends TestCase
|
|||||||
/** @var Preference $preference */
|
/** @var Preference $preference */
|
||||||
$preference = Preferences::setForUser($this->user(), 'currencyPreference', false);
|
$preference = Preferences::setForUser($this->user(), 'currencyPreference', false);
|
||||||
$data = ['data' => 'EUR'];
|
$data = ['data' => 'EUR'];
|
||||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertSee($preference->name);
|
$response->assertSee($preference->name);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
@@ -130,7 +120,7 @@ class PreferencesControllerTest extends TestCase
|
|||||||
/** @var Preference $preference */
|
/** @var Preference $preference */
|
||||||
$preference = Preferences::setForUser($this->user(), 'listPageSize', 13);
|
$preference = Preferences::setForUser($this->user(), 'listPageSize', 13);
|
||||||
$data = ['data' => '434'];
|
$data = ['data' => '434'];
|
||||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertSee($preference->name);
|
$response->assertSee($preference->name);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
@@ -118,14 +118,14 @@ class RuleControllerTest extends TestCase
|
|||||||
'strict' => 1,
|
'strict' => 1,
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
'rule_triggers' => [
|
'triggers' => [
|
||||||
[
|
[
|
||||||
'name' => 'description_is',
|
'name' => 'description_is',
|
||||||
'value' => 'Hello',
|
'value' => 'Hello',
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'rule_actions' => [
|
'actions' => [
|
||||||
[
|
[
|
||||||
'name' => 'add_tag',
|
'name' => 'add_tag',
|
||||||
'value' => 'A',
|
'value' => 'A',
|
||||||
@@ -158,14 +158,14 @@ class RuleControllerTest extends TestCase
|
|||||||
'strict' => 1,
|
'strict' => 1,
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
'rule_triggers' => [
|
'triggers' => [
|
||||||
[
|
[
|
||||||
'name' => 'description_is',
|
'name' => 'description_is',
|
||||||
'value' => 'Hello',
|
'value' => 'Hello',
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'rule_actions' => [
|
'actions' => [
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -190,9 +190,9 @@ class RuleControllerTest extends TestCase
|
|||||||
'strict' => 1,
|
'strict' => 1,
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
'rule_triggers' => [
|
'triggers' => [
|
||||||
],
|
],
|
||||||
'rule_actions' => [
|
'actions' => [
|
||||||
[
|
[
|
||||||
'name' => 'add_tag',
|
'name' => 'add_tag',
|
||||||
'value' => 'A',
|
'value' => 'A',
|
||||||
@@ -225,14 +225,14 @@ class RuleControllerTest extends TestCase
|
|||||||
'strict' => 1,
|
'strict' => 1,
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
'rule_triggers' => [
|
'triggers' => [
|
||||||
[
|
[
|
||||||
'name' => 'description_is',
|
'name' => 'description_is',
|
||||||
'value' => 'Hello',
|
'value' => 'Hello',
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'rule_actions' => [
|
'actions' => [
|
||||||
[
|
[
|
||||||
'name' => 'add_tag',
|
'name' => 'add_tag',
|
||||||
'value' => 'A',
|
'value' => 'A',
|
||||||
|
@@ -1231,7 +1231,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
|
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||||
@@ -1242,6 +1244,8 @@ class TransactionControllerTest extends TestCase
|
|||||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||||
|
|
||||||
|
|
||||||
$collector->shouldReceive('getPaginatedTransactions')->andReturn($paginator);
|
$collector->shouldReceive('getPaginatedTransactions')->andReturn($paginator);
|
||||||
|
|
||||||
|
|
||||||
@@ -1284,6 +1288,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
|
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||||
@@ -1351,6 +1358,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
|
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||||
@@ -1410,6 +1420,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
|
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||||
@@ -1461,6 +1474,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1508,6 +1524,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1554,6 +1573,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1601,6 +1623,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1646,6 +1671,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1692,6 +1720,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection);
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection);
|
||||||
$accountRepos->shouldReceive('findByName')->andReturn($account);
|
$accountRepos->shouldReceive('findByName')->andReturn($account);
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1738,6 +1769,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1783,6 +1817,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1829,6 +1866,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1876,6 +1916,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1922,6 +1965,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -1975,6 +2021,10 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'description' => 'Some transaction #' . random_int(1, 10000),
|
'description' => 'Some transaction #' . random_int(1, 10000),
|
||||||
'date' => '2018-01-01',
|
'date' => '2018-01-01',
|
||||||
@@ -2014,6 +2064,10 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2066,6 +2120,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2113,6 +2170,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2160,6 +2220,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2206,6 +2269,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2252,6 +2318,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2298,6 +2367,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2345,6 +2417,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$source]), new Collection([$dest]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$source]), new Collection([$dest]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2391,6 +2466,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$source]), new Collection([$dest]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$source]), new Collection([$dest]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2435,6 +2513,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2480,6 +2561,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2539,6 +2623,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$accountRepos->shouldReceive('setUser');
|
$accountRepos->shouldReceive('setUser');
|
||||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->expectsEvents(StoredTransactionJournal::class);
|
$this->expectsEvents(StoredTransactionJournal::class);
|
||||||
@@ -2604,6 +2691,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$transaction = $deposit->transactions()->first();
|
$transaction = $deposit->transactions()->first();
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
$repository->shouldReceive('update')->andReturn($deposit)->once();
|
$repository->shouldReceive('update')->andReturn($deposit)->once();
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$repository->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$repository->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->put('/api/v1/transactions/' . $transaction->id, $data);
|
$response = $this->put('/api/v1/transactions/' . $transaction->id, $data);
|
||||||
@@ -2648,6 +2738,9 @@ class TransactionControllerTest extends TestCase
|
|||||||
$transaction = $withdrawal->transactions()->first();
|
$transaction = $withdrawal->transactions()->first();
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
$repository->shouldReceive('update')->andReturn($withdrawal)->once();
|
$repository->shouldReceive('update')->andReturn($withdrawal)->once();
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Note');
|
||||||
|
$repository->shouldReceive('getMetaField')->andReturn(null);
|
||||||
|
$repository->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->put('/api/v1/transactions/' . $transaction->id, $data);
|
$response = $this->put('/api/v1/transactions/' . $transaction->id, $data);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* JournalLinkControllerTest.php
|
* TransactionLinkControllerTest.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
*
|
*
|
||||||
* This file is part of Firefly III.
|
* This file is part of Firefly III.
|
||||||
@@ -37,9 +37,9 @@ use Tests\TestCase;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Class JournalLinkControllerTest
|
* Class TransactionLinkControllerTest
|
||||||
*/
|
*/
|
||||||
class JournalLinkControllerTest extends TestCase
|
class TransactionLinkControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -53,7 +53,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
*/
|
*/
|
||||||
public function testDelete(): void
|
public function testDelete(): void
|
||||||
{
|
{
|
||||||
@@ -71,12 +71,12 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
$journalLink = TransactionJournalLink::first();
|
$journalLink = TransactionJournalLink::first();
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->delete('/api/v1/journal_links/' . $journalLink->id);
|
$response = $this->delete('/api/v1/transaction_links/' . $journalLink->id);
|
||||||
$response->assertStatus(204);
|
$response->assertStatus(204);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
*/
|
*/
|
||||||
public function testIndex(): void
|
public function testIndex(): void
|
||||||
{
|
{
|
||||||
@@ -104,13 +104,13 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
|
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->get('/api/v1/journal_links');
|
$response = $this->get('/api/v1/transaction_links');
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee($journalLinks->first()->id);
|
$response->assertSee($journalLinks->first()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
*/
|
*/
|
||||||
public function testShow(): void
|
public function testShow(): void
|
||||||
{
|
{
|
||||||
@@ -135,13 +135,13 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
|
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
|
||||||
|
|
||||||
// call API
|
// call API
|
||||||
$response = $this->get('/api/v1/journal_links/' . $journalLink->id);
|
$response = $this->get('/api/v1/transaction_links/' . $journalLink->id);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee($journalLink->id);
|
$response->assertSee($journalLink->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testStore(): void
|
public function testStore(): void
|
||||||
@@ -183,7 +183,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->post('/api/v1/journal_links', $data);
|
$response = $this->post('/api/v1/transaction_links', $data);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee($journalLink->created_at->toAtomString()); // the creation moment.
|
$response->assertSee($journalLink->created_at->toAtomString()); // the creation moment.
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
@@ -192,7 +192,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* In this particular test the journal link request will fail.
|
* In this particular test the journal link request will fail.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreExistingLink(): void
|
public function testStoreExistingLink(): void
|
||||||
@@ -233,7 +233,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
$response->assertSee('Already have a link between inward and outward.');
|
$response->assertSee('Already have a link between inward and outward.');
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* In this particular test the JournalLinkRequest will report the failure.
|
* In this particular test the JournalLinkRequest will report the failure.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreInvalidInward(): void
|
public function testStoreInvalidInward(): void
|
||||||
@@ -285,7 +285,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||||
$response->assertSee('Invalid inward ID.'); // the creation moment.
|
$response->assertSee('Invalid inward ID.'); // the creation moment.
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
||||||
@@ -294,7 +294,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* In this particular test the JournalLinkRequest will report the failure.
|
* In this particular test the JournalLinkRequest will report the failure.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreInvalidOutward(): void
|
public function testStoreInvalidOutward(): void
|
||||||
@@ -335,14 +335,14 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||||
$response->assertSee('Invalid outward ID.');
|
$response->assertSee('Invalid outward ID.');
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreNoJournal(): void
|
public function testStoreNoJournal(): void
|
||||||
@@ -384,14 +384,14 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(500);
|
$response->assertStatus(500);
|
||||||
$response->assertSee('Source or destination is NULL.'); // the creation moment.
|
$response->assertSee('Source or destination is NULL.'); // the creation moment.
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreWithNull(): void
|
public function testStoreWithNull(): void
|
||||||
@@ -431,14 +431,14 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
$response->assertSee('Invalid inward ID.'); // error message
|
$response->assertSee('Invalid inward ID.'); // error message
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testUpdate(): void
|
public function testUpdate(): void
|
||||||
@@ -481,14 +481,14 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->put('/api/v1/journal_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee($journalLink->created_at->toAtomString()); // the creation moment.
|
$response->assertSee($journalLink->created_at->toAtomString()); // the creation moment.
|
||||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testUpdateNoJournal(): void
|
public function testUpdateNoJournal(): void
|
||||||
@@ -531,14 +531,14 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->put('/api/v1/journal_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(500);
|
$response->assertStatus(500);
|
||||||
$response->assertSee('Source or destination is NULL.'); // the creation moment.
|
$response->assertSee('Source or destination is NULL.'); // the creation moment.
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||||
*/
|
*/
|
||||||
public function testUpdateWithNull(): void
|
public function testUpdateWithNull(): void
|
||||||
@@ -579,7 +579,7 @@ class JournalLinkControllerTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->put('/api/v1/journal_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
$response->assertSee('Invalid inward ID.'); // the creation moment.
|
$response->assertSee('Invalid inward ID.'); // the creation moment.
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
@@ -110,7 +110,7 @@ class SelectControllerTest extends TestCase
|
|||||||
public function testTestTriggers(): void
|
public function testTestTriggers(): void
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'rule_triggers' => [
|
'triggers' => [
|
||||||
'name' => 'description',
|
'name' => 'description',
|
||||||
'value' => 'Bla bla',
|
'value' => 'Bla bla',
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
@@ -125,9 +125,9 @@ class SelectControllerTest extends TestCase
|
|||||||
|
|
||||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||||
|
|
||||||
$matcher->shouldReceive('setStrict')->once()->withArgs([false]);
|
$matcher->shouldReceive('setStrict')->once()->withArgs([false])->andReturnSelf();
|
||||||
$matcher->shouldReceive('setLimit')->withArgs([10])->andReturnSelf()->once();
|
$matcher->shouldReceive('setTriggeredLimit')->withArgs([10])->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('setRange')->withArgs([200])->andReturnSelf()->once();
|
$matcher->shouldReceive('setSearchLimit')->withArgs([200])->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('setTriggers')->andReturnSelf()->once();
|
$matcher->shouldReceive('setTriggers')->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('findTransactionsByTriggers')->andReturn(new Collection);
|
$matcher->shouldReceive('findTransactionsByTriggers')->andReturn(new Collection);
|
||||||
|
|
||||||
@@ -145,8 +145,8 @@ class SelectControllerTest extends TestCase
|
|||||||
$matcher = $this->mock(TransactionMatcher::class);
|
$matcher = $this->mock(TransactionMatcher::class);
|
||||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
|
||||||
$matcher->shouldReceive('setLimit')->withArgs([10])->andReturnSelf()->once();
|
$matcher->shouldReceive('setTriggeredLimit')->withArgs([10])->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('setRange')->withArgs([200])->andReturnSelf()->once();
|
$matcher->shouldReceive('setSearchLimit')->withArgs([200])->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('setRule')->andReturnSelf()->once();
|
$matcher->shouldReceive('setRule')->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('findTransactionsByRule')->andReturn(new Collection);
|
$matcher->shouldReceive('findTransactionsByRule')->andReturn(new Collection);
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ class SelectControllerTest extends TestCase
|
|||||||
public function testTestTriggersMax(): void
|
public function testTestTriggersMax(): void
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'rule_triggers' => [
|
'triggers' => [
|
||||||
'name' => 'description',
|
'name' => 'description',
|
||||||
'value' => 'Bla bla',
|
'value' => 'Bla bla',
|
||||||
'stop_processing' => 1,
|
'stop_processing' => 1,
|
||||||
@@ -199,8 +199,8 @@ class SelectControllerTest extends TestCase
|
|||||||
|
|
||||||
$matcher->shouldReceive('setStrict')->once()->withArgs([false]);
|
$matcher->shouldReceive('setStrict')->once()->withArgs([false]);
|
||||||
|
|
||||||
$matcher->shouldReceive('setLimit')->withArgs([10])->andReturnSelf()->once();
|
$matcher->shouldReceive('setTriggeredLimit')->withArgs([10])->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('setRange')->withArgs([200])->andReturnSelf()->once();
|
$matcher->shouldReceive('setSearchLimit')->withArgs([200])->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('setTriggers')->andReturnSelf()->once();
|
$matcher->shouldReceive('setTriggers')->andReturnSelf()->once();
|
||||||
$matcher->shouldReceive('findTransactionsByTriggers')->andReturn($set);
|
$matcher->shouldReceive('findTransactionsByTriggers')->andReturn($set);
|
||||||
|
|
||||||
|
@@ -122,9 +122,16 @@ class MassControllerTest extends TestCase
|
|||||||
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$source]));
|
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$source]));
|
||||||
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$source]));
|
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$source]));
|
||||||
$journalRepos->shouldReceive('getTransactionType')->andReturn('Transfer');
|
$journalRepos->shouldReceive('getTransactionType')->andReturn('Transfer');
|
||||||
|
|
||||||
$journalRepos->shouldReceive('isJournalReconciled')->andReturn(false);
|
$journalRepos->shouldReceive('isJournalReconciled')->andReturn(false);
|
||||||
$journalRepos->shouldReceive('getFirstPosTransaction')->andReturn($transfers->first()->transactions()->first());
|
$journalRepos->shouldReceive('getFirstPosTransaction')->andReturn($transfers->first()->transactions()->first());
|
||||||
|
|
||||||
|
// get all kinds of meta fields (the transformer needs this)
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Hello');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->withAnyArgs()->andReturnNull();
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->withAnyArgs()->andReturnNull();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// mock stuff:
|
// mock stuff:
|
||||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||||
@@ -172,6 +179,11 @@ class MassControllerTest extends TestCase
|
|||||||
$journalRepos->shouldReceive('isJournalReconciled')
|
$journalRepos->shouldReceive('isJournalReconciled')
|
||||||
->andReturn(true, false, false, false, false);
|
->andReturn(true, false, false, false, false);
|
||||||
|
|
||||||
|
// get all kinds of meta fields (the transformer needs this)
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Hello');
|
||||||
|
$journalRepos->shouldReceive('getMetaField')->withAnyArgs()->andReturnNull();
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->withAnyArgs()->andReturnNull();
|
||||||
|
|
||||||
|
|
||||||
// default transactions
|
// default transactions
|
||||||
$collection = $this->user()->transactionJournals()->take(5)->get();
|
$collection = $this->user()->transactionJournals()->take(5)->get();
|
||||||
|
@@ -1012,6 +1012,10 @@ class SingleControllerTest extends TestCase
|
|||||||
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getAttachments')->andReturn(new Collection);
|
$journalRepos->shouldReceive('getAttachments')->andReturn(new Collection);
|
||||||
|
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('');
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||||
|
|
||||||
|
|
||||||
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection);
|
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection);
|
||||||
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection);
|
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection);
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$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);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||||
|
|
||||||
@@ -89,11 +89,12 @@ class SplitControllerTest extends TestCase
|
|||||||
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
|
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
|
||||||
$journalRepos->shouldReceive('getJournalDate')->andReturn('2018-01-01')->once();
|
$journalRepos->shouldReceive('getJournalDate')->andReturn('2018-01-01')->once();
|
||||||
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Some note')->once();
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Some note')->atLeast()->once();
|
||||||
$journalRepos->shouldReceive('getJournalBudgetId')->andReturn(0);
|
$journalRepos->shouldReceive('getJournalBudgetId')->andReturn(0);
|
||||||
$journalRepos->shouldReceive('getCategoryName')->andReturn('');
|
$journalRepos->shouldReceive('getCategoryName')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getJournalTotal')->andReturn('0');
|
$journalRepos->shouldReceive('getJournalTotal')->andReturn('0');
|
||||||
$journalRepos->shouldReceive('getJournalCategoryName')->andReturn('Some');
|
$journalRepos->shouldReceive('getJournalCategoryName')->andReturn('Some');
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
|
|
||||||
$currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
|
$currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
|
||||||
@@ -116,14 +117,14 @@ class SplitControllerTest extends TestCase
|
|||||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||||
|
|
||||||
|
|
||||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
||||||
$destination = $deposit->transactions()->where('amount', '>', 0)->first();
|
$destination = $deposit->transactions()->where('amount', '>', 0)->first();
|
||||||
$account = $destination->account;
|
$account = $destination->account;
|
||||||
$transactions = factory(Transaction::class, 3)->make();
|
$transactions = factory(Transaction::class, 3)->make();
|
||||||
|
|
||||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
|
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
|
||||||
$currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1));
|
$currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1));
|
||||||
@@ -139,10 +140,11 @@ class SplitControllerTest extends TestCase
|
|||||||
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
|
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
|
||||||
$journalRepos->shouldReceive('getJournalDate')->andReturn('2018-01-01')->once();
|
$journalRepos->shouldReceive('getJournalDate')->andReturn('2018-01-01')->once();
|
||||||
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Some note')->once();
|
|
||||||
$journalRepos->shouldReceive('getJournalBudgetId')->andReturn(0);
|
$journalRepos->shouldReceive('getJournalBudgetId')->andReturn(0);
|
||||||
$journalRepos->shouldReceive('getCategoryName')->andReturn('');
|
$journalRepos->shouldReceive('getCategoryName')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getJournalTotal')->andReturn('0');
|
$journalRepos->shouldReceive('getJournalTotal')->andReturn('0');
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Some note')->atLeast()->once();
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
|
|
||||||
$old = [
|
$old = [
|
||||||
@@ -215,7 +217,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
|
||||||
$opening = TransactionJournal::where('transaction_type_id', 4)->where('user_id', $this->user()->id)->first();
|
$opening = TransactionJournal::where('transaction_type_id', 4)->where('user_id', $this->user()->id)->first();
|
||||||
@@ -235,7 +237,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||||
|
|
||||||
@@ -254,10 +256,11 @@ class SplitControllerTest extends TestCase
|
|||||||
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
|
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
|
||||||
$journalRepos->shouldReceive('getJournalDate')->once()->andReturn('2018-01-01');
|
$journalRepos->shouldReceive('getJournalDate')->once()->andReturn('2018-01-01');
|
||||||
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Some note')->once();
|
|
||||||
$journalRepos->shouldReceive('getJournalBudgetId')->andReturn(0);
|
$journalRepos->shouldReceive('getJournalBudgetId')->andReturn(0);
|
||||||
$journalRepos->shouldReceive('getCategoryName')->andReturn('');
|
$journalRepos->shouldReceive('getCategoryName')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1');
|
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1');
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Some note')->atLeast()->once();
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
$currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
|
$currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
|
||||||
$budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
|
$budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
|
||||||
@@ -282,7 +285,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
|
||||||
$billRepos->shouldReceive('scan');
|
$billRepos->shouldReceive('scan');
|
||||||
@@ -338,7 +341,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
|
||||||
$this->session(['transactions.edit-split.uri' => 'http://localhost']);
|
$this->session(['transactions.edit-split.uri' => 'http://localhost']);
|
||||||
@@ -384,7 +387,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
$billRepos->shouldReceive('scan');
|
$billRepos->shouldReceive('scan');
|
||||||
$ruleRepos->shouldReceive('setUser')->once();
|
$ruleRepos->shouldReceive('setUser')->once();
|
||||||
@@ -442,7 +445,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||||
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
|
|
||||||
|
|
||||||
$billRepos->shouldReceive('scan');
|
$billRepos->shouldReceive('scan');
|
||||||
|
@@ -374,7 +374,8 @@ class TransactionControllerTest extends TestCase
|
|||||||
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
||||||
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection);
|
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection);
|
||||||
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection);
|
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection);
|
||||||
|
$journalRepos->shouldReceive('getNoteText')->andReturn('Some note')->atLeast()->once();
|
||||||
|
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
$response = $this->get(route('transactions.show', [1]));
|
$response = $this->get(route('transactions.show', [1]));
|
||||||
|
@@ -878,6 +878,12 @@ class TransactionFactoryTest extends TestCase
|
|||||||
// first search action is for the asset account, second is for expense account.
|
// first search action is for the asset account, second is for expense account.
|
||||||
$accountRepos->shouldReceive('findNull')->andReturn($asset, $expense)->atLeast()->once();
|
$accountRepos->shouldReceive('findNull')->andReturn($asset, $expense)->atLeast()->once();
|
||||||
|
|
||||||
|
// Find budget, but based on null it returns null.
|
||||||
|
$budgetFactory->shouldReceive('find')->withArgs([null, null])->andReturnNull()->atLeast()->once();
|
||||||
|
|
||||||
|
// find category, but none are present so return null.
|
||||||
|
$categoryFactory->shouldReceive('findOrCreate')->withArgs([null, null])->andReturnNull()->atLeast()->once();
|
||||||
|
|
||||||
// factories return various stuff:
|
// factories return various stuff:
|
||||||
$currencyFactory->shouldReceive('find')->andReturn(null, null)->atLeast()->once();
|
$currencyFactory->shouldReceive('find')->andReturn(null, null)->atLeast()->once();
|
||||||
|
|
||||||
@@ -896,7 +902,7 @@ class TransactionFactoryTest extends TestCase
|
|||||||
|
|
||||||
$newCount = $withdrawal->transactions()->count();
|
$newCount = $withdrawal->transactions()->count();
|
||||||
|
|
||||||
$this->assertEquals($count, $newCount);
|
$this->assertEquals($count, $newCount - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -207,7 +207,7 @@ class AccountTransformerTest extends TestCase
|
|||||||
$this->assertEquals($note->text, $result['notes']);
|
$this->assertEquals($note->text, $result['notes']);
|
||||||
$this->assertEquals('2018-02-01', $result['monthly_payment_date']);
|
$this->assertEquals('2018-02-01', $result['monthly_payment_date']);
|
||||||
$this->assertEquals('monthlyFull', $result['credit_card_type']);
|
$this->assertEquals('monthlyFull', $result['credit_card_type']);
|
||||||
$this->assertEquals('ccAsset', $result['role']);
|
$this->assertEquals('ccAsset', $result['account_role']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -292,7 +292,7 @@ class AccountTransformerTest extends TestCase
|
|||||||
$this->assertEquals($note->text, $result['notes']);
|
$this->assertEquals($note->text, $result['notes']);
|
||||||
$this->assertNull($result['monthly_payment_date']);
|
$this->assertNull($result['monthly_payment_date']);
|
||||||
$this->assertNull($result['credit_card_type']);
|
$this->assertNull($result['credit_card_type']);
|
||||||
$this->assertNull($result['role']);
|
$this->assertNull($result['account_role']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -55,7 +55,6 @@ class TagTransformerTest extends TestCase
|
|||||||
);
|
);
|
||||||
$transformer = new TagTransformer(new ParameterBag);
|
$transformer = new TagTransformer(new ParameterBag);
|
||||||
$result = $transformer->transform($tag);
|
$result = $transformer->transform($tag);
|
||||||
$this->assertEquals('nothing', $result['tag_mode']);
|
|
||||||
$this->assertEquals($tag->tag, $result['tag']);
|
$this->assertEquals($tag->tag, $result['tag']);
|
||||||
$this->assertEquals(5.5, $result['latitude']);
|
$this->assertEquals(5.5, $result['latitude']);
|
||||||
$this->assertEquals(6.6, $result['longitude']);
|
$this->assertEquals(6.6, $result['longitude']);
|
||||||
|
@@ -35,6 +35,7 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Transformers\TransactionTransformer;
|
use FireflyIII\Transformers\TransactionTransformer;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||||
@@ -52,6 +53,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testBasic(): void
|
public function testBasic(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -130,6 +136,7 @@ class TransactionTransformerTest extends TestCase
|
|||||||
$this->assertEquals($expense->iban, $result['destination_iban']);
|
$this->assertEquals($expense->iban, $result['destination_iban']);
|
||||||
$this->assertEquals($expense->id, $result['destination_id']);
|
$this->assertEquals($expense->id, $result['destination_id']);
|
||||||
$this->assertEquals('Expense account', $result['destination_type']);
|
$this->assertEquals('Expense account', $result['destination_type']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,6 +147,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDeposit(): void
|
public function testDeposit(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -228,6 +240,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDepositBudget(): void
|
public function testDepositBudget(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -325,6 +342,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testForeignAmount(): void
|
public function testForeignAmount(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -421,6 +443,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testJournalBudget(): void
|
public function testJournalBudget(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -523,6 +550,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testJournalCategory(): void
|
public function testJournalCategory(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -625,6 +657,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testOpeningBalanceNeg(): void
|
public function testOpeningBalanceNeg(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -714,6 +751,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testOpeningBalancePos(): void
|
public function testOpeningBalancePos(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -803,6 +845,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReconciliationNeg(): void
|
public function testReconciliationNeg(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -892,6 +939,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReconciliationPos(): void
|
public function testReconciliationPos(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -981,6 +1033,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTransactionBudget(): void
|
public function testTransactionBudget(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -1085,6 +1142,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTransactionCategory(): void
|
public function testTransactionCategory(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -1188,6 +1250,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTransactionDescription(): void
|
public function testTransactionDescription(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$asset = Account::create(
|
$asset = Account::create(
|
||||||
[
|
[
|
||||||
@@ -1276,6 +1343,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTransferOne(): void
|
public function testTransferOne(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$left = Account::create(
|
$left = Account::create(
|
||||||
[
|
[
|
||||||
@@ -1364,6 +1436,11 @@ class TransactionTransformerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTransferTwo(): void
|
public function testTransferTwo(): void
|
||||||
{
|
{
|
||||||
|
$journalRepository = $this->mock(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->shouldReceive('getNoteText')->andReturn('Some notes')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaField')->andReturn('FieldValue')->atLeast()->once();
|
||||||
|
$journalRepository->shouldReceive('getMetaDateString')->andReturn('2018-01-01')->atLeast()->once();
|
||||||
|
|
||||||
// make new asset account:
|
// make new asset account:
|
||||||
$left = Account::create(
|
$left = Account::create(
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user