mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 09:51:21 -06:00
More tests!
This commit is contained in:
parent
402e8588cf
commit
74c9feb53f
@ -98,12 +98,5 @@ class User extends Eloquent implements UserInterface, RemindableInterface
|
||||
return $this->hasMany('TransactionJournal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
*/
|
||||
public function transactions()
|
||||
{
|
||||
return $this->hasManyThrough('TransactionJournal', 'Transaction');
|
||||
}
|
||||
|
||||
}
|
9
app/tests/factories/Preference.php
Normal file
9
app/tests/factories/Preference.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
League\FactoryMuffin\Facade::define(
|
||||
'Preference', [
|
||||
'user_id' => 'factory|User',
|
||||
'name' => 'word',
|
||||
'data' => 'sentence',
|
||||
]
|
||||
);
|
@ -10,7 +10,21 @@ League\FactoryMuffin\Facade::define(
|
||||
|
||||
return $code;
|
||||
},
|
||||
'name' => 'word',
|
||||
'symbol' => '$'
|
||||
'name' => function () {
|
||||
$code = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$code .= chr(rand(65, 90));
|
||||
}
|
||||
|
||||
return $code;
|
||||
},
|
||||
'symbol' => function () {
|
||||
$code = '';
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$code .= chr(rand(65, 90));
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
]
|
||||
);
|
||||
|
30
tests/unit/TransactionTypeTest.php
Normal file
30
tests/unit/TransactionTypeTest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class TransactionTypeTest
|
||||
*/
|
||||
class TransactionTypeTest extends TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
// tests
|
||||
|
||||
public function testJournals()
|
||||
{
|
||||
$journal = f::create('TransactionJournal');
|
||||
$type = $journal->transactionType;
|
||||
$this->assertCount(1, $type->transactionJournals()->get());
|
||||
}
|
||||
|
||||
|
||||
}
|
34
tests/unit/UserTest.php
Normal file
34
tests/unit/UserTest.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade as f;
|
||||
|
||||
/**
|
||||
* Class AccountTest
|
||||
*/
|
||||
class UserTest extends TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
// tests
|
||||
|
||||
public function testPreference()
|
||||
{
|
||||
$pref = f::create('Preference');
|
||||
$this->assertEquals($pref->user_id, $pref->user->id);
|
||||
}
|
||||
|
||||
public function testReminder()
|
||||
{
|
||||
$reminder = f::create('Reminder');
|
||||
$this->assertEquals($reminder->user_id, $reminder->user->id);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user