Various code cleanup [skip ci]

This commit is contained in:
James Cole
2015-05-05 07:51:02 +02:00
parent e1941daedd
commit 67fdd27499
17 changed files with 42 additions and 43 deletions

View File

@@ -17,7 +17,6 @@ use Response;
use Session; use Session;
use URL; use URL;
use View; use View;
use Log;
/** /**
* Class TransactionController * Class TransactionController
@@ -291,7 +290,6 @@ class TransactionController extends Controller
} }
/** /**
* @param JournalFormRequest $request * @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository * @param JournalRepositoryInterface $repository

View File

@@ -177,7 +177,7 @@ Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'r
Route::controllers( Route::controllers(
[ [
'auth' => 'Auth\AuthController', 'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController', 'password' => 'Auth\PasswordController',
] ]
); );

View File

@@ -1,6 +1,7 @@
<?php <?php
namespace FireflyIII\Repositories\Reminder; namespace FireflyIII\Repositories\Reminder;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;

View File

@@ -155,7 +155,7 @@ class Amount
$currencyPreference = Prefs::get('currencyPreference', 'EUR'); $currencyPreference = Prefs::get('currencyPreference', 'EUR');
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first(); $currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
if ($currency) { if ($currency) {
Cache::forever('FFCURRENCYCODE', $currency->code); Cache::forever('FFCURRENCYCODE', $currency->code);

View File

@@ -203,7 +203,7 @@ class FireflyValidator extends Validator
$alwaysEncrypted = true; $alwaysEncrypted = true;
} }
if(is_null(Auth::user())) { if (is_null(Auth::user())) {
// user is not logged in.. weird. // user is not logged in.. weird.
return true; return true;
} else { } else {

View File

@@ -7,6 +7,7 @@ use FireflyIII\Models\Component;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName) // method names are mandated by laravel. * @SuppressWarnings(PHPMD.ShortMethodName) // method names are mandated by laravel.
* @SuppressWarnings("TooManyMethods") // I'm fine with this * @SuppressWarnings("TooManyMethods") // I'm fine with this

View File

@@ -134,7 +134,7 @@ class ChangesForV336 extends Migration
// reinstate a long forgotten index: // reinstate a long forgotten index:
Schema::table( Schema::table(
'budget_limits', function (Blueprint $table) { 'budget_limits', function (Blueprint $table) {
$table->unique(['budget_id', 'startdate'],'unique_limit'); $table->unique(['budget_id', 'startdate'], 'unique_limit');
} }
); );

View File

@@ -57,7 +57,8 @@ class ChangesForV3310 extends Migration
); );
Schema::create('tag_transaction_journal',function (Blueprint $table) { Schema::create(
'tag_transaction_journal', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('tag_id')->unsigned(); $table->integer('tag_id')->unsigned();
$table->integer('transaction_journal_id')->unsigned(); $table->integer('transaction_journal_id')->unsigned();
@@ -69,7 +70,8 @@ class ChangesForV3310 extends Migration
// add unique. // add unique.
$table->unique(['tag_id', 'transaction_journal_id'], 'tag_t_joined'); $table->unique(['tag_id', 'transaction_journal_id'], 'tag_t_joined');
}); }
);
} }
} }

View File

@@ -1,32 +1,32 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
/** /**
* Class ChangesForV3310b * Class ChangesForV3310b
*/ */
class ChangesForV3310b extends Migration { class ChangesForV3310b extends Migration
{
/** /**
* Run the migrations. * Reverse the migrations.
* *
* @return void * @return void
*/ */
public function up() public function down()
{ {
//
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// set all current entries to be "balance" // set all current entries to be "balance"
DB::table('transaction_groups')->update(['relation' => 'balance']); DB::table('transaction_groups')->update(['relation' => 'balance']);
} }
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
} }

View File

@@ -46,7 +46,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
// create EUR currency // create EUR currency
/** @var TransactionCurrency $currency */ /** @var TransactionCurrency $currency */
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency'); $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$currency->code = 'EUR'; $currency->code = 'EUR';
$currency->save(); $currency->save();
Log::debug('Created new EUR currency.'); Log::debug('Created new EUR currency.');
@@ -66,8 +66,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
); );
} }
/** /**

View File

@@ -191,7 +191,6 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('getCurrencyCode')->andReturn('XX'); Amount::shouldReceive('getCurrencyCode')->andReturn('XX');
$this->call('GET', '/bills/show/' . $bill->id); $this->call('GET', '/bills/show/' . $bill->id);
} }

View File

@@ -84,7 +84,7 @@ class HelpControllerTest extends TestCase
public function testGetHelpTextNoRoute() public function testGetHelpTextNoRoute()
{ {
// login // login
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user); $this->be($user);
// mock some stuff. // mock some stuff.

View File

@@ -210,7 +210,7 @@ class JsonControllerTest extends TestCase
public function testTransactionJournals() public function testTransactionJournals()
{ {
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$type = FactoryMuffin::create('FireflyIII\Models\TransactionType'); $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
$collection = new Collection([$journal]); $collection = new Collection([$journal]);
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user); $this->be($user);

View File

@@ -6,6 +6,7 @@ use FireflyIII\Models\Preference;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin; use League\FactoryMuffin\Facade as FactoryMuffin;
/** /**
* Class PiggyBankControllerTest * Class PiggyBankControllerTest
*/ */
@@ -110,7 +111,7 @@ class PiggyBankControllerTest extends TestCase
public function testEdit() public function testEdit()
{ {
$piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
$piggyBank->targetdate = Carbon::now()->addYear(); $piggyBank->targetdate = Carbon::now()->addYear();
$piggyBank->save(); $piggyBank->save();
$this->be($piggyBank->account->user); $this->be($piggyBank->account->user);

View File

@@ -65,7 +65,7 @@ class PreferencesControllerTest extends TestCase
public function testPostIndex() public function testPostIndex()
{ {
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user); $this->be($user);
$data = [ $data = [

View File

@@ -59,7 +59,7 @@ class ReminderControllerTest extends TestCase
public function testIndex() public function testIndex()
{ {
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user); $this->be($user);
$reminder = FactoryMuffin::create('FireflyIII\Models\Reminder'); $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
$collection = new Collection([$reminder]); $collection = new Collection([$reminder]);
@@ -77,7 +77,7 @@ class ReminderControllerTest extends TestCase
public function testShow() public function testShow()
{ {
$reminder = FactoryMuffin::create('FireflyIII\Models\Reminder'); $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
$reminder->notnow = false; $reminder->notnow = false;
$reminder->save(); $reminder->save();
$this->be($reminder->remindersable->account->user); $this->be($reminder->remindersable->account->user);
@@ -88,7 +88,7 @@ class ReminderControllerTest extends TestCase
public function testShowDismissed() public function testShowDismissed()
{ {
$reminder = FactoryMuffin::create('FireflyIII\Models\Reminder'); $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
$reminder->notnow = true; $reminder->notnow = true;
$reminder->save(); $reminder->save();
$this->be($reminder->remindersable->account->user); $this->be($reminder->remindersable->account->user);

View File

@@ -1,7 +1,5 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin; use League\FactoryMuffin\Facade as FactoryMuffin;
/** /**
@@ -38,7 +36,8 @@ class SearchControllerTest extends TestCase
parent::tearDown(); parent::tearDown();
} }
public function testSearch() { public function testSearch()
{
$user = FactoryMuffin::create('FireflyIII\User'); $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user); $this->be($user);
$words = ['Something']; $words = ['Something'];
@@ -50,7 +49,7 @@ class SearchControllerTest extends TestCase
$repository->shouldReceive('searchBudgets')->with($words)->once()->andReturn([]); $repository->shouldReceive('searchBudgets')->with($words)->once()->andReturn([]);
$repository->shouldReceive('searchTags')->with($words)->once()->andReturn([]); $repository->shouldReceive('searchTags')->with($words)->once()->andReturn([]);
$this->call('GET','/search?q=Something'); $this->call('GET', '/search?q=Something');
$this->assertResponseOk(); $this->assertResponseOk();
} }
} }