mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Updated factory muffin. This breaks everything. Let's skip Travis until we've fixed it. [skip ci]
This commit is contained in:
parent
45eb092ab6
commit
22bd995b42
@ -36,23 +36,10 @@ class Account extends Ardent
|
||||
'name' => 'required|between:1,100',
|
||||
'user_id' => 'required|exists:users,id',
|
||||
'account_type_id' => 'required|exists:account_types,id',
|
||||
'active' => 'required|between:0,1|numeric'
|
||||
'active' => 'required|boolean'
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Factory instructions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $factory
|
||||
= [
|
||||
'name' => 'string',
|
||||
'user_id' => 'factory|User',
|
||||
'account_type_id' => 'factory|AccountType',
|
||||
'active' => '1'
|
||||
];
|
||||
|
||||
/**
|
||||
* Account type.
|
||||
*
|
||||
|
@ -17,11 +17,6 @@
|
||||
class AccountType extends Eloquent
|
||||
{
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
'description' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
@ -22,12 +22,6 @@
|
||||
*/
|
||||
class Budget extends Component
|
||||
{
|
||||
public static $factory
|
||||
= [
|
||||
'name' => 'string',
|
||||
'user_id' => 'factory|User',
|
||||
'class' => 'Budget'
|
||||
];
|
||||
protected $isSubclass = true;
|
||||
|
||||
/**
|
||||
|
@ -22,12 +22,6 @@
|
||||
*/
|
||||
class Category extends Component
|
||||
{
|
||||
public static $factory
|
||||
= [
|
||||
'name' => 'string',
|
||||
'user_id' => 'factory|User',
|
||||
'class' => 'Category'
|
||||
];
|
||||
protected $isSubclass = true;
|
||||
|
||||
/**
|
||||
|
@ -37,6 +37,8 @@ use LaravelBook\Ardent\Ardent as Ardent;
|
||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereReminder($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereReminderSkip($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereOrder($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankEvent[] $piggybankevents
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
||||
*/
|
||||
class Piggybank extends Ardent
|
||||
{
|
||||
|
@ -3,6 +3,23 @@
|
||||
use Carbon\Carbon;
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
/**
|
||||
* PiggybankEvent
|
||||
*
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $piggybank_id
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property float $amount
|
||||
* @property-read \Piggybank $piggybank
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent wherePiggybankId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereDate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereAmount($value)
|
||||
*/
|
||||
class PiggybankEvent extends Ardent
|
||||
{
|
||||
|
||||
|
@ -35,6 +35,10 @@ use LaravelBook\Ardent\Ardent;
|
||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDate($value)
|
||||
* @method static \TransactionJournal after($date)
|
||||
* @method static \TransactionJournal before($date)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
||||
* 'Budget[] $budgets
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
||||
* 'Category[] $categories
|
||||
*/
|
||||
class TransactionJournal extends Ardent
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ class User extends Ardent implements UserInterface, RemindableInterface
|
||||
public static $rules
|
||||
= [
|
||||
'email' => 'required|email|unique:users,email',
|
||||
'migrated' => 'required|numeric|between:0,1',
|
||||
'migrated' => 'required|boolean',
|
||||
'password' => 'required|between:60,60',
|
||||
'reset' => 'between:32,32',
|
||||
];
|
||||
@ -61,19 +61,6 @@ class User extends Ardent implements UserInterface, RemindableInterface
|
||||
*/
|
||||
protected $hidden = ['remember_token'];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function factory()
|
||||
{
|
||||
return [
|
||||
'email' => 'email',
|
||||
'password' => 'sander',
|
||||
'migrated' => '0'
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class TestCase
|
||||
@ -23,6 +24,12 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
return require __DIR__ . '/../../bootstrap/start.php';
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
f::loadFactories(__DIR__ . '/factories');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $class
|
||||
*
|
||||
|
@ -3,7 +3,7 @@
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class AccountControllerTest
|
||||
@ -21,6 +21,9 @@ class AccountControllerTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
|
||||
Artisan::call('migrate');
|
||||
Artisan::call('db:seed');
|
||||
$this->_repository = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
|
||||
@ -114,9 +117,15 @@ class AccountControllerTest extends TestCase
|
||||
Auth::shouldReceive('user')->andReturn($this->_user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
$this->_user->shouldReceive('getAttribute')->with('id')->once()->andReturn($account->user_id);
|
||||
$this->_user->shouldReceive('getAttribute')->with('email')->once()->andReturn('some@email');
|
||||
$this->_user->shouldReceive('getAttribute')->with('email')->andReturn('some@email');
|
||||
$this->_accounts->shouldReceive('openingBalanceTransaction')->once()->andReturn(null);
|
||||
|
||||
// test if the view works:
|
||||
View::shouldReceive('make')->with('accounts.edit')->once()->andReturn(m::self())->shouldReceive('with')->with(
|
||||
'account', m::any()
|
||||
)
|
||||
->andReturn(m::self())->shouldReceive('with')->with('openingBalance', null)->andReturn(m::self());
|
||||
|
||||
$this->action('GET', 'AccountController@edit', $account->id);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
@ -127,14 +136,20 @@ class AccountControllerTest extends TestCase
|
||||
$collection = new Collection();
|
||||
$collection->add($account);
|
||||
|
||||
// create some fake accounts:
|
||||
$personal = f::create('Account');
|
||||
$bene = f::create('Account');
|
||||
$init = f::create('Account');
|
||||
$cash = f::create('Account');
|
||||
|
||||
$list = [
|
||||
'personal' => [],
|
||||
'beneficiaries' => [],
|
||||
'initial' => [],
|
||||
'cash' => []
|
||||
'personal' => [$personal],
|
||||
'beneficiaries' => [$bene],
|
||||
'initial' => [$init],
|
||||
'cash' => [$cash]
|
||||
];
|
||||
|
||||
$this->_repository->shouldReceive('get')->with()->once()->andReturn($collection);
|
||||
$this->_repository->shouldReceive('get')->once()->andReturn($collection);
|
||||
$this->_accounts->shouldReceive('index')->with($collection)->once()->andReturn($list);
|
||||
$this->action('GET', 'AccountController@index');
|
||||
$this->assertResponseOk();
|
||||
|
@ -3,7 +3,7 @@
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class BudgetControllerTest
|
||||
|
@ -3,7 +3,7 @@
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class CategoryControllerTest
|
||||
|
@ -3,7 +3,7 @@
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
use Carbon\Carbon as Carbon;
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class HomeControllerTest
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class JsonControllerTest
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class LimitControllerTest
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class ProfileControllerTest
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class RecurringControllerTest
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class TransactionControllerTest
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Mockery as m;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
|
||||
/**
|
||||
|
12
app/tests/factories/Account.php
Normal file
12
app/tests/factories/Account.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'Account',
|
||||
[
|
||||
'user_id' => 'factory|User',
|
||||
'account_type_id' => 'factory|AccountType',
|
||||
'name' => 'word',
|
||||
'active' => 'boolean'
|
||||
]
|
||||
);
|
17
app/tests/factories/AccountType.php
Normal file
17
app/tests/factories/AccountType.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'AccountType',
|
||||
[
|
||||
'description' => function() {
|
||||
$types = [
|
||||
'Default account',
|
||||
'Cash account',
|
||||
'Initial balance account',
|
||||
'Beneficiary account'
|
||||
];
|
||||
return $types[rand(0,3)];
|
||||
}
|
||||
]
|
||||
);
|
11
app/tests/factories/Budget.php
Normal file
11
app/tests/factories/Budget.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'Budget',
|
||||
[
|
||||
'name' => 'word',
|
||||
'user_id' => 'factory|User',
|
||||
'class' => 'Budget'
|
||||
]
|
||||
);
|
11
app/tests/factories/Category.php
Normal file
11
app/tests/factories/Category.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'Budget',
|
||||
[
|
||||
'name' => 'word',
|
||||
'user_id' => 'factory|User',
|
||||
'class' => 'Category'
|
||||
]
|
||||
);
|
17
app/tests/factories/User.php
Normal file
17
app/tests/factories/User.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'User',
|
||||
[
|
||||
'email' => 'safeEmail',
|
||||
'password' => function () {
|
||||
return \Str::random(60);
|
||||
},
|
||||
'reset' => function () {
|
||||
return \Str::random(32);
|
||||
},
|
||||
'remember_token' => null,
|
||||
'migrated' => 'boolean'
|
||||
]
|
||||
);
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class ModelTest
|
||||
|
@ -53,8 +53,10 @@ $r = Route::current()->getName();
|
||||
<li><a href="{{route('transactions.create','withdrawal')}}" title="For when you spend money"><span class="glyphicon glyphicon-arrow-left"></span> Withdrawal</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<!--
|
||||
<p style="cursor:pointer;" class="navbar-text"><span class="label label-danger">1 reminder</span> </p>
|
||||
-->
|
||||
|
||||
@if(\Auth::user() && \Auth::check())
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
@ -30,7 +30,7 @@
|
||||
"barryvdh/laravel-ide-helper": "~1.9",
|
||||
"mockery/mockery": "~0.9",
|
||||
"satooshi/php-coveralls": "~0.6",
|
||||
"league/factory-muffin": "~1.5",
|
||||
"league/factory-muffin": "~2.0",
|
||||
"doctrine/dbal": "2.4.*"
|
||||
},
|
||||
"autoload": {
|
||||
|
Loading…
Reference in New Issue
Block a user