Cleanup [skip ci]

This commit is contained in:
James Cole
2015-05-14 09:51:54 +02:00
parent d543c033a3
commit 1dcf7407e6
26 changed files with 84 additions and 47 deletions

View File

@@ -91,6 +91,7 @@ class ConnectJournalToPiggyBank
'amount' => $amount 'amount' => $amount
] ]
); );
return true; return true;
} }

View File

@@ -18,6 +18,7 @@ class Help implements HelpInterface
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $key * @param $key
* *
* @return string * @return string
@@ -29,6 +30,7 @@ class Help implements HelpInterface
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $route * @param $route
* *
* @return array * @return array
@@ -57,6 +59,7 @@ class Help implements HelpInterface
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $route * @param $route
* *
* @return bool * @return bool
@@ -68,6 +71,7 @@ class Help implements HelpInterface
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $route * @param $route
* @param array $content * @param array $content
* *
@@ -81,6 +85,7 @@ class Help implements HelpInterface
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $route * @param $route
* *
* @return bool * @return bool

View File

@@ -118,10 +118,10 @@ class ReportHelper implements ReportHelperInterface
$sharedAccounts = []; $sharedAccounts = [];
if ($showSharedReports === false) { if ($showSharedReports === false) {
$sharedCollection = Auth::user()->accounts() $sharedCollection = Auth::user()->accounts()
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id') ->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
->where('account_meta.name', '=', 'accountRole') ->where('account_meta.name', '=', 'accountRole')
->where('account_meta.data', '=', json_encode('sharedAsset')) ->where('account_meta.data', '=', json_encode('sharedAsset'))
->get(['accounts.id']); ->get(['accounts.id']);
foreach ($sharedCollection as $account) { foreach ($sharedCollection as $account) {
$sharedAccounts[] = $account->id; $sharedAccounts[] = $account->id;

View File

@@ -38,6 +38,7 @@ class AuthController extends Controller
* *
* @param \Illuminate\Contracts\Auth\Guard $auth * @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\Registrar $registrar * @param \Illuminate\Contracts\Auth\Registrar $registrar
*
* @codeCoverageIgnore * @codeCoverageIgnore
* *
*/ */

View File

@@ -7,6 +7,7 @@ use Illuminate\Foundation\Auth\ResetsPasswords;
/** /**
* Class PasswordController * Class PasswordController
*
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Http\Controllers\Auth * @package FireflyIII\Http\Controllers\Auth
*/ */

View File

@@ -3,7 +3,6 @@
namespace FireflyIII\Http\Middleware; namespace FireflyIII\Http\Middleware;
use App;
use Closure; use Closure;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankRepetition; use FireflyIII\Models\PiggyBankRepetition;

View File

@@ -133,6 +133,7 @@ class Account extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return string * @return string
@@ -160,6 +161,7 @@ class Account extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param array $types * @param array $types
*/ */
@@ -174,6 +176,7 @@ class Account extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param string $name * @param string $name
* @param string $value * @param string $value
@@ -191,6 +194,7 @@ class Account extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)

View File

@@ -79,6 +79,7 @@ class Category extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
@@ -89,6 +90,7 @@ class Category extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return string * @return string

View File

@@ -64,6 +64,7 @@ class PiggyBank extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return int * @return int
@@ -93,6 +94,7 @@ class PiggyBank extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
@@ -103,6 +105,7 @@ class PiggyBank extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return string * @return string

View File

@@ -18,6 +18,7 @@ class Reminder extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return int * @return int
@@ -38,6 +39,7 @@ class Reminder extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return mixed * @return mixed
@@ -53,6 +55,7 @@ class Reminder extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return bool * @return bool
@@ -73,6 +76,7 @@ class Reminder extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
@@ -86,6 +90,7 @@ class Reminder extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* *
* @return $this * @return $this
@@ -100,6 +105,7 @@ class Reminder extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
*/ */
public function setMetadataAttribute($value) public function setMetadataAttribute($value)

View File

@@ -77,6 +77,7 @@ class Tag extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return string * @return string
@@ -88,6 +89,7 @@ class Tag extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return string * @return string
@@ -99,6 +101,7 @@ class Tag extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
*/ */
public function setDescriptionAttribute($value) public function setDescriptionAttribute($value)
@@ -108,6 +111,7 @@ class Tag extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
*/ */
public function setTagAttribute($value) public function setTagAttribute($value)

View File

@@ -116,6 +116,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
* *
* @return string * @return string
@@ -140,6 +141,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param Account $account * @param Account $account
*/ */
@@ -154,6 +156,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param Carbon $date * @param Carbon $date
* *
@@ -166,6 +169,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param Carbon $date * @param Carbon $date
* *
@@ -178,6 +182,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param $amount * @param $amount
*/ */
@@ -195,6 +200,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param Carbon $date * @param Carbon $date
* *
@@ -207,6 +213,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param array $types * @param array $types
*/ */
@@ -239,6 +246,7 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*
* @param $value * @param $value
*/ */
public function setDescriptionAttribute($value) public function setDescriptionAttribute($value)

View File

@@ -10,9 +10,9 @@ use FireflyIII\Support\Preferences;
use FireflyIII\Support\Steam; use FireflyIII\Support\Steam;
use FireflyIII\Support\Twig\Budget; use FireflyIII\Support\Twig\Budget;
use FireflyIII\Support\Twig\General; use FireflyIII\Support\Twig\General;
use FireflyIII\Support\Twig\Translation;
use FireflyIII\Support\Twig\Journal; use FireflyIII\Support\Twig\Journal;
use FireflyIII\Support\Twig\PiggyBank; use FireflyIII\Support\Twig\PiggyBank;
use FireflyIII\Support\Twig\Translation;
use FireflyIII\Validation\FireflyValidator; use FireflyIII\Validation\FireflyValidator;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Twig; use Twig;

View File

@@ -250,7 +250,8 @@ class BudgetRepository implements BudgetRepositoryInterface
->before($end) ->before($end)
->lessThan(0) ->lessThan(0)
->transactionTypes(['Withdrawal']) ->transactionTypes(['Withdrawal'])
->sum('transactions.amount'); ->sum('transactions.amount');
return floatval($noBudgetSet) * -1; return floatval($noBudgetSet) * -1;
} }

View File

@@ -391,6 +391,7 @@ class JournalRepository implements JournalRepositoryInterface
App::abort(500, '"from"-account is null, so we cannot continue!'); App::abort(500, '"from"-account is null, so we cannot continue!');
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} }
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
return [$from, $to]; return [$from, $to];

View File

@@ -151,8 +151,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
{ {
// split query to make it work in sqlite: // split query to make it work in sqlite:
$set = PiggyBank:: $set = PiggyBank::
leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.id') leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.id')
->where('accounts.user_id', Auth::user()->id)->get(['piggy_banks.*']); ->where('accounts.user_id', Auth::user()->id)->get(['piggy_banks.*']);
foreach ($set as $e) { foreach ($set as $e) {
$e->order = 0; $e->order = 0;
$e->save(); $e->save();

View File

@@ -111,6 +111,7 @@ class TagRepository implements TagRepositoryInterface
return false; return false;
} }
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
return false; return false;
} }

View File

@@ -24,7 +24,7 @@ class Translation extends Twig_Extension
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'_', function ($name) { '_', function ($name) {
return trans('firefly.'.$name); return trans('firefly.' . $name);
}, ['is_safe' => ['html']] }, ['is_safe' => ['html']]
); );

View File

@@ -39,7 +39,7 @@ class AuthControllerTest extends TestCase
public function testPostRegister() public function testPostRegister()
{ {
$data = [ $data = [
'email' => 'test@example.com', 'email' => 'test@example.com',
'password' => 'onetwothree', 'password' => 'onetwothree',
'password_confirmation' => 'onetwothree', 'password_confirmation' => 'onetwothree',
@@ -53,7 +53,7 @@ class AuthControllerTest extends TestCase
public function testPostRegisterFails() public function testPostRegisterFails()
{ {
$data = [ $data = [
'email' => 'test@example.com', 'email' => 'test@example.com',
'password' => 'onetwothree', 'password' => 'onetwothree',
'password_confirmation' => 'onetwofour', 'password_confirmation' => 'onetwofour',

View File

@@ -115,29 +115,6 @@ class TagControllerTest extends TestCase
$this->assertResponseOk(); $this->assertResponseOk();
} }
public function testMultipleDeposits()
{
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
for ($i = 0; $i < 3; $i++) {
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->transaction_type_id = $type->id;
$journal->save();
$tag->transactionJournals()->save($journal);
}
$tag->tagMode = 'nothing';
$tag->save();
$this->be($tag->user);
$this->call('GET', '/tags/edit/' . $tag->id);
$this->assertResponseOk();
}
public function testHideTagHelp() public function testHideTagHelp()
{ {
$tag = FactoryMuffin::create('FireflyIII\Models\Tag'); $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
@@ -156,6 +133,28 @@ class TagControllerTest extends TestCase
$this->assertResponseOk(); $this->assertResponseOk();
} }
public function testMultipleDeposits()
{
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
for ($i = 0; $i < 3; $i++) {
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->transaction_type_id = $type->id;
$journal->save();
$tag->transactionJournals()->save($journal);
}
$tag->tagMode = 'nothing';
$tag->save();
$this->be($tag->user);
$this->call('GET', '/tags/edit/' . $tag->id);
$this->assertResponseOk();
}
public function testShow() public function testShow()
{ {
$tag = FactoryMuffin::create('FireflyIII\Models\Tag'); $tag = FactoryMuffin::create('FireflyIII\Models\Tag');

View File

@@ -173,7 +173,7 @@ FactoryMuffin::define(
'FireflyIII\Models\AccountType', 'FireflyIII\Models\AccountType',
[ [
'type' => function () { 'type' => function () {
$types = ['Expense account', 'Revenue account', 'Asset account','Cash account']; $types = ['Expense account', 'Revenue account', 'Asset account', 'Cash account'];
$count = DB::table('account_types')->count(); $count = DB::table('account_types')->count();
if ($count < 4) { if ($count < 4) {
return $types[$count]; return $types[$count];

View File

@@ -49,7 +49,7 @@ class ConnectJournalToPiggyBankTest extends TestCase
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user); $this->be($user);
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
/** @var \FireflyIII\Models\PiggyBank $piggyBank */ /** @var \FireflyIII\Models\PiggyBank $piggyBank */
$piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
$account1 = FactoryMuffin::create('FireflyIII\Models\Account'); $account1 = FactoryMuffin::create('FireflyIII\Models\Account');
@@ -64,7 +64,7 @@ class ConnectJournalToPiggyBankTest extends TestCase
// because the event handler responds to this piggy bank, we must remove // because the event handler responds to this piggy bank, we must remove
// the piggy bank repetition: // the piggy bank repetition:
/** @var \FireflyIII\Models\PiggyBankRepetition $rep */ /** @var \FireflyIII\Models\PiggyBankRepetition $rep */
foreach($piggyBank->piggyBankRepetitions()->get() as $rep) { foreach ($piggyBank->piggyBankRepetitions()->get() as $rep) {
$rep->forceDelete(); $rep->forceDelete();
} }

View File

@@ -130,8 +130,8 @@ class ReportHelperTest extends TestCase
public function testYearBalanceReport() public function testYearBalanceReport()
{ {
$date = new Carbon('2015-01-01'); $date = new Carbon('2015-01-01');
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$setShared = []; $setShared = [];
$setNormal = []; $setNormal = [];
@@ -171,7 +171,7 @@ class ReportHelperTest extends TestCase
$this->be($user); $this->be($user);
$result = $this->object->yearBalanceReport($date, false); $result = $this->object->yearBalanceReport($date, false);
foreach($result as $entry) { foreach ($result as $entry) {
// everything is hidden: // everything is hidden:
$this->assertTrue($entry['hide']); $this->assertTrue($entry['hide']);
// nothing is shared: // nothing is shared:
@@ -182,8 +182,8 @@ class ReportHelperTest extends TestCase
public function testYearBalanceReportWithShared() public function testYearBalanceReportWithShared()
{ {
$date = new Carbon('2015-01-01'); $date = new Carbon('2015-01-01');
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$setShared = []; $setShared = [];
$setNormal = []; $setNormal = [];
@@ -223,7 +223,7 @@ class ReportHelperTest extends TestCase
$this->be($user); $this->be($user);
$result = $this->object->yearBalanceReport($date, true); $result = $this->object->yearBalanceReport($date, true);
foreach($result as $entry) { foreach ($result as $entry) {
// everything is hidden: // everything is hidden:
$this->assertTrue($entry['hide']); $this->assertTrue($entry['hide']);
// nothing is shared: // nothing is shared:

View File

@@ -363,7 +363,7 @@ class BudgetRepositoryTest extends TestCase
*/ */
public function testUpdateLimitAmountExisting() public function testUpdateLimitAmountExisting()
{ {
$budgetLimit= FactoryMuffin::create('FireflyIII\Models\BudgetLimit'); $budgetLimit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 100); $result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 100);
@@ -376,7 +376,7 @@ class BudgetRepositoryTest extends TestCase
*/ */
public function testUpdateLimitAmountZero() public function testUpdateLimitAmountZero()
{ {
$budgetLimit= FactoryMuffin::create('FireflyIII\Models\BudgetLimit'); $budgetLimit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 0); $result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 0);

View File

@@ -478,6 +478,7 @@ class JournalRepositoryTest extends TestCase
$this->assertEquals($result->description, $data['description']); $this->assertEquals($result->description, $data['description']);
$this->assertEquals($result->amount, 50); $this->assertEquals($result->amount, 50);
} }
/** /**
* @covers FireflyIII\Repositories\Journal\JournalRepository::update * @covers FireflyIII\Repositories\Journal\JournalRepository::update
* @covers FireflyIII\Repositories\Journal\JournalRepository::updateTags * @covers FireflyIII\Repositories\Journal\JournalRepository::updateTags

View File

@@ -380,7 +380,7 @@ class TagRepositoryTest extends TestCase
*/ */
public function testUpdate() public function testUpdate()
{ {
$tag = FactoryMuffin::create('FireflyIII\Models\Tag'); $tag = FactoryMuffin::create('FireflyIII\Models\Tag');
$data = [ $data = [