mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 18:40:12 +00:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
31128020f0 | ||
|
7a2f169dfc | ||
|
ed910b99a7 | ||
|
54195c0826 | ||
|
cefbbcd1df | ||
|
cc01592085 | ||
|
5a98a5252d | ||
|
184e8b1132 | ||
|
2b6b896c2e | ||
|
96d06b7a93 | ||
|
f54f1611b5 | ||
|
69ad757e8b | ||
|
e0beb796ad | ||
|
f331e7d820 | ||
|
cbb62d3d78 | ||
|
c85bc59c1d |
@@ -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=
|
||||
|
@@ -16,7 +16,7 @@ install:
|
||||
- mv -v .env.testing .env
|
||||
|
||||
script:
|
||||
- phpunit --debug
|
||||
- phpunit
|
||||
|
||||
after_script:
|
||||
- php vendor/bin/coveralls
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Firefly III (v3.4.0.1)
|
||||
Firefly III (v3.4.0.2)
|
||||
===========
|
||||
|
||||
[](https://travis-ci.org/JC5/firefly-iii)
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
use FireflyIII\Events\JournalSaved;
|
||||
use FireflyIII\Models\PiggyBankEvent;
|
||||
use FireflyIII\Models\Transaction;
|
||||
|
||||
/**
|
||||
* Class UpdateJournalConnection
|
||||
|
@@ -84,4 +84,4 @@ class Help implements HelpInterface
|
||||
{
|
||||
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -45,4 +45,4 @@ interface HelpInterface
|
||||
* @return void
|
||||
*/
|
||||
public function putInCache($route, array $content);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
*/
|
||||
@@ -322,4 +322,4 @@ class TagController extends Controller
|
||||
// redirect to previous URL.
|
||||
return Redirect::to(Session::get('tags.edit.url'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -50,4 +50,4 @@ class TagFormRequest extends Request
|
||||
'tagMode' => 'required|in:nothing,balancingAct,advancePayment'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -415,4 +415,4 @@ Breadcrumbs::register(
|
||||
$breadcrumbs->parent('tags.index');
|
||||
$breadcrumbs->push(e($tag->tag), route('tags.show', $tag->id));
|
||||
}
|
||||
);
|
||||
);
|
||||
|
@@ -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
|
||||
*/
|
||||
|
@@ -12,6 +12,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class PiggyBankRepetition extends Model
|
||||
{
|
||||
|
||||
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
@@ -125,4 +125,4 @@ class Tag extends Model
|
||||
{
|
||||
return $this->belongsTo('FireflyIII\User');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -212,7 +212,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
* when the current period has a transaction journal.
|
||||
*/
|
||||
/** @var \Carbon\Carbon $obj */
|
||||
$obj = new Carbon;
|
||||
$obj = new Carbon;
|
||||
$today = Navigation::addPeriod($obj, $bill->repeat_freq, 0);
|
||||
|
||||
$skip = $bill->skip + 1;
|
||||
|
@@ -71,9 +71,9 @@ interface CategoryRepositoryInterface
|
||||
public function getWithoutCategory(Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param Category $category
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
|
@@ -177,4 +177,4 @@ class TagRepository implements TagRepositoryInterface
|
||||
|
||||
return $tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -49,4 +49,4 @@ interface TagRepositoryInterface
|
||||
* @return boolean
|
||||
*/
|
||||
public function connect(TransactionJournal $journal, Tag $tag);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -384,7 +384,7 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $range
|
||||
* @param $range
|
||||
* @param \Carbon\Carbon $start
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
|
@@ -121,6 +121,7 @@ class Search implements SearchInterface
|
||||
return $journal;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
@@ -18,8 +18,8 @@ class Steam
|
||||
/**
|
||||
*
|
||||
* @param \FireflyIII\Models\Account $account
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param bool $ignoreVirtualBalance
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param bool $ignoreVirtualBalance
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
|
@@ -50,4 +50,4 @@ class Budget extends Twig_Extension
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\Budget';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -143,4 +143,4 @@ class General extends Twig_Extension
|
||||
return 'FireflyIII\Support\Twig\General';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -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']]
|
||||
@@ -96,4 +97,4 @@ class Journal extends Twig_Extension
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\Journals';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,4 +39,4 @@ class PiggyBank extends Twig_Extension
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\PiggyBank';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
pu.sh
2
pu.sh
@@ -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
|
||||
|
@@ -58,4 +58,4 @@
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -57,4 +57,4 @@
|
||||
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
|
||||
<script src="js/accounts.js" type="text/javascript"></script>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -42,4 +42,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -29,4 +29,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -24,4 +24,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -110,4 +110,4 @@
|
||||
<script type="text/javascript" src="js/gcharts.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/bills.js"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -40,4 +40,4 @@
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -14,4 +14,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -37,4 +37,4 @@
|
||||
<script type="text/javascript" src="js/gcharts.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap-sortable.js"></script>
|
||||
<script type="text/javascript" src="js/categories.js"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -15,4 +15,4 @@
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -51,4 +51,4 @@
|
||||
<script type="text/javascript" src="js/gcharts.js"></script>
|
||||
<script type="text/javascript" src="js/categories.js"></script>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -23,4 +23,4 @@
|
||||
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -42,4 +42,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -46,4 +46,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -27,4 +27,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@@ -209,4 +209,4 @@
|
||||
<script type="text/javascript" src="js/gcharts.options.js"></script>
|
||||
<script type="text/javascript" src="js/gcharts.js"></script>
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -56,4 +56,4 @@
|
||||
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
@@ -110,4 +110,4 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{{ journals.render|raw }}
|
||||
{{ journals.render|raw }}
|
||||
|
@@ -53,4 +53,4 @@
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
@@ -59,4 +59,4 @@
|
||||
{% block scripts %}
|
||||
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="js/piggy-banks.js"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -23,4 +23,4 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -52,4 +52,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -46,4 +46,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -16,4 +16,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -37,4 +37,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -103,4 +103,4 @@
|
||||
<script type="text/javascript">
|
||||
var query = '{{ query }}';
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -82,4 +82,4 @@
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
|
||||
<script src="js/tags.js"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -84,4 +84,4 @@
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
|
||||
<script src="js/tags.js"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -72,4 +72,4 @@
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script type="text/javascript" src="js/tags.js"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -253,4 +253,4 @@ class BillControllerTest extends TestCase
|
||||
$this->assertResponseStatus(302);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -316,4 +316,4 @@ class BudgetControllerTest extends TestCase
|
||||
$this->assertResponseOk();
|
||||
$this->assertViewHas('amount');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -222,4 +222,4 @@ class CategoryControllerTest extends TestCase
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success', 'Category "' . $category->name . '" updated.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -214,4 +214,4 @@ class CurrencyControllerTest extends TestCase
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -344,4 +344,4 @@ class GoogleChartControllerTest extends TestCase
|
||||
$this->call('GET', '/chart/reports/income-expenses-sum/2015');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -95,4 +95,4 @@ class HelpControllerTest extends TestCase
|
||||
$this->call('GET', '/help/accounts.index');
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -224,4 +224,4 @@ class JsonControllerTest extends TestCase
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -82,4 +82,4 @@ class PreferencesControllerTest extends TestCase
|
||||
$this->call('POST', '/preferences', $data);
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -167,4 +167,4 @@ class ProfileControllerTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -97,4 +97,4 @@ class ReminderControllerTest extends TestCase
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -235,4 +235,4 @@ class ReportControllerTest extends TestCase
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -52,4 +52,4 @@ class SearchControllerTest extends TestCase
|
||||
$this->call('GET', '/search?q=Something');
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -214,4 +214,4 @@ class TagControllerTest extends TestCase
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -360,4 +360,4 @@ class TransactionControllerTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
2
tests/database/.gitignore
vendored
2
tests/database/.gitignore
vendored
@@ -1 +1 @@
|
||||
*.sqlite
|
||||
*.sqlite
|
||||
|
@@ -61,7 +61,9 @@ FactoryMuffin::define(
|
||||
'account_type_id' => 'factory|FireflyIII\Models\AccountType',
|
||||
'name' => 'word',
|
||||
'active' => 'boolean',
|
||||
'encrypted' => 'boolean',
|
||||
'encrypted' => function () {
|
||||
return true;
|
||||
},
|
||||
'virtual_balance' => 0
|
||||
]
|
||||
);
|
||||
@@ -227,6 +229,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',
|
||||
[
|
||||
@@ -267,4 +282,4 @@ FactoryMuffin::define(
|
||||
'encrypted' => '1',
|
||||
'order' => '0',
|
||||
]
|
||||
);
|
||||
);
|
||||
|
774
tests/repositories/AccountRepositoryTest.php
Normal file
774
tests/repositories/AccountRepositoryTest.php
Normal file
@@ -0,0 +1,774 @@
|
||||
<?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 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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @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::sumOfEverything
|
||||
*/
|
||||
public function testSumOfEverything()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
$this->assertEquals(0, $this->object->sumOfEverything());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Account\AccountRepository::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.');
|
||||
}
|
||||
}
|
272
tests/repositories/BudgetRepositoryTest.php
Normal file
272
tests/repositories/BudgetRepositoryTest.php
Normal file
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
use FireflyIII\Repositories\Budget\BudgetRepository;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @todo Implement testCleanupBudgets().
|
||||
*/
|
||||
public function testCleanupBudgets()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::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\Budget\BudgetRepository::expensesOnDay
|
||||
* @todo Implement testExpensesOnDay().
|
||||
*/
|
||||
public function testExpensesOnDay()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getActiveBudgets
|
||||
* @todo Implement testGetActiveBudgets().
|
||||
*/
|
||||
public function testGetActiveBudgets()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgetLimitRepetitions
|
||||
* @todo Implement testGetBudgetLimitRepetitions().
|
||||
*/
|
||||
public function testGetBudgetLimitRepetitions()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgetLimits
|
||||
* @todo Implement testGetBudgetLimits().
|
||||
*/
|
||||
public function testGetBudgetLimits()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getBudgets
|
||||
* @todo Implement testGetBudgets().
|
||||
*/
|
||||
public function testGetBudgets()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getCurrentRepetition
|
||||
* @todo Implement testGetCurrentRepetition().
|
||||
*/
|
||||
public function testGetCurrentRepetition()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getFirstBudgetLimitDate
|
||||
* @todo Implement testGetFirstBudgetLimitDate().
|
||||
*/
|
||||
public function testGetFirstBudgetLimitDate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getInactiveBudgets
|
||||
* @todo Implement testGetInactiveBudgets().
|
||||
*/
|
||||
public function testGetInactiveBudgets()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getJournals
|
||||
* @todo Implement testGetJournals().
|
||||
*/
|
||||
public function testGetJournals()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getLastBudgetLimitDate
|
||||
* @todo Implement testGetLastBudgetLimitDate().
|
||||
*/
|
||||
public function testGetLastBudgetLimitDate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getLimitAmountOnDate
|
||||
* @todo Implement testGetLimitAmountOnDate().
|
||||
*/
|
||||
public function testGetLimitAmountOnDate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getWithoutBudget
|
||||
* @todo Implement testGetWithoutBudget().
|
||||
*/
|
||||
public function testGetWithoutBudget()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::getWithoutBudgetSum
|
||||
* @todo Implement testGetWithoutBudgetSum().
|
||||
*/
|
||||
public function testGetWithoutBudgetSum()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::spentInMonth
|
||||
* @todo Implement testSpentInMonth().
|
||||
*/
|
||||
public function testSpentInMonth()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::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\Budget\BudgetRepository::sumBudgetExpensesInPeriod
|
||||
* @todo Implement testSumBudgetExpensesInPeriod().
|
||||
*/
|
||||
public function testSumBudgetExpensesInPeriod()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::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\Budget\BudgetRepository::updateLimitAmount
|
||||
* @todo Implement testUpdateLimitAmount().
|
||||
*/
|
||||
public function testUpdateLimitAmount()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
}
|
176
tests/repositories/CategoryRepositoryTest.php
Normal file
176
tests/repositories/CategoryRepositoryTest.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
use FireflyIII\Repositories\Category\CategoryRepository;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @todo Implement testCountJournals().
|
||||
*/
|
||||
public function testCountJournals()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::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\Category\CategoryRepository::getCategories
|
||||
* @todo Implement testGetCategories().
|
||||
*/
|
||||
public function testGetCategories()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::getCategoriesAndExpenses
|
||||
* @todo Implement testGetCategoriesAndExpenses().
|
||||
*/
|
||||
public function testGetCategoriesAndExpenses()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::getFirstActivityDate
|
||||
* @todo Implement testGetFirstActivityDate().
|
||||
*/
|
||||
public function testGetFirstActivityDate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::getJournals
|
||||
* @todo Implement testGetJournals().
|
||||
*/
|
||||
public function testGetJournals()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::getLatestActivity
|
||||
* @todo Implement testGetLatestActivity().
|
||||
*/
|
||||
public function testGetLatestActivity()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::getWithoutCategory
|
||||
* @todo Implement testGetWithoutCategory().
|
||||
*/
|
||||
public function testGetWithoutCategory()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentInPeriodSum
|
||||
* @todo Implement testSpentInPeriodSum().
|
||||
*/
|
||||
public function testSpentInPeriodSum()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentOnDaySum
|
||||
* @todo Implement testSpentOnDaySum().
|
||||
*/
|
||||
public function testSpentOnDaySum()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::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\Category\CategoryRepository::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.'
|
||||
);
|
||||
}
|
||||
}
|
92
tests/repositories/CurrencyRepositoryTest.php
Normal file
92
tests/repositories/CurrencyRepositoryTest.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepository;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @todo Implement testCountJournals().
|
||||
*/
|
||||
public function testCountJournals()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::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\Currency\CurrencyRepository::getCurrencyByPreference
|
||||
* @todo Implement testGetCurrencyByPreference().
|
||||
*/
|
||||
public function testGetCurrencyByPreference()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::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\Currency\CurrencyRepository::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.'
|
||||
);
|
||||
}
|
||||
}
|
176
tests/repositories/JournalRepositoryTest.php
Normal file
176
tests/repositories/JournalRepositoryTest.php
Normal 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.'
|
||||
);
|
||||
}
|
||||
}
|
164
tests/repositories/PiggyBankRepositoryTest.php
Normal file
164
tests/repositories/PiggyBankRepositoryTest.php
Normal 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.'
|
||||
);
|
||||
}
|
||||
}
|
81
tests/repositories/ReminderRepositoryTest.php
Normal file
81
tests/repositories/ReminderRepositoryTest.php
Normal 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.'
|
||||
);
|
||||
}
|
||||
}
|
92
tests/repositories/TagRepositoryTest.php
Normal file
92
tests/repositories/TagRepositoryTest.php
Normal 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.'
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user