Compare commits

...

48 Commits

Author SHA1 Message Date
James Cole
cf00922ad2 Merge branch 'release/3.4.0.4' 2015-05-09 15:13:20 +02:00
James Cole
d07b2e773b Update read me 2015-05-09 15:13:14 +02:00
James Cole
506ef7b0b9 Covered currency repository. 2015-05-09 15:11:12 +02:00
James Cole
2cd5dae8e2 New read me [skip ci] 2015-05-09 15:08:56 +02:00
James Cole
a1cd49c111 First attempt at translations. 2015-05-09 13:56:03 +02:00
James Cole
aca2973aef Experimental chart [skip ci] 2015-05-09 13:55:07 +02:00
James Cole
0a7a691c95 Experimental chart [skip ci] 2015-05-09 13:53:58 +02:00
James Cole
72906a7afd Experimental chart [skip ci] 2015-05-09 13:52:33 +02:00
James Cole
d1a4a83570 Covered category repository. 2015-05-09 13:14:02 +02:00
James Cole
e0396b29e8 Add GA beacon [skip ci] 2015-05-09 10:43:37 +02:00
James Cole
536833cfe0 Fixed tests. 2015-05-09 10:25:52 +02:00
James Cole
317b02d1b9 Finished budget repository tests. 2015-05-09 10:23:13 +02:00
James Cole
75e279ea0d Update read me [skip ci] 2015-05-09 09:17:09 +02:00
James Cole
dc2ad21f4c Updated read me [skip ci] 2015-05-09 09:15:39 +02:00
James Cole
484d49aae1 Fixed tests 2015-05-09 09:15:27 +02:00
James Cole
ca39438ad4 Small update to the read me. [skip ci] 2015-05-09 09:11:54 +02:00
James Cole
49a65ebff4 New budget repository tests. 2015-05-09 09:05:37 +02:00
James Cole
befdc05084 Rewrote read me. [skip ci] 2015-05-08 19:34:03 +02:00
James Cole
1fbffe761b Merge branch 'release/3.4.0.3' into develop 2015-05-08 17:35:03 +02:00
James Cole
36aad379ff Merge branch 'release/3.4.0.3' 2015-05-08 17:35:02 +02:00
James Cole
540cfa072e Update read me. 2015-05-08 17:34:54 +02:00
James Cole
3b049c15cc Updated composer.json [skip ci] 2015-05-08 17:15:16 +02:00
James Cole
3e93ed0a17 Small JS fix. [skip ci] 2015-05-08 17:13:49 +02:00
James Cole
d7d9358136 Fix sorting [skip ci] 2015-05-08 17:04:24 +02:00
James Cole
5cf0939ff9 Fixed sorting [skip ci] 2015-05-08 17:03:20 +02:00
James Cole
8dc6f91d3c Add sort options. [skip ci] 2015-05-08 17:00:39 +02:00
James Cole
a3a25db230 New tests. 2015-05-08 16:44:57 +02:00
James Cole
c06f18c815 Some new tests 2015-05-08 14:00:49 +02:00
James Cole
6802f04036 First two tests for bill repository. 2015-05-08 12:50:39 +02:00
James Cole
beeccdf345 New (incomplete) tests [skip ci] 2015-05-08 12:44:42 +02:00
James Cole
58241ed39d Covered account repository. 2015-05-08 12:42:12 +02:00
James Cole
31128020f0 Merge branch 'release/3.4.0.2' 2015-05-08 07:57:06 +02:00
James Cole
6c48afc37b Merge branch 'release/3.4.0.2' into develop 2015-05-08 07:57:06 +02:00
James Cole
7a2f169dfc Push new version. 2015-05-08 07:56:55 +02:00
James Cole
ed910b99a7 Update travis configuration [skip ci] 2015-05-08 07:48:04 +02:00
James Cole
54195c0826 Updated tests. 2015-05-08 07:39:05 +02:00
James Cole
cefbbcd1df Fixed some tests. 2015-05-08 07:27:29 +02:00
James Cole
cc01592085 Cover some more account repository. 2015-05-08 06:01:39 +02:00
James Cole
5a98a5252d Added tests. 2015-05-07 21:26:00 +02:00
James Cole
184e8b1132 Some new tests. 2015-05-07 20:56:27 +02:00
James Cole
2b6b896c2e Some more coverage. 2015-05-06 18:09:45 +02:00
James Cole
96d06b7a93 Added incomplete tests. 2015-05-05 22:46:28 +02:00
James Cole
f54f1611b5 First tests for account repository. 2015-05-05 20:46:13 +02:00
James Cole
69ad757e8b Lazily remove todo's [skip ci] 2015-05-05 13:03:39 +02:00
James Cole
e0beb796ad Some cleaning up [skip ci] 2015-05-05 13:03:04 +02:00
James Cole
f331e7d820 Removed unnecessary imports (use statements) [skip ci] 2015-05-05 12:57:27 +02:00
James Cole
cbb62d3d78 Added new line at the end of files. [skip ci] 2015-05-05 12:51:57 +02:00
James Cole
c85bc59c1d Merge branch 'release/3.4.0.1' into develop 2015-05-05 12:35:23 +02:00
110 changed files with 3002 additions and 297 deletions

View File

@@ -8,8 +8,8 @@ DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
CACHE_DRIVER=array
SESSION_DRIVER=array
EMAIL_SMTP=
EMAIL_USERNAME=

View File

@@ -16,7 +16,7 @@ install:
- mv -v .env.testing .env
script:
- phpunit --debug
- phpunit
after_script:
- php vendor/bin/coveralls

100
README.md
View File

@@ -1,46 +1,62 @@
Firefly III (v3.4.0.1)
===========
# Firefly III
#### v3.4.0.4
[![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii)
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master)
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=develop)](https://coveralls.io/r/JC5/firefly-iii?branch=develop)
[![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![Total Downloads](https://poser.pugx.org/grumpydictator/firefly-iii/downloads.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![Latest Unstable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/unstable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![License](https://poser.pugx.org/grumpydictator/firefly-iii/license.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
![GA](https://ga-beacon.appspot.com/UA-58172398-6/firefly-iii/readme)
## About
Firefly III is a tool to help you manage your finances. Please read the full description [in the wiki](https://github.com/JC5/firefly-iii/wiki/full-description).
"Firefly III" is a financial manager. It can help you keep track of expenses, income, budgets and everything in between. It even supports credit cards, shared
household accounts and savings accounts! It's pretty fancy. You should use it to save and organise money.
Firefly Mark III is a new version of Firefly built upon best practices and lessons learned
from building [Firefly](https://github.com/JC5/Firefly). It's Mark III since the original Firefly never made it outside of my
laptop and [Firefly II](https://github.com/JC5/Firefly) is live.
Firefly is a system you'll have install yourself on webhosting of your choosing.
If you're not sure if this tool is for you, please read the [full description](https://github.com/JC5/firefly-iii/wiki/full-description).
Personal financial management is pretty difficult, and everybody has their own approach to it. Some people
make budgets, other people limit their cashflow by throwing away their credit cards, others get a better job.
There are tons of ways to save and earn money.
To install and use Firefly III, please read [the installation guide](https://github.com/JC5/firefly-iii/wiki/Installation),
[the upgrade guide](https://github.com/JC5/firefly-iii/wiki/Upgrade-instructions) (if applicable) and the **[first use guide](https://github.com/JC5/firefly-iii/wiki/First-use)**.
If you want to try out Firefly III, you can do so on [this dedicated website](https://geld.nder.be/). This site always runs the latest version of Firefly III. If you want to use it, please read the [privacy considerations](https://github.com/JC5/firefly-iii/wiki/Privacy-on-demo-site) for this demo-site.
To get to know Firefly, and to see if it fits you, check out these resources:
- The screenshots below on this very page.
- The featurelist below, also on this very page.
- The [full description](https://github.com/JC5/firefly-iii/wiki/full-description), which will tell you how Firefly works,
and the philosophy behind it.
### About the name (if you care)
It's III, or 3, because [version 2](https://github.com/JC5/Firefly) and version 1 (not online) preceded it. It has been growing steadily ever since.
## Running and installing
If you're still interested please read [the installation guide](https://github.com/JC5/firefly-iii/wiki/Installation),
[the upgrade guide](https://github.com/JC5/firefly-iii/wiki/Upgrade-instructions) (if applicable)
and the **[first use guide](https://github.com/JC5/firefly-iii/wiki/First-use)**.
If you want to try out Firefly III, you can do so on [this dedicated website](https://geld.nder.be/).
This site always runs the latest version of Firefly III. If you want to use it, please read the [privacy considerations](https://github.com/JC5/firefly-iii/wiki/Privacy-on-demo-site) for this demo-site.
## Current features
- [A double-entry bookkeeping system](https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system);
- You can store, edit and remove withdrawals, deposits and transfers. This allows you full financial management;
- You can store, edit and remove [withdrawals, deposits and transfers](https://en.wikipedia.org/wiki/Financial_transaction). This allows you full financial management;
- You can manage different types of accounts
- Asset accounts
- Shared asset accounts (household accounts)
- [Asset](https://en.wikipedia.org/wiki/Asset) accounts
- Shared [asset accounts](https://en.wikipedia.org/wiki/Asset) ([household accounts](https://en.wikipedia.org/wiki/Household))
- Saving accounts
- Credit cards
- It's possible to create, change and manage money using _[budgets](https://en.wikipedia.org/wiki/Envelope_system)_;
- Organize transactions using categories;
- Save towards a goal using piggy banks;
- Predict and anticipate bills;
- View income / expense reports;
- Lots of help text in case you don't get it;
- Save towards a goal using [piggy banks](https://en.wikipedia.org/wiki/Piggy_bank);
- Predict and anticipate [bills](https://en.wikipedia.org/wiki/Invoice);
- View income / expense [reports](https://en.wikipedia.org/wiki/Financial_statement);
- Organize expenses using tags;
- Lots of help text in case you don't get it.
Everything is organised:
@@ -50,33 +66,29 @@ Everything is organised:
- Lots of charts because we all love them.
- Financial reporting showing you how well you are doing;
## Changes
Firefly III will feature, but does not feature yet:
- More control over other resources outside of personal finance
- Debts
- More test-coverage;
- Firefly will be able to split transactions; a single purchase can be split in multiple entries, for more fine-grained control.
- Firefly will be able to join transactions.
- Any other features I might not have thought of.
Some stuff has been removed:
- The nesting of budgets, categories and beneficiaries is removed because it was pretty pointless.
## Screenshots
![Index](http://i.imgur.com/TkZNIer.png)
_Please note that everything in these screenshots is fictional and may not be realistic._
![Accounts](http://i.imgur.com/YE8WavP.png)
![Index](https://i.nder.be/c09vfw90)
![Budgets](http://i.imgur.com/Go0M6Nd.png)
![Accounts](https://i.nder.be/hkn0vhcg)
![Reports](http://i.imgur.com/EnEIyQI.png)
![Budgets](https://i.nder.be/h2snx2mw)
![Reports 1](https://i.nder.be/c9f8zy5c)
![Reports 2](https://i.nder.be/ghvs5png)
![Bills](https://i.nder.be/h58kh00p)
![Piggy banks](https://i.nder.be/hkud0h53)
## Current state
I have the basics up and running. Test coverage is currently coming, slowly.
Questions, ideas or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)!
Firefly III is pretty much all grown up. Full test coverage (nerd alert!) is coming. One of the things on the todo-list
is adding translations.
Questions, ideas, bugs or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)!
If you like this tool, feel free to [donate me some beer money](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2ZMV952UUSCLU&lc=NL&item_name=Development%20of%20Firefly&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted).

View File

@@ -2,7 +2,6 @@
use FireflyIII\Events\JournalSaved;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\Transaction;
/**
* Class UpdateJournalConnection

View File

@@ -136,7 +136,7 @@ class ReportHelper implements ReportHelperInterface
$end = clone $date;
$sharedAccounts = [];
if ($showSharedReports === false) {
$sharedCollection = \Auth::user()->accounts()
$sharedCollection = Auth::user()->accounts()
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
->where('account_meta.name', '=', 'accountRole')
->where('account_meta.data', '=', json_encode('sharedAsset'))

View File

@@ -4,7 +4,6 @@ use Config;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BillFormRequest;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;

View File

@@ -5,7 +5,6 @@ use Carbon\Carbon;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BudgetFormRequest;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Input;

View File

@@ -149,6 +149,7 @@ class GoogleChartController extends Controller
{
$chart->addColumn('Budget', 'string');
$chart->addColumn('Left', 'number');
$chart->addColumn('Spent', 'number');
$chart->addColumn('Overspent', 'number');
$budgets = $repository->getBudgets();
@@ -160,31 +161,43 @@ class GoogleChartController extends Controller
$repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
if ($repetitions->count() == 0) {
$expenses = $repository->sumBudgetExpensesInPeriod($budget, $start, $end);
$allEntries->push([$budget->name, 0, $expenses]);
$allEntries->push([$budget->name, 0, 0, $expenses]);
continue;
}
/** @var LimitRepetition $repetition */
foreach ($repetitions as $repetition) {
$expenses = $repository->sumBudgetExpensesInPeriod($budget, $repetition->startdate, $repetition->enddate);
$allEntries->push([$budget->name . ' (' . $repetition->startdate->format('j M Y') . ')', floatval($repetition->amount), $expenses]);
$left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0;
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
$allEntries->push(
[$budget->name . ' (' . $repetition->startdate->format('j M Y') . ')',
$left,
$spent,
$overspent
]
);
}
}
$noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end);
$allEntries->push(['(no budget)', 0, $noBudgetExpenses]);
$allEntries->push(['(no budget)', 0, 0, $noBudgetExpenses]);
foreach ($allEntries as $entry) {
if ($entry[2] > 0) {
$left = $entry[1] - $entry[2];
if ($left > 0) {
$chart->addRow($entry[0], $left, null);
} else {
if ($left < 0) {
$chart->addRow($entry[0], null, $left);
}
}
if ($entry[1] != 0 || $entry[2] != 0 || $entry[3] != 0) {
$chart->addRow($entry[0], $entry[1], $entry[2], $entry[3]);
}
// if ($entry[2] > 0) {
// $left = $entry[1] - $entry[2];
// if ($left > 0) {
// $chart->addRow($entry[0], $left, null);
// } else {
// if ($left < 0) {
// $chart->addRow($entry[0], null, $left);
// }
// }
//
// }
}
$chart->generate();

View File

@@ -6,8 +6,6 @@ use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Preference;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
@@ -187,25 +185,6 @@ class JsonController extends Controller
}
/**
* Returns a JSON list of all beneficiaries.
*
* @param TagRepositoryInterface $tagRepository
*
* @return \Illuminate\Http\JsonResponse
*/
public function tags(TagRepositoryInterface $tagRepository)
{
$list = $tagRepository->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->tag;
}
return Response::json($return);
}
/**
* @param AccountRepositoryInterface $accountRepository
*
@@ -247,6 +226,25 @@ class JsonController extends Controller
return Response::json(['value' => $pref->data]);
}
/**
* Returns a JSON list of all beneficiaries.
*
* @param TagRepositoryInterface $tagRepository
*
* @return \Illuminate\Http\JsonResponse
*/
public function tags(TagRepositoryInterface $tagRepository)
{
$list = $tagRepository->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->tag;
}
return Response::json($return);
}
/**
* @param JournalRepositoryInterface $repository
* @param $what

View File

@@ -6,9 +6,7 @@ use Config;
use ExpandedForm;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\PiggyBankFormRequest;
use FireflyIII\Models\Account;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Support\Collection;

View File

@@ -22,10 +22,10 @@ use View;
* Remember: a balancingAct takes at most one expense and one transfer.
* an advancePayment takes at most one expense, infinite deposits and NO transfers.
*
* TODO transaction can only have one advancePayment OR balancingAct.
* TODO Other attempts to put in such a tag are blocked.
* TODO also show an error when editing a tag and it becomes either
* TODO of these two types. Or rather, block editing of the tag.
* transaction can only have one advancePayment OR balancingAct.
* Other attempts to put in such a tag are blocked.
* also show an error when editing a tag and it becomes either
* of these two types. Or rather, block editing of the tag.
*
* @package FireflyIII\Http\Controllers
*/

View File

@@ -60,6 +60,31 @@ class Account extends Model
}
/**
* @param array $fields
*
* @return Account|null
*/
public static function firstOrNullEncrypted(array $fields)
{
// everything but the name:
$query = Account::orderBy('id');
foreach ($fields as $name => $value) {
if ($name != 'name') {
$query->where($name, $value);
}
}
$set = $query->get(['accounts.*']);
/** @var Account $account */
foreach ($set as $account) {
if ($account->name == $fields['name']) {
return $account;
}
}
return null;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/

View File

@@ -12,6 +12,8 @@ use Illuminate\Database\Eloquent\Model;
class PiggyBankRepetition extends Model
{
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
/**
* @return array
*/

View File

@@ -230,7 +230,7 @@ class TransactionJournal extends Model
*/
public function setDescriptionAttribute($value)
{
$this->attributes['description'] = \Crypt::encrypt($value);
$this->attributes['description'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true;
}

View File

@@ -1,7 +1,6 @@
<?php namespace FireflyIII\Providers;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\PiggyBank;
@@ -118,8 +117,8 @@ class EventServiceProvider extends ServiceProvider
try {
$repetition->save();
} catch (QueryException $e) {
\Log::error('Trying to save new LimitRepetition failed!');
\Log::error($e->getMessage());
Log::error('Trying to save new LimitRepetition failed!');
Log::error($e->getMessage());
}
} else {
if ($set->count() == 1) {

View File

@@ -3,7 +3,6 @@
namespace FireflyIII\Providers;
use App;
use FireflyIII\Models\Account;
use FireflyIII\Support\Amount;
use FireflyIII\Support\ExpandedForm;
use FireflyIII\Support\Navigation;

View File

@@ -16,12 +16,14 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Query\Builder;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Log;
use Session;
use Steam;
/**
* Class AccountRepository
*
@@ -224,7 +226,7 @@ class AccountRepository implements AccountRepositoryInterface
// then, percentage.
$difference = $account->endBalance - $account->piggyBalance;
$account->difference = $difference;
$account->percentage = $difference != 0 ? round((($difference / $account->endBalance) * 100)) : 100;
$account->percentage = $difference != 0 && $account->endBalance != 0 ? round((($difference / $account->endBalance) * 100)) : 100;
}
);
@@ -269,6 +271,7 @@ class AccountRepository implements AccountRepositoryInterface
$pct = $pct > 100 ? 100 : $pct;
$account->difference = $diff;
$account->percentage = round($pct);
}
);
@@ -287,7 +290,7 @@ class AccountRepository implements AccountRepositoryInterface
public function getTransfersInRange(Account $account, Carbon $start, Carbon $end)
{
return TransactionJournal::whereIn(
'id', function ($q) use ($account, $start, $end) {
'id', function (Builder $q) use ($account, $start, $end) {
$q->select('transaction_journals.id')
->from('transactions')
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
@@ -310,7 +313,7 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function leftOnAccount(Account $account)
{
$balance = \Steam::balance($account, null, true);
$balance = Steam::balance($account, null, true);
/** @var PiggyBank $p */
foreach ($account->piggybanks()->get() as $p) {
$balance -= $p->currentRelevantRep()->currentamount;
@@ -440,13 +443,20 @@ class AccountRepository implements AccountRepositoryInterface
if (!$newAccount->isValid()) {
// does the account already exist?
$existingAccount = Account::where('user_id', $data['user'])->where('account_type_id', $accountType->id)->where('name', $data['name'])->first();
$searchData = [
'user_id' => $data['user'],
'account_type_id' => $accountType->id,
'name' => $data['name']
];
$existingAccount = Account::firstOrNullEncrypted($searchData);
if (!$existingAccount) {
Log::error('Account create error: ' . $newAccount->getErrors()->toJson());
App::abort(500);
// @codeCoverageIgnoreStart
}
// @codeCoverageIgnoreEnd
$newAccount = $existingAccount;
}
$newAccount->save();
@@ -500,9 +510,6 @@ class AccountRepository implements AccountRepositoryInterface
'encrypted' => true
]
);
if (!$journal->isValid()) {
App::abort(500);
}
$journal->save();
@@ -526,9 +533,6 @@ class AccountRepository implements AccountRepositoryInterface
'amount' => $firstAmount
]
);
if (!$one->isValid()) {
App::abort(500);
}
$one->save();
// second transaction: to
@@ -539,9 +543,6 @@ class AccountRepository implements AccountRepositoryInterface
'amount' => $secondAmount
]
);
if (!$two->isValid()) {
App::abort(500);
}
$two->save();
return $journal;

View File

@@ -4,6 +4,7 @@ namespace FireflyIII\Repositories\Bill;
use Auth;
use Carbon\Carbon;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill;
@@ -119,7 +120,7 @@ class BillRepository implements BillRepositoryInterface
*/
public function getPossiblyRelatedJournals(Bill $bill)
{
$set = \DB::table('transactions')->where('amount', '>', 0)->where('amount', '>=', $bill->amount_min)->where('amount', '<=', $bill->amount_max)->get(
$set = DB::table('transactions')->where('amount', '>', 0)->where('amount', '>=', $bill->amount_min)->where('amount', '<=', $bill->amount_max)->get(
['transaction_journal_id']
);
$ids = [];
@@ -261,11 +262,8 @@ class BillRepository implements BillRepositoryInterface
/*
* Attach expense account to description for more narrow matching.
*/
if (count($journal->transactions) < 2) {
$transactions = $journal->transactions()->get();
} else {
$transactions = $journal->transactions;
}
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
/** @var Account $account */

View File

@@ -10,6 +10,7 @@ use FireflyIII\Models\LimitRepetition;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Input;
/**
* Class BudgetRepository
@@ -24,21 +25,6 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function cleanupBudgets()
{
$limits = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')->get(['budget_limits.*']);
// loop budget limits:
$found = [];
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
$key = $limit->budget_id . '-' . $limit->startdate;
if (isset($found[$key])) {
$limit->delete();
} else {
$found[$key] = true;
}
unset($key);
}
// delete limits with amount 0:
BudgetLimit::where('amount', 0)->delete();
@@ -162,7 +148,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50)
{
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $take : 0;
$offset = intval(Input::get('page')) > 0 ? intval(Input::get('page')) * $take : 0;
$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)

View File

@@ -39,17 +39,10 @@ class Amount
if (defined('FFCURRENCYSYMBOL')) {
return FFCURRENCYSYMBOL;
}
if (\Cache::has('FFCURRENCYSYMBOL')) {
define('FFCURRENCYSYMBOL', \Cache::get('FFCURRENCYSYMBOL'));
return FFCURRENCYSYMBOL;
}
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
\Cache::forever('FFCURRENCYSYMBOL', $currency->symbol);
define('FFCURRENCYSYMBOL', $currency->symbol);
return $currency->symbol;
@@ -160,7 +153,6 @@ class Amount
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
if ($currency) {
Cache::forever('FFCURRENCYCODE', $currency->code);
define('FFCURRENCYCODE', $currency->code);
return $currency->code;

View File

@@ -3,7 +3,6 @@
namespace FireflyIII\Support;
use Amount as Amt;
use FireflyIII\Models\TransactionCurrency;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Input;

View File

@@ -121,6 +121,7 @@ class Search implements SearchInterface
return $journal;
}
}
return null;
}

View File

@@ -39,6 +39,7 @@ class Journal extends Twig_Extension
if ($type == 'Opening balance') {
return '<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>';
}
return '';
}, ['is_safe' => ['html']]

10
composer.lock generated
View File

@@ -943,16 +943,16 @@
},
{
"name": "laravel/framework",
"version": "v5.0.28",
"version": "v5.0.29",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "06a09429322cf53e5bd4587db1060f02a291562e"
"reference": "aa7046645e094b0134a4125cce6694f4b076ac62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/06a09429322cf53e5bd4587db1060f02a291562e",
"reference": "06a09429322cf53e5bd4587db1060f02a291562e",
"url": "https://api.github.com/repos/laravel/framework/zipball/aa7046645e094b0134a4125cce6694f4b076ac62",
"reference": "aa7046645e094b0134a4125cce6694f4b076ac62",
"shasum": ""
},
"require": {
@@ -1065,7 +1065,7 @@
"framework",
"laravel"
],
"time": "2015-04-21 01:44:32"
"time": "2015-05-08 12:57:10"
},
{
"name": "league/commonmark",

2
pu.sh
View File

@@ -11,7 +11,7 @@ fi
if [ ! -z "$1" ]
then
phpunit --verbose tests/controllers/$1.php
phpunit --verbose tests/repositories/$1.php
fi
# restore .env file

View File

@@ -3,7 +3,8 @@ google.setOnLoadCallback(drawChart);
function drawChart() {
googleLineChart('chart/home/account', 'accounts-chart');
googleColumnChart('chart/home/budgets', 'budgets-chart');
//googleColumnChart('chart/home/budgets', 'budgets-chart');
googleStackedColumnChart('chart/home/budgets', 'budgets-chart');
googleColumnChart('chart/home/categories', 'categories-chart');
googlePieChart('chart/home/bills', 'bills-chart');
getBoxAmounts();

View File

@@ -1,13 +1,15 @@
if (typeof(google) != 'undefined') {
google.setOnLoadCallback(drawChart);
}
function drawChart() {
googleColumnChart('chart/reports/income-expenses/' + year, 'income-expenses-chart');
googleColumnChart('chart/reports/income-expenses-sum/' + year, 'income-expenses-sum-chart')
googleStackedColumnChart('chart/budgets/spending/' + year, 'budgets');
}
}
$(function () {
$('.openModal').on('click', openModal);

View File

@@ -0,0 +1,10 @@
<?php
return [
'welcome' => 'Welcome to Firefly!',
'mainTitle' => 'What\'s playing?',
'close' => 'Clone',
'pleaseHold' => 'Please hold...',
'mandatoryFields' => 'Mandatory fields',
'optionalFields' => 'Optional fields',
'options' => 'Options'
];

View File

@@ -9,7 +9,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields
<i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
@@ -22,7 +22,7 @@
{% if what == 'asset' %}
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
@@ -35,10 +35,9 @@
</div>
{% endif %}
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','account') }}

View File

@@ -9,7 +9,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields
<i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
@@ -20,7 +20,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
@@ -50,7 +50,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','account') }}

View File

@@ -5,10 +5,9 @@
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-6">
<!-- panel for mandatory fields -->
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-exclamation-circle"></i> Mandatory fields
<i class="fa fa-exclamation-circle"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
@@ -22,10 +21,9 @@
</div>
<div class="col-lg-6 col-md-12 col-sm-6">
<!-- panel for optional fields -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.integer('skip',0) }}
@@ -37,7 +35,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','bill') }}

View File

@@ -9,7 +9,7 @@
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-exclamation-circle"></i> Mandatory fields
<i class="fa fa-exclamation-circle"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
@@ -26,7 +26,7 @@
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.integer('skip') }}
@@ -37,7 +37,7 @@
</div>
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','bill') }}

View File

@@ -25,3 +25,10 @@
</div>
</div>
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all" />
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="js/bootstrap-sortable.js"></script>
{% endblock %}

View File

@@ -6,7 +6,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-exclamation"></i> Mandatory fields
<i class="fa fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
@@ -17,7 +17,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','budget') }}

View File

@@ -13,7 +13,7 @@
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-fw fa-exclamation"></i> Mandatory fields
<i class="fa fa-fw fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.checkbox('active') }}
@@ -26,7 +26,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','budget') }}

View File

@@ -7,7 +7,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-exclamation"></i> Mandatory fields
<i class="fa fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
@@ -20,7 +20,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','category') }}

View File

@@ -7,7 +7,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-exclamation"></i> Mandatory fields
<i class="fa fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
@@ -21,7 +21,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','category') }}

View File

@@ -6,7 +6,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields
<i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name',null,{'maxlength' : 48}) }}
@@ -22,7 +22,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','currency') }}

View File

@@ -8,7 +8,7 @@
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields
<i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('name',null,{'maxlength' : 48}) }}
@@ -23,7 +23,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','currency') }}

View File

@@ -5,7 +5,7 @@
{% if count == 0 %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Welcome to Firefly III.</p>
<p class="lead">{{ trans('firefly.welcome') }}</p>
<p>
Create a new asset account to get started.

View File

@@ -89,15 +89,15 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">{{ trans('firefly.close') }}</span>
</button>
<h4 class="modal-title" id="helpTitle">Please hold...</h4>
<h4 class="modal-title" id="helpTitle">{{ trans('firefly.pleaseHold') }}</h4>
</div>
<div class="modal-body" id="helpBody">
<i class="fa fa-refresh fa-spin"></i>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('firefly.close') }}</button>
</div>
</div>
</div>

View File

@@ -1,6 +1,7 @@
<table class="table table-bordered table-striped">
<table class="table table-bordered table-striped sortable">
<thead>
<tr>
<th>&nbsp;</th>
<th data-defaultsort="disabled">&nbsp;</th>
<th>Name</th>
<th>Matches on</th>
<th colspan="2">Matching amount</th>
@@ -9,8 +10,9 @@
<th>Is active</th>
<th>Will be automatched</th>
<th>Repeats every</th>
<th>&nbsp;</th>
</tr>
<th data-defaultsort="disabled">&nbsp;</th>
</tr></thead>
<tbody>
{% for entry in bills %}
<tr>
<td>
@@ -22,46 +24,52 @@
<td>
<a href="{{route('bills.show',entry.id)}}" title="{{ entry.name }}">{{ entry.name }}</a>
</td>
<td>
<td data-value="{{ entry.match }}">
{% for match in entry.match|split(',') %}
<span class="label label-info">{{ match }}</span>
{% endfor %}
</td>
<td>
<td data-value="{{ entry.amount_min }}">
{{ entry.amount_min|formatAmount }}
</td>
<td>
<td data-value="{{ entry.amount_max }}">
{{ entry.amount_max|formatAmount }}
</td>
<td>
{% if entry.lastFoundMatch %}
<td data-value="{{ entry.lastFoundMatch.format('U') }}">
{{entry.lastFoundMatch.format('j F Y')}}
{% else %}
<em>Unknown</em>
{% endif %}
</td>
<td>
{% else %}
<td data-value="0">
<em>Unknown</em>
</td>
{% endif %}
{% if entry.nextExpectedMatch%}
<td data-value="{{entry.nextExpectedMatch.format('U')}}">
{{entry.nextExpectedMatch.format('j F Y')}}
{% else %}
<em>Unknown</em>
{% endif %}
</td>
<td>
{% else %}
<td data-value="0">
<em>Unknown</em>
</td>
{% endif %}
<td data-value="{{ entry.active }}">
{% if entry.active %}
<i class="fa fa-fw fa-check"></i>
{% else %}
<i class="fa fa-fw fa-ban"></i>
{% endif %}
</td>
<td>
<td data-value="{{ entry.automatch }}">
{% if entry.automatch %}
<i class="fa fa-fw fa-check"></i>
{% else %}
<i class="fa fa-fw fa-ban"></i>
{% endif %}
</td>
<td>
<td data-value="{{ entry.repeat_freq }}{{ entry.skip }}">
{{ entry.repeat_freq }}
{% if entry.skip > 0 %}
skips over {{entry.skip}}
@@ -75,4 +83,5 @@
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -8,7 +8,7 @@
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-fw fa-exclamation"></i> Mandatory fields
<i class="fa fa-fw fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
@@ -20,10 +20,9 @@
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for optional fields -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.date('targetdate') }}
@@ -35,7 +34,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','piggy bank') }}

View File

@@ -10,7 +10,7 @@
<div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-fw fa-exclamation"></i> Mandatory fields
<i class="fa fa-fw fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
@@ -23,10 +23,9 @@
</div>
<div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for optional fields -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.date('targetdate') }}
@@ -38,7 +37,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','piggy bank') }}

View File

@@ -7,7 +7,7 @@
<div class="col-lg-5 col-md-5 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-tag"></i> Mandatory fields
<i class="fa fa-tag"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('tag') }}
@@ -20,7 +20,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.date('date') }}
@@ -32,7 +32,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','tag') }}

View File

@@ -9,7 +9,7 @@
<div class="col-lg-5 col-md-5 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-tag"></i> Mandatory fields
<i class="fa fa-tag"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.text('tag') }}
@@ -22,7 +22,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
{{ ExpandedForm.date('date') }}
@@ -34,7 +34,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','tag') }}

View File

@@ -6,10 +6,9 @@
<input type="hidden" name="what" value="{{ what }}" />
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for mandatory fields -->
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-exclamation-circle"></i> Mandatory fields
<i class="fa fa-exclamation-circle"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
<!-- DESCRIPTION ALWAYS AVAILABLE -->
@@ -46,10 +45,9 @@
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for optional fields -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
<!-- BUDGET ONLY WHEN CREATING A WITHDRAWAL -->
@@ -73,7 +71,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('create','transaction') }}

View File

@@ -5,7 +5,6 @@
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<!-- panel for mandatory fields -->
<div class="panel panel-danger">
<div class="panel-heading">
<i class="fa fa-exclamation-circle"></i> Destroy "{{ journal.description }}"

View File

@@ -8,10 +8,9 @@
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for mandatory fields -->
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-exclamation-circle"></i> Mandatory fields
<i class="fa fa-exclamation-circle"></i> {{ trans('firefly.mandatoryFields') }}
</div>
<div class="panel-body">
<!-- ALWAYS AVAILABLE -->
@@ -48,10 +47,9 @@
</div>
<div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for optional fields -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
<i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div>
<div class="panel-body">
<!-- BUDGET ONLY WHEN CREATING A WITHDRAWAL -->
@@ -76,7 +74,7 @@
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
<i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div>
<div class="panel-body">
{{ ExpandedForm.optionsList('update','transaction') }}

View File

@@ -1,7 +1,6 @@
<?php
use League\FactoryMuffin\Facade as FactoryMuffin;
if (!class_exists('RandomString')) {
/**
* Class RandomString
@@ -61,7 +60,9 @@ FactoryMuffin::define(
'account_type_id' => 'factory|FireflyIII\Models\AccountType',
'name' => 'word',
'active' => 'boolean',
'encrypted' => 'boolean',
'encrypted' => function () {
return true;
},
'virtual_balance' => 0
]
);
@@ -138,7 +139,9 @@ FactoryMuffin::define(
'budget_limit_id' => 'factory|FireflyIII\Models\BudgetLimit',
'startdate' => 'date',
'enddate' => 'date',
'amount' => 'integer',
'amount' => function () {
return rand(1, 100);
},
]
);
@@ -147,7 +150,9 @@ FactoryMuffin::define(
[
'budget_id' => 'factory|FireflyIII\Models\Budget',
'startdate' => 'date',
'amount' => 'integer',
'amount' => function () {
return rand(1, 100);
},
'repeats' => 'false',
'repeat_freq' => 'monthly',
@@ -218,7 +223,9 @@ FactoryMuffin::define(
[
'account_id' => 'factory|FireflyIII\Models\Account',
'name' => 'sentence',
'targetamount' => 'integer',
'targetamount' => function () {
return rand(1, 100);
},
'startdate' => 'date',
'targetdate' => 'date',
'reminder_skip' => 0,
@@ -227,6 +234,19 @@ FactoryMuffin::define(
]
);
FactoryMuffin::define(
'FireflyIII\Models\PiggyBankRepetition',
[
'piggy_bank_id' => 'factory|FireflyIII\Models\PiggyBank',
'startdate' => 'date',
'targetdate' => 'date',
'currentamount' => function () {
return rand(1, 100);
},
]
);
FactoryMuffin::define(
'FireflyIII\Models\PiggyBankEvent',
[

View File

@@ -0,0 +1,916 @@
<?php
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\PiggyBankRepetition;
use FireflyIII\Models\Preference;
use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Account\AccountRepository;
use Illuminate\Pagination\LengthAwarePaginator;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 16:33:55.
*/
class AccountRepositoryTest extends TestCase
{
/**
* @var AccountRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new AccountRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::countAccounts
* @todo Implement testCountAccounts().
*/
public function testCountAccounts()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$type = $account->accountType->type;
$this->be($account->user);
$this->assertEquals(1, $this->object->countAccounts([$type]));
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::destroy
*/
public function testDestroy()
{
// create account:
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$id = $account->id;
$this->be($account->user);
$this->object->destroy($account);
// cannot find account:
$this->assertCount(0, Account::whereId($id)->whereNotNull('deleted_at')->get());
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getAccounts
*/
public function testGetAccounts()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$type = $account->accountType->type;
$this->be($account->user);
$this->assertCount(1, $this->object->getAccounts([$type]));
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getCreditCards
* @todo Implement testGetCreditCards().
*/
public function testGetCreditCards()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
// create account meta object:
$meta = new AccountMeta;
$meta->name = 'accountRole';
$meta->data = 'ccAsset';
$meta->account_id = $account->id;
$meta->save();
// meta account type
$meta = new AccountMeta;
$meta->name = 'ccType';
$meta->data = 'monthlyFull';
$meta->account_id = $account->id;
$meta->save();
// login
$this->be($account->user);
// test!
$this->assertCount(1, $this->object->getCreditCards());
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getFirstTransaction
*/
public function testGetFirstTransaction()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
// two matching transactions:
$first = Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal->id,
'amount' => 100,
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal->id,
'amount' => -100,
]
);
// login
$this->be($account->user);
$oldest = $this->object->getFirstTransaction($journal, $account);
$this->assertEquals($oldest->amount, $first->amount);
$this->assertEquals($oldest->id, $first->id);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getFrontpageAccounts
*/
public function testGetFrontpageAccounts()
{
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
// making two account types is kind of cheating but it works.
$account = FactoryMuffin::create('FireflyIII\Models\Account');
/** @var Preference $preference */
$preference = FactoryMuffin::create('FireflyIII\Models\Preference');
$preference->data = [];
$preference->save();
$this->be($account->user);
$set = $this->object->getFrontpageAccounts($preference);
$this->assertEquals($account->id, $set->first()->id);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getFrontpageAccounts
*/
public function testGetFrontpageAccountsWithPreference()
{
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
// making two account types is kind of cheating but it works.
$account = FactoryMuffin::create('FireflyIII\Models\Account');
/** @var Preference $preference */
$preference = FactoryMuffin::create('FireflyIII\Models\Preference');
$preference->data = [$account->id];
$preference->save();
$this->be($account->user);
$set = $this->object->getFrontpageAccounts($preference);
$this->assertEquals($account->id, $set->first()->id);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getFrontpageTransactions
*/
public function testGetFrontpageTransactions()
{
// three journals
/** @var Account $account */
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal3 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
// three dates (one is out of bounds)
$journal1->date = new Carbon('2012-01-02');
$journal1->user_id = $account->user_id;
$journal2->date = new Carbon('2012-01-09');
$journal2->user_id = $account->user_id;
$journal3->date = new Carbon('2012-02-02');
$journal3->user_id = $account->user_id;
// save all
$journal1->save();
$journal2->save();
$journal3->save();
// transactions to match the dates (one per journal will do)
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal1->id,
'amount' => 100
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal2->id,
'amount' => 100
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal3->id,
'amount' => 100
]
);
// be user
$this->be($journal1->user);
// get set:
$set = $this->object->getFrontpageTransactions($account, new Carbon('2012-01-01'), new Carbon('2012-01-31'));
// should have two left.
$this->assertCount(2, $set);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getJournals
*/
public function testGetJournals()
{
$date = new Carbon;
// three journals
/** @var Account $account */
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal3 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
// three dates (one is out of bounds)
$journal1->date = $date;
$journal1->user_id = $account->user_id;
$journal2->date = $date;
$journal2->user_id = $account->user_id;
$journal3->date = $date;
$journal3->user_id = $account->user_id;
// save all
$journal1->save();
$journal2->save();
$journal3->save();
// transactions to match the dates (one per journal will do)
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal1->id,
'amount' => 100
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal2->id,
'amount' => 100
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal3->id,
'amount' => 100
]
);
// be user
$this->be($journal1->user);
// get paginator:
/** @var LengthAwarePaginator $paginator */
$paginator = $this->object->getJournals($account, 1);
// should have three entries:
$this->assertEquals(3, $paginator->count());
$this->assertEquals(1, $paginator->currentPage());
$this->assertFalse($paginator->isEmpty());
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getLastActivity
*/
public function testGetLastActivity()
{
$date = new Carbon('2012-02-02');
// one journal
/** @var Account $account */
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->date = $date;
$journal->user_id = $account->user_id;
$journal->save();
// transaction to match the date (one will do)
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal->id,
'amount' => 100
]
);
// be user
$this->be($journal->user);
$latest = $this->object->getLastActivity($account);
$this->assertEquals($date->format('Y-m-d'), $latest->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getLastActivity
*/
public function testGetLastActivityNoActivity()
{
/** @var Account $account */
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$this->be($account->user);
$latest = $this->object->getLastActivity($account);
$this->assertnull($latest);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getPiggyBankAccounts
*/
public function testGetPiggyBankAccounts()
{
$date = Carbon::now()->startOfMonth()->addDays(3);
/*
* Quite the collection of objects for this one.
*/
$piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$piggyBankRepetition = $piggyBank->piggybankRepetitions()->first();
/*
* Update id's to match each other:
*/
$piggyBankRepetition->currentamount = rand(1, 100);
$piggyBankRepetition->startdate = $date;
$piggyBankRepetition->targetdate = $date;
$piggyBank->account_id = $account->id;
$piggyBankRepetition->save();
$piggyBank->save();
/*
* Put dates in session:
*/
$this->session(['start' => Carbon::now()->startOfMonth(), 'end' => Carbon::now()->endOfMonth()]);
/*
* Run method:
*/
$this->be($account->user);
$collection = $this->object->getPiggyBankAccounts();
$this->assertCount(1, $collection);
$this->assertEquals($collection->first()->id, $account->id);
$this->assertEquals($collection->first()->piggyBalance, $piggyBankRepetition->currentamount);
$this->assertEquals(0, $collection->first()->startBalance);
$this->assertEquals(0, $collection->first()->endBalance);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getSavingsAccounts
*/
public function testGetSavingsAccounts()
{
// create three accounts:
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
$type = FactoryMuffin::create('FireflyIII\Models\AccountType');
$account1 = FactoryMuffin::create('FireflyIII\Models\Account');
$account1->account_type_id = $type->id;
$account2 = FactoryMuffin::create('FireflyIII\Models\Account');
$account2->account_type_id = $type->id;
$account3 = FactoryMuffin::create('FireflyIII\Models\Account');
$account3->account_type_id = $type->id;
// make them savings accounts:
$meta = new AccountMeta;
$meta->name = 'accountRole';
$meta->data = 'savingAsset';
$meta->account_id = $account1->id;
$meta->save();
$meta = new AccountMeta;
$meta->name = 'accountRole';
$meta->data = 'savingAsset';
$meta->account_id = $account2->id;
$meta->save();
$meta = new AccountMeta;
$meta->name = 'accountRole';
$meta->data = 'savingAsset';
$meta->account_id = $account3->id;
$meta->save();
// assign to the same user:
$account2->user_id = $account1->user_id;
$account3->user_id = $account1->user_id;
$account1->save();
$account2->save();
$account3->save();
$this->be($account1->user);
// mock steam balance:
Steam::shouldReceive('balance')->andReturn(0, 0, 1, 2, 4, 3);
// get the result from the method:
$result = $this->object->getSavingsAccounts();
$this->assertEquals(0, $result->get(0)->difference);
$this->assertEquals(1, $result->get(1)->difference);
$this->assertEquals(-1, $result->get(2)->difference);
$this->assertEquals(100, $result->get(0)->percentage);
$this->assertEquals(100, $result->get(1)->percentage);
$this->assertEquals(25, $result->get(2)->percentage);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getTransfersInRange
* @todo Implement testGetTransfersInRange().
*/
public function testGetTransfersInRange()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$date = new Carbon;
// three transfers, two out of range:
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal3 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$journal2->transaction_type_id = $journal1->transaction_type_id;
$journal3->transaction_type_id = $journal1->transaction_type_id;
// three transactions:
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal1->id,
'amount' => 100
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal2->id,
'amount' => 100
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal3->id,
'amount' => 100
]
);
// check date:
$start = new Carbon('2014-01-01');
$end = new Carbon('2014-01-31');
$inRange = new Carbon('2014-01-15');
$before = new Carbon('2013-01-15');
$after = new Carbon('2015-01-15');
// journal 1 will match:
$journal1->date = $inRange;
$journal1->user_id = $account->user_id;
$journal2->date = $before;
$journal2->user_id = $account->user_id;
$journal3->date = $after;
$journal3->user_id = $account->user_id;
$journal1->save();
$journal2->save();
$journal3->save();
$this->be($account->user);
$set = $this->object->getTransfersInRange($account, $start, $end);
$this->assertEquals(1, $set->count());
$this->assertEquals(100, $set->first()->amount);
$this->assertEquals($journal1->description, $set->first()->description);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::leftOnAccount
*/
public function testLeftOnAccount()
{
$piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
$piggyBankRepetition = $piggyBank->piggybankRepetitions()->first();
$piggyBankRepetition->currentamount = rand(1, 100);
$piggyBankRepetition->save();
$this->be($piggyBank->account->user);
$result = $this->object->leftOnAccount($piggyBank->account);
$this->assertEquals($piggyBankRepetition->currentamount * -1, $result);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::openingBalanceTransaction
*/
public function testOpeningBalanceTransaction()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
// two transactions:
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal1->id,
'amount' => 100
]
);
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal2->id,
'amount' => 100
]
);
// dates
$one = new Carbon('2013-01-15');
$two = new Carbon('2015-01-15');
// journal 1 will match:
$journal1->date = $one;
$journal1->user_id = $account->user_id;
$journal2->date = $two;
$journal2->user_id = $account->user_id;
$journal1->save();
$journal2->save();
$this->be($account->user);
$result = $this->object->openingBalanceTransaction($account);
$this->assertEquals($journal1->id, $result->id);
$this->assertEquals($journal1->description, $result->description);
$this->assertEquals(100, $result->amount);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::openingBalanceTransaction
*/
public function testOpeningBalanceTransactionNull()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$this->be($account->user);
$result = $this->object->openingBalanceTransaction($account);
$this->assertNull($result);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::store
* @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
* @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
* @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
*/
public function testStore()
{
$user = FactoryMuffin::create('FireflyIII\User');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->be($user);
$data = [
'accountType' => 'expense',
'user' => $user->id,
'name' => 'Test account #' . rand(1, 100),
'active' => true,
'accountRole' => 'testAccount',
'openingBalance' => 100,
'virtualBalance' => 0,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-01-01',
];
$account = $this->object->store($data);
$this->assertEquals($data['name'], $account->name);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::store
* @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
* @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
* @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
*/
public function testStoreWithExistingAccount()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->be($account->user);
$data = [
'accountType' => 'expense',
'user' => $account->user->id,
'name' => $account->name,
'active' => $account->active,
'accountRole' => 'testAccount',
'openingBalance' => 0,
'virtualBalance' => 0,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-01-01',
];
$newAccount = $this->object->store($data);
$this->assertEquals($account->name, $newAccount->name);
$this->assertEquals($account->id, $newAccount->id);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::store
* @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
* @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
* @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
* @expectedException Symfony\Component\HttpKernel\Exception\HttpException
*/
public function testStoreWithInvalidAccountData()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->be($account->user);
$data = [
'accountType' => 'expense',
'user' => $account->user->id + 12,
'name' => $account->name,
'active' => $account->active,
'accountRole' => 'testAccount',
'openingBalance' => 0,
'virtualBalance' => 0,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-01-01',
];
$this->object->store($data);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::store
* @covers FireflyIII\Repositories\Account\AccountRepository::storeAccount
* @covers FireflyIII\Repositories\Account\AccountRepository::storeMetadata
* @covers FireflyIII\Repositories\Account\AccountRepository::storeInitialBalance
*/
public function testStoreWithNegativeInitialBalance()
{
$user = FactoryMuffin::create('FireflyIII\User');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->be($user);
$data = [
'accountType' => 'expense',
'user' => $user->id,
'name' => 'Test account #' . rand(1, 100),
'active' => true,
'accountRole' => 'testAccount',
'openingBalance' => -100,
'virtualBalance' => 0,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-01-01',
];
$account = $this->object->store($data);
$this->assertEquals($data['name'], $account->name);
$this->assertEquals(-100, $account->transactions()->first()->amount);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::sumOfEverything
*/
public function testSumOfEverything()
{
$user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$this->assertEquals(0, $this->object->sumOfEverything());
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::update
* @covers FireflyIII\Repositories\Account\AccountRepository::updateMetadata
* @covers FireflyIII\Repositories\Account\AccountRepository::updateInitialBalance
*/
public function testUpdate()
{
$user = FactoryMuffin::create('FireflyIII\User');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->be($user);
$data = [
'accountType' => 'expense',
'user' => $user->id,
'name' => 'Test account #' . rand(1, 100),
'active' => true,
'accountRole' => 'testAccount',
'openingBalance' => 100,
'virtualBalance' => 0,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-01-01',
];
$account = $this->object->store($data);
// now update that same account:
$data = [
'name' => 'New account name' . rand(0, 100),
'active' => 1,
'virtualBalance' => 0,
'openingBalance' => 50,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-02-02',
];
$newAccount = $this->object->update($account, $data);
$this->assertEquals($data['name'], $newAccount->name);
$this->assertEquals(50, $account->transactions()->first()->amount);
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::update
* @covers FireflyIII\Repositories\Account\AccountRepository::updateMetadata
* @covers FireflyIII\Repositories\Account\AccountRepository::updateInitialBalance
*/
public function testUpdateDeleteOpeningBalance()
{
$user = FactoryMuffin::create('FireflyIII\User');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->be($user);
$data = [
'accountType' => 'expense',
'user' => $user->id,
'name' => 'Test account #' . rand(1, 100),
'active' => true,
'accountRole' => 'testAccount',
'openingBalance' => 100,
'virtualBalance' => 0,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-01-01',
];
$account = $this->object->store($data);
// now update that same account:
$data = [
'name' => 'New account name' . rand(0, 100),
'active' => 1,
'user' => $user->id,
'accountRole' => 'testAccount',
'virtualBalance' => 0,
'openingBalance' => 0,
];
$newAccount = $this->object->update($account, $data);
$this->assertEquals($data['name'], $newAccount->name);
$this->assertEquals(0, $newAccount->transactions()->whereNull('deleted_at')->count());
}
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::update
* @covers FireflyIII\Repositories\Account\AccountRepository::updateMetadata
* @covers FireflyIII\Repositories\Account\AccountRepository::updateInitialBalance
*/
public function testUpdateNewOpeningBalance()
{
$user = FactoryMuffin::create('FireflyIII\User');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->be($user);
$data = [
'accountType' => 'expense',
'user' => $user->id,
'name' => 'Test account #' . rand(1, 100),
'active' => true,
'accountRole' => 'testAccount',
'openingBalance' => 0,
'virtualBalance' => 0,
];
$account = $this->object->store($data);
// now update that same account:
$data = [
'name' => 'New account name' . rand(0, 100),
'active' => 1,
'user' => $user->id,
'virtualBalance' => 0,
'accountRole' => 'testAccount',
'ccMonthlyPaymentDate' => '2015-01-01',
'openingBalance' => 51,
'openingBalanceCurrency' => $currency->id,
'openingBalanceDate' => '2015-02-02',
];
$newAccount = $this->object->update($account, $data);
$this->assertEquals($data['name'], $newAccount->name);
$this->assertEquals(51, $account->transactions()->first()->amount);
}
}

View File

@@ -0,0 +1,464 @@
<?php
use Carbon\Carbon;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Bill\BillRepository;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-08 at 10:43:42.
*/
class BillRepositoryTest extends TestCase
{
/**
* @var BillRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new BillRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::createFakeBill
*/
public function testCreateFakeBill()
{
$description = 'Fake bill ' . rand(10, 100);
$date = new Carbon('2013-01-01');
$amount = 1200;
$bill = $this->object->createFakeBill($description, $date, $amount);
$this->assertEquals($amount, $bill->amount_max);
$this->assertEquals($amount, $bill->amount_min);
$this->assertNull($bill->id);
$this->assertEquals($description, $bill->name);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::destroy
*/
public function testDestroy()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$id = $bill->id;
$this->object->destroy($bill);
// cannot find bill:
$this->assertCount(0, Bill::whereId($id)->whereNotNull('deleted_at')->get());
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getActiveBills
*/
public function testGetActiveBills()
{
$bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill2 = FactoryMuffin::create('FireflyIII\Models\Bill');
// update bills
$bill1->active = 1;
$bill2->active = 0;
$bill2->user_id = $bill1->user_id;
$bill1->save();
$bill2->save();
$this->be($bill1->user);
$set = $this->object->getActiveBills();
$this->assertCount(1, $set);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getBills
*/
public function testGetBills()
{
$bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill2 = FactoryMuffin::create('FireflyIII\Models\Bill');
// update bills
$bill1->active = 1;
$bill2->active = 0;
$bill2->user_id = $bill1->user_id;
$bill1->save();
$bill2->save();
$this->be($bill1->user);
$set = $this->object->getBills();
$this->assertCount(2, $set);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getJournals
*/
public function testGetJournals()
{
$bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
// update bills
$bill1->active = 1;
$bill1->save();
$this->be($bill1->user);
$set = $this->object->getJournals($bill1);
$this->assertCount(0, $set);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getJournalsInRange
* @todo Implement testGetJournalsInRange().
*/
public function testGetJournalsInRange()
{
$bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
// update bills
$bill1->active = 1;
$bill1->save();
$this->be($bill1->user);
$set = $this->object->getJournalsInRange($bill1, new Carbon, new Carbon);
$this->assertCount(0, $set);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getPossiblyRelatedJournals
* @todo Implement testGetPossiblyRelatedJournals().
*/
public function testGetPossiblyRelatedJournals()
{
$bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$bill1->amount_min = 100;
$bill1->amount_max = 1000;
$account->user_id = $bill1->user_id;
$bill1->save();
$account->save();
// create some transactions to match our bill:
for ($i = 0; $i < 8; $i++) {
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->user_id = $bill1->user_id;
$journal->save();
Transaction::create(
[
'account_id' => $account->id,
'transaction_journal_id' => $journal->id,
'amount' => rand(101, 999),
]
);
}
$this->be($bill1->user);
$set = $this->object->getPossiblyRelatedJournals($bill1);
$this->assertCount(8, $set);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getRanges
*/
public function testGetRanges()
{
$bill1 = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill1->date = new Carbon('2012-01-01');
$bill1->repeat_freq = 'monthly';
$bill1->save();
$set = $this->object->getRanges($bill1, new Carbon('2012-01-01'), new Carbon('2012-12-31'));
$this->assertCount(12, $set);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::lastFoundMatch
*/
public function testLastFoundMatch()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->bill_id = $bill->id;
$journal->user_id = $bill->user_id;
$journal->save();
$this->be($bill->user);
$date = $this->object->lastFoundMatch($bill);
$this->assertEquals($journal->date->format('Y-m-d'), $date->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::lastFoundMatch
*/
public function testLastFoundMatchNull()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$this->be($bill->user);
$date = $this->object->lastFoundMatch($bill);
$this->assertNull($date);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::nextExpectedMatch
*/
public function testNextExpectedMatch()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill->date = new Carbon('2012-01-07');
$bill->repeat_freq = 'monthly';
$bill->save();
$this->be($bill->user);
// journal:
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->date = Carbon::now()->format('Y-m-d');
$journal->user_id = $bill->user_id;
$journal->bill_id = $bill->id;
$journal->save();
$next = $this->object->nextExpectedMatch($bill);
$today = Carbon::now()->endOfMonth()->addDay();
$this->assertEquals($today->format('Y-m-d'), $next->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::nextExpectedMatch
*/
public function testNextExpectedMatchInactive()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill->active = 0;
$bill->save();
$this->be($bill->user);
$this->assertNull($this->object->nextExpectedMatch($bill));
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::nextExpectedMatch
*/
public function testNextExpectedMatchNoJournals()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill->date = new Carbon('2012-01-07');
$bill->repeat_freq = 'monthly';
$bill->save();
$this->be($bill->user);
$next = $this->object->nextExpectedMatch($bill);
$today = Carbon::now()->startOfMonth();
$this->assertEquals($today->format('Y-m-d'), $next->format('Y-m-d'));
}
/**
* One
*
* @covers FireflyIII\Repositories\Bill\BillRepository::scan
*/
public function testScanMatch()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill->date = new Carbon('2012-01-07');
$bill->repeat_freq = 'monthly';
$bill->match = 'jemoeder';
$bill->amount_min = 90;
$bill->amount_max = 110;
$bill->save();
$this->be($bill->user);
// journal:
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->date = Carbon::now()->format('Y-m-d');
$journal->description = 'jemoeder';
$journal->user_id = $bill->user_id;
$journal->save();
// two transactions:
$account1 = FactoryMuffin::create('FireflyIII\Models\Account');
$account2 = FactoryMuffin::create('FireflyIII\Models\Account');
Transaction::create(
[
'account_id' => $account1->id,
'transaction_journal_id' => $journal->id,
'amount' => 100,
]
);
Transaction::create(
[
'account_id' => $account2->id,
'transaction_journal_id' => $journal->id,
'amount' => 100,
]
);
$this->object->scan($bill, $journal);
$newJournal = TransactionJournal::find($journal->id);
$this->assertEquals($bill->id, $newJournal->bill_id);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::scan
*/
public function testScanNoMatch()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill->date = new Carbon('2012-01-07');
$bill->repeat_freq = 'monthly';
$bill->save();
$this->be($bill->user);
// journal:
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->date = Carbon::now()->format('Y-m-d');
$journal->user_id = $bill->user_id;
$journal->save();
// two transactions:
$account1 = FactoryMuffin::create('FireflyIII\Models\Account');
$account2 = FactoryMuffin::create('FireflyIII\Models\Account');
Transaction::create(
[
'account_id' => $account1->id,
'transaction_journal_id' => $journal->id,
'amount' => 100,
]
);
Transaction::create(
[
'account_id' => $account2->id,
'transaction_journal_id' => $journal->id,
'amount' => 100,
]
);
$this->object->scan($bill, $journal);
$newJournal = TransactionJournal::find($journal->id);
$this->assertNull($newJournal->bill_id);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::scan
*/
public function testScanNoMatchButAttached()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$bill->date = new Carbon('2012-01-07');
$bill->match = 'blablabla';
$bill->repeat_freq = 'monthly';
$bill->save();
$this->be($bill->user);
// journal:
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->date = Carbon::now()->format('Y-m-d');
$journal->user_id = $bill->user_id;
$journal->bill_id = $bill->id;
$journal->save();
// two transactions:
$account1 = FactoryMuffin::create('FireflyIII\Models\Account');
$account2 = FactoryMuffin::create('FireflyIII\Models\Account');
Transaction::create(
[
'account_id' => $account1->id,
'transaction_journal_id' => $journal->id,
'amount' => 100,
]
);
Transaction::create(
[
'account_id' => $account2->id,
'transaction_journal_id' => $journal->id,
'amount' => 100,
]
);
$this->object->scan($bill, $journal);
$newJournal = TransactionJournal::find($journal->id);
$this->assertNull($newJournal->bill_id);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::store
*/
public function testStore()
{
$user = FactoryMuffin::create('FireflyIII\User');
$data = [
'name' => 'Something',
'match' => 'Something',
'amount_min' => 100,
'user' => $user->id,
'amount_max' => 110,
'date' => new Carbon,
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 1,
'active' => 1,
];
$bill = $this->object->store($data);
$this->assertEquals($data['name'], $bill->name);
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::update
* @todo Implement testUpdate().
*/
public function testUpdate()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$data = [
'name' => 'new Name',
'match' => $bill->match,
'amount_min' => 100,
'amount_max' => 110,
'date' => new Carbon,
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 1,
'active' => 1,
];
$newBill = $this->object->update($bill, $data);
$this->assertEquals($data['name'], $newBill->name);
$this->assertEquals($bill->match, $newBill->match);
}
}

View File

@@ -0,0 +1,385 @@
<?php
use Carbon\Carbon;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Repositories\Budget\BudgetRepository;
use Illuminate\Pagination\LengthAwarePaginator;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:16:07.
*/
class BudgetRepositoryTest extends TestCase
{
/**
* @var BudgetRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new BudgetRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::cleanupBudgets
*/
public function testCleanupBudgets()
{
// create some budgets:
for ($i = 0; $i < 3; $i++) {
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$limit->budget_id = $budget->id;
$limit->amount = 0;
$limit->save();
}
$this->object->cleanupBudgets();
$this->assertCount(0, BudgetLimit::get());
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::destroy
* @todo Implement testDestroy().
*/
public function testDestroy()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$this->object->destroy($budget);
$this->assertCount(0, Budget::where('id', $budget->id)->whereNull('deleted_at')->get());
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::expensesOnDay
* @todo Implement testExpensesOnDay().
*/
public function testExpensesOnDay()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$result = $this->object->expensesOnDay($budget, new Carbon);
$this->assertEquals(0, $result);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getActiveBudgets
*/
public function testGetActiveBudgets()
{
$budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget1->active = 1;
$budget2->active = 0;
$budget2->user_id = $budget1->user_id;
$budget1->save();
$budget2->save();
$this->be($budget1->user);
$set = $this->object->getActiveBudgets();
$this->assertCount(1, $set);
$this->assertEquals($set->first()->id, $budget1->id);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgetLimitRepetitions
*/
public function testGetBudgetLimitRepetitions()
{
$rep = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
$limit = $rep->budgetlimit;
$limit->startdate = new Carbon('2015-02-02');
$rep->startdate = new Carbon('2015-02-02');
$rep->enddate = new Carbon('2015-02-28');
$limit->save();
$rep->save();
$set = $this->object->getBudgetLimitRepetitions($rep->budgetlimit->budget, new Carbon('2015-02-01'), new Carbon('2015-02-28'));
$this->assertCount(2, $set);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgetLimits
*/
public function testGetBudgetLimits()
{
/** @var Budget $budget */
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$set = $this->object->getBudgetLimits($budget);
$this->assertCount(0, $set);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgets
*/
public function testGetBudgets()
{
$budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget1->active = 1;
$budget2->active = 0;
$budget2->user_id = $budget1->user_id;
$budget1->save();
$budget2->save();
$this->be($budget1->user);
$set = $this->object->getBudgets();
$this->assertCount(2, $set);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getCurrentRepetition
*/
public function testGetCurrentRepetition()
{
/** @var Budget $budget */
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$rep = $this->object->getCurrentRepetition($budget, new Carbon);
$this->assertNull($rep);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getFirstBudgetLimitDate
*/
public function testGetFirstBudgetLimitDate()
{
/** @var BudgetLimit $budget */
$limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$date = $this->object->getFirstBudgetLimitDate($limit->budget);
$this->assertEquals($date->format('Y-m-d'), $limit->startdate->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getFirstBudgetLimitDate
*/
public function testGetFirstBudgetLimitDateNull()
{
/** @var Budget $budget */
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$date = $this->object->getFirstBudgetLimitDate($budget);
$ownDate = Carbon::now()->startOfYear();
$this->assertEquals($date->format('Y-m-d'), $ownDate->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getInactiveBudgets
*/
public function testGetInactiveBudgets()
{
$budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget1->active = 1;
$budget2->active = 0;
$budget2->user_id = $budget1->user_id;
$budget1->save();
$budget2->save();
$this->be($budget1->user);
$set = $this->object->getInactiveBudgets();
$this->assertCount(1, $set);
$this->assertEquals($set->first()->id, $budget2->id);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getJournals
*/
public function testGetJournals()
{
$repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
$set = $this->object->getJournals($repetition->budgetlimit->budget, $repetition);
$this->assertTrue($set instanceof LengthAwarePaginator);
$this->assertCount(0, $set);
$this->assertEquals(1, $set->currentPage());
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getLastBudgetLimitDate
*/
public function testGetLastBudgetLimitDate()
{
/** @var BudgetLimit $budget */
$limit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$date = $this->object->getLastBudgetLimitDate($limit->budget);
$this->assertEquals($date->format('Y-m-d'), $limit->startdate->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getLastBudgetLimitDate
*/
public function testGetLastBudgetLimitDateNull()
{
/** @var Budget $budget */
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$date = $this->object->getLastBudgetLimitDate($budget);
$ownDate = Carbon::now()->startOfYear();
$this->assertEquals($date->format('Y-m-d'), $ownDate->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getLimitAmountOnDate
*/
public function testGetLimitAmountOnDate()
{
$rep = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
$amount = $this->object->getLimitAmountOnDate($rep->budgetlimit->budget, $rep->startdate);
$this->assertEquals($rep->amount, $amount);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getLimitAmountOnDate
*/
public function testGetLimitAmountOnDateNull()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$amount = $this->object->getLimitAmountOnDate($budget, new Carbon);
$this->assertNull($amount);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getWithoutBudget
*/
public function testGetWithoutBudget()
{
$user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$set = $this->object->getWithoutBudget(new Carbon, new Carbon);
$this->assertCount(0, $set);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getWithoutBudgetSum
*/
public function testGetWithoutBudgetSum()
{
$user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$sum = $this->object->getWithoutBudgetSum(new Carbon, new Carbon);
$this->assertEquals(0, $sum);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::spentInMonth
*/
public function testSpentInMonth()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$amount = $this->object->spentInMonth($budget, new Carbon);
$this->assertEquals(0, $amount);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::store
*/
public function testStore()
{
$user = FactoryMuffin::create('FireflyIII\User');
$data = [
'name' => 'new budget ' . rand(1, 100),
'user' => $user->id
];
$result = $this->object->store($data);
$this->assertTrue($result instanceof Budget);
$this->assertEquals($result->name, $data['name']);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::sumBudgetExpensesInPeriod
*/
public function testSumBudgetExpensesInPeriod()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$result = $this->object->sumBudgetExpensesInPeriod($budget, new Carbon, new Carbon);
$this->assertEquals(0, $result);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::update
*/
public function testUpdate()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$data = [
'name' => 'update budget ' . rand(1, 100),
'active' => true
];
$result = $this->object->update($budget, $data);
$this->assertTrue($result instanceof Budget);
$this->assertEquals($result->name, $data['name']);
$this->assertEquals($result->id, $budget->id);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::updateLimitAmount
*/
public function testUpdateLimitAmount()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$result = $this->object->updateLimitAmount($budget, new Carbon, 100);
$this->assertTrue($result instanceof BudgetLimit);
$this->assertEquals($result->amount, 100);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::updateLimitAmount
*/
public function testUpdateLimitAmountExisting()
{
$budgetLimit= FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 100);
$this->assertTrue($result instanceof BudgetLimit);
$this->assertEquals($result->amount, 100);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::updateLimitAmount
*/
public function testUpdateLimitAmountZero()
{
$budgetLimit= FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 0);
$this->assertTrue($result instanceof BudgetLimit);
}
}

View File

@@ -0,0 +1,253 @@
<?php
use Carbon\Carbon;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepository;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32.
*/
class CategoryRepositoryTest extends TestCase
{
/**
* @var CategoryRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new CategoryRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::countJournals
*/
public function testCountJournals()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$result = $this->object->countJournals($category);
$this->assertEquals(0, $result);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::destroy
* @todo Implement testDestroy().
*/
public function testDestroy()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$this->object->destroy($category);
$count = Category::where('id', $category->id)->whereNull('deleted_at')->count();
$this->assertEquals(0, $count);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getCategories
*/
public function testGetCategories()
{
$user = FactoryMuffin::create('FireflyIII\User');
$cat1 = FactoryMuffin::create('FireflyIII\Models\Category');
$cat2 = FactoryMuffin::create('FireflyIII\Models\Category');
$cat1->name = 'BBBBB';
$cat2->name = 'AAAAA';
$cat1->user_id = $user->id;
$cat2->user_id = $user->id;
$cat1->save();
$cat2->save();
$this->be($user);
$set = $this->object->getCategories();
$this->assertEquals('AAAAA', $set->first()->name);
$this->assertCount(2, $set);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getCategoriesAndExpenses
*/
public function testGetCategoriesAndExpenses()
{
$user = FactoryMuffin::create('FireflyIII\User');
$type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
// some journals and categories:
for ($i = 0; $i < 5; $i++) {
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
/** @var Category $category */
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$journal->user_id = $user->id;
$journal->date = new Carbon('2015-02-11');
$journal->transaction_type_id = $type->id;
$category->user_id = $user->id;
$category->transactionjournals()->save($journal);
$journal->save();
$category->save();
}
$this->be($user);
$set = $this->object->getCategoriesAndExpenses(new Carbon('2015-02-01'), new Carbon('2015-02-28'));
$this->assertCount(5, $set);
$this->assertEquals(0, $set->first()->sum);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getFirstActivityDate
*/
public function testGetFirstActivityDate()
{
$user = FactoryMuffin::create('FireflyIII\User');
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
/** @var Category $category */
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$journal->user_id = $user->id;
$journal->date = new Carbon('2015-02-11');
$category->user_id = $user->id;
$category->transactionjournals()->save($journal);
$journal->save();
$category->save();
$this->be($user);
$date = $this->object->getFirstActivityDate($category);
$this->assertEquals('2015-02-11', $date->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getFirstActivityDate
*/
public function testGetFirstActivityDateNull()
{
/** @var Category $category */
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$this->be($category->user);
$date = $this->object->getFirstActivityDate($category);
$this->assertEquals(Carbon::now()->format('Y-m-d'), $date->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getJournals
*/
public function testGetJournals()
{
/** @var Category $category */
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$this->be($category->user);
$set = $this->object->getJournals($category, 1);
$this->assertEquals(0, $set->count());
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getLatestActivity
*/
public function testGetLatestActivity()
{
$user = FactoryMuffin::create('FireflyIII\User');
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
/** @var Category $category */
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$journal->user_id = $user->id;
$journal->date = new Carbon('2015-02-11');
$category->user_id = $user->id;
$category->transactionjournals()->save($journal);
$journal->save();
$category->save();
$this->be($user);
$date = $this->object->getLatestActivity($category);
$this->assertEquals('2015-02-11', $date->format('Y-m-d'));
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getWithoutCategory
*/
public function testGetWithoutCategory()
{
$user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$set = $this->object->getWithoutCategory(new Carbon, new Carbon);
$this->assertCount(0, $set);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentInPeriodSum
*/
public function testSpentInPeriodSum()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$sum = $this->object->spentInPeriodSum($category, new Carbon, new Carbon);
$this->assertEquals(0, $sum);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentOnDaySum
*/
public function testSpentOnDaySum()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$sum = $this->object->spentOnDaySum($category, new Carbon);
$this->assertEquals(0, $sum);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::store
*/
public function testStore()
{
$user = FactoryMuffin::create('FireflyIII\User');
$data = [
'name' => 'New category' . rand(1, 100),
'user' => $user->id
];
$newCategory = $this->object->store($data);
$this->assertEquals($data['name'], $newCategory->name);
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::update
*/
public function testUpdate()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$data = [
'name' => 'New category' . rand(1, 100),
];
$newCategory = $this->object->update($category, $data);
$this->assertEquals($data['name'], $newCategory->name);
}
public function testgetLatestActivityNull()
{
/** @var Category $category */
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$this->be($category->user);
$date = $this->object->getLatestActivity($category);
$this->assertNull($date);
}
}

View File

@@ -0,0 +1,114 @@
<?php
use FireflyIII\Repositories\Currency\CurrencyRepository;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32.
*/
class CurrencyRepositoryTest extends TestCase
{
/**
* @var CurrencyRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new CurrencyRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::countJournals
*/
public function testCountJournals()
{
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$count = $this->object->countJournals($currency);
$this->assertEquals(0, $count);
}
/**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::get
*/
public function testGet()
{
FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$set = $this->object->get();
$this->assertCount(2, $set);
}
/**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference
*/
public function testGetCurrencyByPreference()
{
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$preference = FactoryMuffin::create('FireflyIII\Models\Preference');
$preference->data = $currency->code;
$preference->save();
$found = $this->object->getCurrencyByPreference($preference);
$this->assertEquals($currency->id, $found->id);
}
/**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference
*/
public function testGetCurrencyByPreferenceNull()
{
$first = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$preference = FactoryMuffin::create('FireflyIII\Models\Preference');
$preference->data = 'ABC';
$preference->save();
$found = $this->object->getCurrencyByPreference($preference);
$this->assertEquals($first->id, $found->id);
}
/**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::store
*/
public function testStore()
{
$data = [
'name' => 'Some Currency',
'code' => 'ABC',
'symbol' => 'S'
];
$currency = $this->object->store($data);
$this->assertEquals($data['name'], $currency->name);
}
/**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::update
*/
public function testUpdate()
{
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$data = [
'name' => 'Some Currency',
'code' => 'ABC',
'symbol' => 'S'
];
$newCurrency = $this->object->update($currency, $data);
$this->assertEquals($data['name'], $newCurrency->name);
$this->assertEquals($currency->id, $newCurrency->id);
}
}

View File

@@ -0,0 +1,176 @@
<?php
use FireflyIII\Repositories\Journal\JournalRepository;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32.
*/
class JournalRepositoryTest extends TestCase
{
/**
* @var JournalRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new JournalRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::deactivateReminder
* @todo Implement testDeactivateReminder().
*/
public function testDeactivateReminder()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::delete
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::first
* @todo Implement testFirst().
*/
public function testFirst()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::getAmountBefore
* @todo Implement testGetAmountBefore().
*/
public function testGetAmountBefore()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::getJournalsOfType
* @todo Implement testGetJournalsOfType().
*/
public function testGetJournalsOfType()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::getJournalsOfTypes
* @todo Implement testGetJournalsOfTypes().
*/
public function testGetJournalsOfTypes()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::getTransactionType
* @todo Implement testGetTransactionType().
*/
public function testGetTransactionType()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::getWithDate
* @todo Implement testGetWithDate().
*/
public function testGetWithDate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::saveTags
* @todo Implement testSaveTags().
*/
public function testSaveTags()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::store
* @todo Implement testStore().
*/
public function testStore()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::update
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::updateTags
* @todo Implement testUpdateTags().
*/
public function testUpdateTags()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -0,0 +1,164 @@
<?php
use FireflyIII\Repositories\PiggyBank\PiggyBankRepository;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32.
*/
class PiggyBankRepositoryTest extends TestCase
{
/**
* @var PiggyBankRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new PiggyBankRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::calculateParts
* @todo Implement testCalculateParts().
*/
public function testCalculateParts()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::createEvent
* @todo Implement testCreateEvent().
*/
public function testCreateEvent()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::createPiggyBankPart
* @todo Implement testCreatePiggyBankPart().
*/
public function testCreatePiggyBankPart()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::destroy
* @todo Implement testDestroy().
*/
public function testDestroy()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::getEventSummarySet
* @todo Implement testGetEventSummarySet().
*/
public function testGetEventSummarySet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::getEvents
* @todo Implement testGetEvents().
*/
public function testGetEvents()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::getPiggyBanks
* @todo Implement testGetPiggyBanks().
*/
public function testGetPiggyBanks()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::reset
* @todo Implement testReset().
*/
public function testReset()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::setOrder
* @todo Implement testSetOrder().
*/
public function testSetOrder()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::store
* @todo Implement testStore().
*/
public function testStore()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::update
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -0,0 +1,81 @@
<?php
use FireflyIII\Repositories\Reminder\ReminderRepository;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32.
*/
class ReminderRepositoryTest extends TestCase
{
/**
* @var ReminderRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
parent::setUp();
$this->object = new ReminderRepository;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Reminder\ReminderRepository::getActiveReminders
* @todo Implement testGetActiveReminders().
*/
public function testGetActiveReminders()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Reminder\ReminderRepository::getDismissedReminders
* @todo Implement testGetDismissedReminders().
*/
public function testGetDismissedReminders()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Reminder\ReminderRepository::getExpiredReminders
* @todo Implement testGetExpiredReminders().
*/
public function testGetExpiredReminders()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Reminder\ReminderRepository::getInactiveReminders
* @todo Implement testGetInactiveReminders().
*/
public function testGetInactiveReminders()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -0,0 +1,92 @@
<?php
use FireflyIII\Repositories\Tag\TagRepository;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32.
*/
class TagRepositoryTest extends TestCase
{
/**
* @var TagRepository
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$this->object = new TagRepository;
parent::setUp();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Repositories\Tag\TagRepository::connect
* @todo Implement testConnect().
*/
public function testConnect()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Tag\TagRepository::destroy
* @todo Implement testDestroy().
*/
public function testDestroy()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Tag\TagRepository::get
* @todo Implement testGet().
*/
public function testGet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Tag\TagRepository::store
* @todo Implement testStore().
*/
public function testStore()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers FireflyIII\Repositories\Tag\TagRepository::update
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}