mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 20:25:28 +00:00
This will be the first release!
This commit is contained in:
@@ -247,10 +247,10 @@ class AccountControllerTest extends TestCase
|
||||
$collection->add($account);
|
||||
|
||||
$list = [
|
||||
'personal' => [],
|
||||
'personal' => [],
|
||||
'beneficiaries' => [],
|
||||
'initial' => [],
|
||||
'cash' => []
|
||||
'initial' => [],
|
||||
'cash' => []
|
||||
];
|
||||
|
||||
$this->_repository->shouldReceive('get')->once()->andReturn($collection);
|
||||
@@ -283,19 +283,19 @@ class AccountControllerTest extends TestCase
|
||||
|
||||
$data = [
|
||||
'statistics' => [
|
||||
'period' => [
|
||||
'in' => 0,
|
||||
'out' => 0,
|
||||
'diff' => 0,
|
||||
't_in' => 0,
|
||||
't_out' => 0,
|
||||
'period' => [
|
||||
'in' => 0,
|
||||
'out' => 0,
|
||||
'diff' => 0,
|
||||
't_in' => 0,
|
||||
't_out' => 0,
|
||||
't_diff' => 0
|
||||
],
|
||||
'categories' => [],
|
||||
'budgets' => [],
|
||||
'accounts' => []
|
||||
'budgets' => [],
|
||||
'accounts' => []
|
||||
],
|
||||
'journals' => $paginator,
|
||||
'journals' => $paginator,
|
||||
];
|
||||
|
||||
$this->_accounts->shouldReceive('show')->once()->andReturn($data);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* Class BudgetControllerTest
|
||||
@@ -65,7 +65,7 @@ class BudgetControllerTest extends TestCase
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn($budget->user_id);
|
||||
Event::shouldReceive('fire')->once()->with('budgets.destroy',[$budget]);
|
||||
Event::shouldReceive('fire')->once()->with('budgets.destroy', [$budget]);
|
||||
$this->_repository->shouldReceive('destroy')->once()->andReturn(true);
|
||||
|
||||
$this->action('POST', 'BudgetController@destroy', $budget->id);
|
||||
@@ -81,7 +81,7 @@ class BudgetControllerTest extends TestCase
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn($budget->user_id);
|
||||
Event::shouldReceive('fire')->once()->with('budgets.destroy',[$budget]);
|
||||
Event::shouldReceive('fire')->once()->with('budgets.destroy', [$budget]);
|
||||
$this->_repository->shouldReceive('destroy')->once()->andReturn(true);
|
||||
|
||||
$this->action('POST', 'BudgetController@destroy', [$budget->id, 'from' => 'date']);
|
||||
@@ -97,7 +97,7 @@ class BudgetControllerTest extends TestCase
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn($budget->user_id);
|
||||
Event::shouldReceive('fire')->once()->with('budgets.destroy',[$budget]);
|
||||
Event::shouldReceive('fire')->once()->with('budgets.destroy', [$budget]);
|
||||
$this->_repository->shouldReceive('destroy')->once()->andReturn(false);
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ class BudgetControllerTest extends TestCase
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn($budget->user_id);
|
||||
$this->_repository->shouldReceive('update')->andReturn($budget);
|
||||
Event::shouldReceive('fire')->with('budgets.update',[$budget]);
|
||||
Event::shouldReceive('fire')->with('budgets.update', [$budget]);
|
||||
|
||||
$this->action('POST', 'BudgetController@update', $budget->id);
|
||||
$this->assertRedirectedToRoute('budgets.index.budget');
|
||||
@@ -248,7 +248,7 @@ class BudgetControllerTest extends TestCase
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn($budget->user_id);
|
||||
$this->_repository->shouldReceive('update')->andReturn($budget);
|
||||
Event::shouldReceive('fire')->with('budgets.update',[$budget]);
|
||||
Event::shouldReceive('fire')->with('budgets.update', [$budget]);
|
||||
//$this->_user->shouldReceive('budgets')->andReturn([]); // trigger
|
||||
|
||||
$this->action('POST', 'BudgetController@update', [$budget->id, 'from' => 'date']);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* Class CategoryControllerTest
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
use Carbon\Carbon as Carbon;
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* Class HomeControllerTest
|
||||
@@ -15,6 +15,7 @@ class HomeControllerTest extends TestCase
|
||||
protected $_repository;
|
||||
protected $_preferences;
|
||||
protected $_journals;
|
||||
protected $_reminders;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -25,6 +26,7 @@ class HomeControllerTest extends TestCase
|
||||
$this->_repository = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
|
||||
$this->_preferences = $this->mock('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
||||
$this->_journals = $this->mock('Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface');
|
||||
$this->_reminders = $this->mock('Firefly\Storage\Reminder\ReminderRepositoryInterface');
|
||||
|
||||
|
||||
}
|
||||
@@ -47,6 +49,11 @@ class HomeControllerTest extends TestCase
|
||||
$preference = $this->mock('Preference');
|
||||
$preference->shouldReceive('getAttribute')->with('data')->andReturn([]);
|
||||
|
||||
Event::shouldReceive('fire')->with('limits.check');
|
||||
Event::shouldReceive('fire')->with('piggybanks.check');
|
||||
Event::shouldReceive('fire')->with('recurring.check');
|
||||
|
||||
$this->_reminders->shouldReceive('getCurrentRecurringReminders')->once()->andReturn([]);
|
||||
|
||||
// mock accounts:
|
||||
$this->_repository->shouldReceive('count')->once()->andReturn(0);
|
||||
@@ -71,6 +78,12 @@ class HomeControllerTest extends TestCase
|
||||
$preference = $this->mock('Preference');
|
||||
$preference->shouldReceive('getAttribute')->with('data')->andReturn([$account->id]);
|
||||
|
||||
Event::shouldReceive('fire')->with('limits.check');
|
||||
Event::shouldReceive('fire')->with('piggybanks.check');
|
||||
Event::shouldReceive('fire')->with('recurring.check');
|
||||
|
||||
$this->_reminders->shouldReceive('getCurrentRecurringReminders')->once()->andReturn([]);
|
||||
|
||||
|
||||
// mock accounts:
|
||||
$this->_repository->shouldReceive('count')->once()->andReturn(0);
|
||||
@@ -80,7 +93,7 @@ class HomeControllerTest extends TestCase
|
||||
$this->_preferences->shouldReceive('get')->with('frontpageAccounts', [])->andReturn($preference);
|
||||
|
||||
// mock journals:
|
||||
$this->_journals->shouldReceive('getByAccountInDateRange')->once()->with($account, 15, $start, $end)->andReturn(
|
||||
$this->_journals->shouldReceive('getByAccountInDateRange')->once()->with($account, 10, $start, $end)->andReturn(
|
||||
[1, 2]
|
||||
);
|
||||
|
||||
@@ -104,6 +117,12 @@ class HomeControllerTest extends TestCase
|
||||
$preference = $this->mock('Preference');
|
||||
$preference->shouldReceive('getAttribute')->with('data')->andReturn($ids);
|
||||
|
||||
Event::shouldReceive('fire')->with('limits.check');
|
||||
Event::shouldReceive('fire')->with('piggybanks.check');
|
||||
Event::shouldReceive('fire')->with('recurring.check');
|
||||
|
||||
$this->_reminders->shouldReceive('getCurrentRecurringReminders')->once()->andReturn([]);
|
||||
|
||||
|
||||
// mock accounts:
|
||||
$this->_repository->shouldReceive('count')->once()->andReturn(0);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* Class LimitControllerTest
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
|
||||
/**
|
||||
@@ -171,7 +171,7 @@ class PiggybankControllerTest extends TestCase
|
||||
$input = [
|
||||
$piggyBank->id,
|
||||
'amount' => 10.0,
|
||||
'what' => 'add'
|
||||
'what' => 'add'
|
||||
];
|
||||
|
||||
// for binding
|
||||
@@ -181,7 +181,7 @@ class PiggybankControllerTest extends TestCase
|
||||
$piggyBank->account()->first()->user_id
|
||||
);
|
||||
$this->_user->shouldReceive('getAttribute')->with('email')->andReturn('some@email');
|
||||
Event::shouldReceive('fire');//->with('piggybanks.modifyAmountAdd', [$piggyBank, 10.0]);
|
||||
Event::shouldReceive('fire'); //->with('piggybanks.modifyAmountAdd', [$piggyBank, 10.0]);
|
||||
$this->_piggybanks->shouldReceive('modifyAmount')->once();
|
||||
|
||||
$this->_piggybanks->shouldReceive('leftOnAccount')->once()->andReturn(200);
|
||||
@@ -201,7 +201,7 @@ class PiggybankControllerTest extends TestCase
|
||||
$input = [
|
||||
$piggyBank->id,
|
||||
'amount' => 10.0,
|
||||
'what' => 'add'
|
||||
'what' => 'add'
|
||||
];
|
||||
|
||||
// for binding
|
||||
@@ -230,7 +230,7 @@ class PiggybankControllerTest extends TestCase
|
||||
$input = [
|
||||
$piggyBank->id,
|
||||
'amount' => 10.0,
|
||||
'what' => 'yomoma'
|
||||
'what' => 'yomoma'
|
||||
];
|
||||
|
||||
// for binding
|
||||
@@ -269,7 +269,7 @@ class PiggybankControllerTest extends TestCase
|
||||
$input = [
|
||||
$rep->piggybank()->first()->id,
|
||||
'amount' => 10.0,
|
||||
'what' => 'remove'
|
||||
'what' => 'remove'
|
||||
];
|
||||
|
||||
$this->action('POST', 'PiggybankController@modMoney', $input);
|
||||
@@ -299,7 +299,7 @@ class PiggybankControllerTest extends TestCase
|
||||
$input = [
|
||||
$rep->piggybank()->first()->id,
|
||||
'amount' => 10.0,
|
||||
'what' => 'remove'
|
||||
'what' => 'remove'
|
||||
];
|
||||
|
||||
$this->action('POST', 'PiggybankController@modMoney', $input);
|
||||
@@ -308,48 +308,6 @@ class PiggybankControllerTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
public function teststorePiggybank()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
$piggy->repeats = 0;
|
||||
$piggy->save();
|
||||
Event::shouldReceive('fire')->with('piggybanks.store',[$piggy])->once();
|
||||
|
||||
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storePiggybank');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function testStoreRepeated()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
$piggy->repeats = 1;
|
||||
$piggy->save();
|
||||
Event::shouldReceive('fire')->with('piggybanks.store',[$piggy])->once();
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storeRepeated');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function teststorePiggybankFails()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
unset($piggy->id);
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storePiggybank');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function testStoreRepeatedFails()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
unset($piggy->id);
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storeRepeated');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function testRemoveMoneyGET()
|
||||
{
|
||||
$pig = $this->mock('Piggybank');
|
||||
@@ -375,19 +333,48 @@ class PiggybankControllerTest extends TestCase
|
||||
|
||||
public function testShow()
|
||||
{
|
||||
$piggyBank = f::create('Piggybank');
|
||||
// for binding
|
||||
$pig = $this->mock('Piggybank');
|
||||
$piggybank = f::create('Piggybank');
|
||||
$rep = f::create('PiggybankRepetition');
|
||||
$rep->piggybank_id = $piggybank->id;
|
||||
$rep->save();
|
||||
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn(
|
||||
$piggyBank->account()->first()->user_id
|
||||
$piggybank->account()->first()->user_id
|
||||
);
|
||||
$this->_user->shouldReceive('getAttribute')->andReturn('some@email');
|
||||
|
||||
$this->action('GET', 'PiggybankController@show', $piggyBank->id);
|
||||
$pig->shouldReceive('currentRelevantRep')->andReturn($rep);
|
||||
|
||||
// repos:
|
||||
$this->_piggybanks->shouldReceive('leftOnAccount');
|
||||
|
||||
$this->action('GET', 'PiggybankController@show', $piggybank->id);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testStoreRepeated()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
$piggy->repeats = 1;
|
||||
$piggy->save();
|
||||
Event::shouldReceive('fire')->with('piggybanks.store', [$piggy])->once();
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storeRepeated');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function testStoreRepeatedFails()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
unset($piggy->id);
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storeRepeated');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function testUpdate()
|
||||
{
|
||||
$piggyBank = f::create('Piggybank');
|
||||
@@ -401,7 +388,7 @@ class PiggybankControllerTest extends TestCase
|
||||
$piggyBank->account()->first()->user_id
|
||||
);
|
||||
$this->_user->shouldReceive('getAttribute')->with('email')->andReturn('some@email');
|
||||
Event::shouldReceive('fire')->with('piggybanks.update',[$piggyBank]);
|
||||
Event::shouldReceive('fire')->with('piggybanks.update', [$piggyBank]);
|
||||
|
||||
$this->action('POST', 'PiggybankController@update', $piggyBank->id);
|
||||
$this->assertResponseStatus(302);
|
||||
@@ -427,5 +414,27 @@ class PiggybankControllerTest extends TestCase
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function teststorePiggybank()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
$piggy->repeats = 0;
|
||||
$piggy->save();
|
||||
Event::shouldReceive('fire')->with('piggybanks.store', [$piggy])->once();
|
||||
|
||||
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storePiggybank');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
public function teststorePiggybankFails()
|
||||
{
|
||||
$piggy = f::create('Piggybank');
|
||||
unset($piggy->id);
|
||||
$this->_piggybanks->shouldReceive('store')->once()->andReturn($piggy);
|
||||
$this->action('POST', 'PiggybankController@storePiggybank');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* Class ProfileControllerTest
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* Class RecurringControllerTest
|
||||
@@ -40,6 +40,8 @@ class RecurringControllerTest extends TestCase
|
||||
{
|
||||
$recurringTransaction = f::create('RecurringTransaction');
|
||||
|
||||
|
||||
|
||||
// for binding
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
@@ -55,6 +57,8 @@ class RecurringControllerTest extends TestCase
|
||||
{
|
||||
$recurringTransaction = f::create('RecurringTransaction');
|
||||
|
||||
Event::shouldReceive('fire')->with('recurring.destroy',m::any());
|
||||
|
||||
// for binding
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
@@ -73,6 +77,7 @@ class RecurringControllerTest extends TestCase
|
||||
// for binding
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
Event::shouldReceive('fire')->with('recurring.destroy',m::any());
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn($recurringTransaction->user_id);
|
||||
$this->_user->shouldReceive('getAttribute')->with('email')->andReturn('some@email');
|
||||
$this->_repository->shouldReceive('destroy')->andReturn(false);
|
||||
@@ -123,6 +128,8 @@ class RecurringControllerTest extends TestCase
|
||||
{
|
||||
$recurringTransaction = f::create('RecurringTransaction');
|
||||
|
||||
Event::shouldReceive('fire')->with('recurring.store',m::any());
|
||||
|
||||
$this->_repository->shouldReceive('store')->andReturn($recurringTransaction);
|
||||
$this->action('POST', 'RecurringController@store');
|
||||
$this->assertResponseStatus(302);
|
||||
@@ -132,6 +139,8 @@ class RecurringControllerTest extends TestCase
|
||||
{
|
||||
$recurringTransaction = f::create('RecurringTransaction');
|
||||
|
||||
Event::shouldReceive('fire')->with('recurring.store',m::any());
|
||||
|
||||
$this->_repository->shouldReceive('store')->andReturn($recurringTransaction);
|
||||
$this->action('POST', 'RecurringController@store', ['create' => '1']);
|
||||
$this->assertResponseStatus(302);
|
||||
@@ -158,6 +167,8 @@ class RecurringControllerTest extends TestCase
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->andReturn($recurringTransaction->user_id);
|
||||
$this->_user->shouldReceive('getAttribute')->with('email')->andReturn('some@email');
|
||||
|
||||
Event::shouldReceive('fire')->with('recurring.update',m::any());
|
||||
|
||||
$this->_repository->shouldReceive('update')->andReturn($recurringTransaction);
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* Class TransactionControllerTest
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Mockery as m;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
use Mockery as m;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,14 +4,15 @@ use League\FactoryMuffin\Facade;
|
||||
Facade::define(
|
||||
'AccountType',
|
||||
[
|
||||
'description' => function() {
|
||||
'description' => function () {
|
||||
$types = [
|
||||
'Default account',
|
||||
'Cash account',
|
||||
'Initial balance account',
|
||||
'Beneficiary account'
|
||||
];
|
||||
return $types[rand(0,3)];
|
||||
|
||||
return $types[rand(0, 3)];
|
||||
}
|
||||
]
|
||||
);
|
||||
@@ -7,17 +7,19 @@ Facade::define(
|
||||
[
|
||||
|
||||
'component_id' => 'factory|Budget',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
return $start;
|
||||
},
|
||||
'amount' => 100,
|
||||
'repeats' => 'boolean',
|
||||
'repeat_freq' => function(){
|
||||
$frequencies = ['daily','weekly','monthly','quarterly','half-year','yearly'];
|
||||
return $frequencies[rand(0,5)];
|
||||
}
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
|
||||
return $start;
|
||||
},
|
||||
'amount' => 100,
|
||||
'repeats' => 'boolean',
|
||||
'repeat_freq' => function () {
|
||||
$frequencies = ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'];
|
||||
|
||||
return $frequencies[rand(0, 5)];
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
@@ -6,20 +6,22 @@ Facade::define(
|
||||
'LimitRepetition',
|
||||
[
|
||||
|
||||
'limit_id' => 'factory|Limit',
|
||||
'limit_id' => 'factory|Limit',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
return $start;
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
|
||||
},
|
||||
'enddate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
return $end;
|
||||
return $start;
|
||||
|
||||
},
|
||||
'amount' => 100
|
||||
},
|
||||
'enddate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
|
||||
return $end;
|
||||
|
||||
},
|
||||
'amount' => 100
|
||||
|
||||
|
||||
]
|
||||
|
||||
@@ -6,25 +6,27 @@ Facade::define(
|
||||
'Piggybank',
|
||||
[
|
||||
|
||||
'account_id' => 'factory|Account',
|
||||
'name' => 'string',
|
||||
'targetamount' => 'integer',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
return $start;
|
||||
},
|
||||
'targetdate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
return $end;
|
||||
},
|
||||
'repeats' => 0,
|
||||
'rep_length' => null,
|
||||
'rep_times' => 0,
|
||||
'rep_every' => 0,
|
||||
'reminder' => null,
|
||||
'account_id' => 'factory|Account',
|
||||
'name' => 'string',
|
||||
'targetamount' => 'integer',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
|
||||
return $start;
|
||||
},
|
||||
'targetdate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
|
||||
return $end;
|
||||
},
|
||||
'repeats' => 0,
|
||||
'rep_length' => null,
|
||||
'rep_times' => 0,
|
||||
'rep_every' => 0,
|
||||
'reminder' => null,
|
||||
'reminder_skip' => 0,
|
||||
'order' => 1,
|
||||
'order' => 1,
|
||||
]
|
||||
);
|
||||
@@ -7,17 +7,19 @@ Facade::define(
|
||||
[
|
||||
|
||||
|
||||
'piggybank_id' => 'factory|Piggybank',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
return $start;
|
||||
},
|
||||
'targetdate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
return $end;
|
||||
},
|
||||
'piggybank_id' => 'factory|Piggybank',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
|
||||
return $start;
|
||||
},
|
||||
'targetdate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
|
||||
return $end;
|
||||
},
|
||||
'currentamount' => 200
|
||||
]
|
||||
);
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
|
||||
@@ -8,16 +8,16 @@ Facade::define(
|
||||
'RecurringTransaction',
|
||||
[
|
||||
|
||||
'user_id' => 'factory|User',
|
||||
'name' => 'string',
|
||||
'match' => 'string',
|
||||
'amount_max' => 100,
|
||||
'amount_min' => 50,
|
||||
'date' => new Carbon,
|
||||
'active' => 'boolean',
|
||||
'automatch' => 'boolean',
|
||||
'user_id' => 'factory|User',
|
||||
'name' => 'string',
|
||||
'match' => 'string',
|
||||
'amount_max' => 100,
|
||||
'amount_min' => 50,
|
||||
'date' => new Carbon,
|
||||
'active' => 'boolean',
|
||||
'automatch' => 'boolean',
|
||||
'repeat_freq' => 'monthly',
|
||||
'skip' => 'boolean',
|
||||
'skip' => 'boolean',
|
||||
|
||||
]
|
||||
);
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'TransactionType',
|
||||
[
|
||||
'type' => function() {
|
||||
$types = ['Withdrawal','Deposit','Transfer','Opening balance'];
|
||||
return $types[rand(0,3)];
|
||||
}
|
||||
'type' => function () {
|
||||
$types = ['Withdrawal', 'Deposit', 'Transfer', 'Opening balance'];
|
||||
|
||||
return $types[rand(0, 3)];
|
||||
}
|
||||
]
|
||||
);
|
||||
@@ -264,7 +264,7 @@ class ModelTest extends TestCase
|
||||
$transaction->piggybank()->associate($piggy);
|
||||
$transaction->save();
|
||||
$this->assertEquals($transaction->piggybank_id, $piggy->id);
|
||||
$this->assertEquals($piggy->transactions()->first()->id,$transaction->id);
|
||||
$this->assertEquals($piggy->transactions()->first()->id, $transaction->id);
|
||||
|
||||
$repetition->pct();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user