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
]
);
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -250,7 +250,8 @@ class BudgetRepository implements BudgetRepositoryInterface
->before($end)
->lessThan(0)
->transactionTypes(['Withdrawal'])
->sum('transactions.amount');
->sum('transactions.amount');
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!');
// @codeCoverageIgnoreStart
}
// @codeCoverageIgnoreEnd
return [$from, $to];

View File

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

View File

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

View File

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

View File

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

View File

@ -115,29 +115,6 @@ class TagControllerTest extends TestCase
$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()
{
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
@ -156,6 +133,28 @@ class TagControllerTest extends TestCase
$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()
{
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');

View File

@ -173,7 +173,7 @@ FactoryMuffin::define(
'FireflyIII\Models\AccountType',
[
'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();
if ($count < 4) {
return $types[$count];

View File

@ -49,7 +49,7 @@ class ConnectJournalToPiggyBankTest extends TestCase
$user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
/** @var \FireflyIII\Models\PiggyBank $piggyBank */
$piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
$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
// the piggy bank repetition:
/** @var \FireflyIII\Models\PiggyBankRepetition $rep */
foreach($piggyBank->piggyBankRepetitions()->get() as $rep) {
foreach ($piggyBank->piggyBankRepetitions()->get() as $rep) {
$rep->forceDelete();
}

View File

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

View File

@ -363,7 +363,7 @@ class BudgetRepositoryTest extends TestCase
*/
public function testUpdateLimitAmountExisting()
{
$budgetLimit= FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$budgetLimit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$result = $this->object->updateLimitAmount($budgetLimit->budget, $budgetLimit->startdate, 100);
@ -376,7 +376,7 @@ class BudgetRepositoryTest extends TestCase
*/
public function testUpdateLimitAmountZero()
{
$budgetLimit= FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$budgetLimit = FactoryMuffin::create('FireflyIII\Models\BudgetLimit');
$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->amount, 50);
}
/**
* @covers FireflyIII\Repositories\Journal\JournalRepository::update
* @covers FireflyIII\Repositories\Journal\JournalRepository::updateTags

View File

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