mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fixes for tests.
This commit is contained in:
@@ -71,6 +71,8 @@ class ProfileControllerTest extends TestCase
|
||||
public function testPostChangePasswordOK()
|
||||
{
|
||||
$user = f::create('User');
|
||||
$user->password = 'sander';
|
||||
$user->save();
|
||||
// for binding
|
||||
Auth::shouldReceive('user')->andReturn($user);
|
||||
Auth::shouldReceive('check')->andReturn(true);
|
||||
@@ -82,6 +84,7 @@ class ProfileControllerTest extends TestCase
|
||||
'POST', 'ProfileController@postChangePassword',
|
||||
['old' => 'sander', 'new1' => 'sander2', 'new2' => 'sander2']
|
||||
);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'Budget',
|
||||
'Category',
|
||||
[
|
||||
'name' => 'word',
|
||||
'user_id' => 'factory|User',
|
||||
|
24
app/tests/factories/Limit.php
Normal file
24
app/tests/factories/Limit.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'Limit',
|
||||
[
|
||||
|
||||
'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)];
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
);
|
26
app/tests/factories/LimitRepetition.php
Normal file
26
app/tests/factories/LimitRepetition.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'LimitRepetition',
|
||||
[
|
||||
|
||||
'limit_id' => 'factory|Limit',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
return $start;
|
||||
|
||||
},
|
||||
'enddate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
return $end;
|
||||
|
||||
},
|
||||
'amount' => 100
|
||||
|
||||
|
||||
]
|
||||
);
|
30
app/tests/factories/Piggybank.php
Normal file
30
app/tests/factories/Piggybank.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
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,
|
||||
'reminder_skip' => 0,
|
||||
'order' => 1,
|
||||
]
|
||||
);
|
23
app/tests/factories/PiggybankRepetition.php
Normal file
23
app/tests/factories/PiggybankRepetition.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'PiggybankRepetition',
|
||||
[
|
||||
|
||||
|
||||
'piggybank_id' => 'factory|Piggybank',
|
||||
'startdate' => function () {
|
||||
$start = new Carbon;
|
||||
$start->startOfMonth();
|
||||
return $start;
|
||||
},
|
||||
'targetdate' => function () {
|
||||
$end = new Carbon;
|
||||
$end->endOfMonth();
|
||||
return $end;
|
||||
},
|
||||
'currentamount' => 200
|
||||
]
|
||||
);
|
23
app/tests/factories/RecurringTransaction.php
Normal file
23
app/tests/factories/RecurringTransaction.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
// TODO better factory.
|
||||
|
||||
Facade::define(
|
||||
'RecurringTransaction',
|
||||
[
|
||||
|
||||
'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',
|
||||
|
||||
]
|
||||
);
|
12
app/tests/factories/TransactionCurrency.php
Normal file
12
app/tests/factories/TransactionCurrency.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'TransactionCurrency',
|
||||
[
|
||||
'code' => 'EUR'
|
||||
]
|
||||
);
|
17
app/tests/factories/TransactionJournal.php
Normal file
17
app/tests/factories/TransactionJournal.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use League\FactoryMuffin\Facade;
|
||||
|
||||
Facade::define(
|
||||
'TransactionJournal',
|
||||
[
|
||||
'transaction_type_id' => 'factory|TransactionType',
|
||||
'transaction_currency_id' => 'factory|TransactionCurrency',
|
||||
'description' => 'word',
|
||||
'completed' => 'boolean',
|
||||
'user_id' => 'factory|User',
|
||||
'date' => new Carbon
|
||||
]
|
||||
);
|
15
app/tests/factories/TransactionType.php
Normal file
15
app/tests/factories/TransactionType.php
Normal file
@@ -0,0 +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)];
|
||||
}
|
||||
]
|
||||
);
|
Reference in New Issue
Block a user