Skip to content

Firefly III: a personal finances manager

All kinds of cleanup.

James Cole31a0be5bb491
diff --git a/.gitignore b/.gitignore
index b8e7b848f2..7c2baa148d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ firefly-iii-import-*.json
tests/_output/*
testing.sqlite
+c3.php
diff --git a/app/config/packages/barryvdh/laravel-debugbar/config.php b/app/config/packages/barryvdh/laravel-debugbar/config.php
index b4ba5d5c62..3baf4b799a 100644
--- a/app/config/packages/barryvdh/laravel-debugbar/config.php
+++ b/app/config/packages/barryvdh/laravel-debugbar/config.php
@@ -2,14 +2,14 @@
use Illuminate\Support\Facades\Config;
-return array(
+return [
- 'enabled' => Config::get('app.debug'),
+ 'enabled' => Config::get('app.debug'),
- 'storage' => array(
+ 'storage' => [
'enabled' => true,
- 'path' => storage_path() . '/debugbar',
- ),
+ 'path' => storage_path() . '/debugbar',
+ ],
/*
|--------------------------------------------------------------------------
@@ -37,8 +37,8 @@ return array(
|
*/
- 'capture_ajax' => true,
-
+ 'capture_ajax' => true,
+
/*
|--------------------------------------------------------------------------
| Capture Console Commands
@@ -59,7 +59,7 @@ return array(
|
*/
- 'collectors' => array(
+ 'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
@@ -78,7 +78,7 @@ return array(
'files' => false, // Show the included files
'config' => false, // Display config settings
'auth' => false, // Display Laravel authentication status
- ),
+ ],
/*
|--------------------------------------------------------------------------
@@ -89,27 +89,27 @@ return array(
|
*/
- 'options' => array(
- 'auth' => array(
+ 'options' => [
+ 'auth' => [
'show_name' => false, // Also show the users name/email in the debugbar
- ),
- 'db' => array(
- 'with_params' => true, // Render SQL with the parameters substituted
- 'timeline' => false, // Add the queries to the timeline
- ),
- 'mail' => array(
+ ],
+ 'db' => [
+ 'with_params' => true, // Render SQL with the parameters substituted
+ 'timeline' => false, // Add the queries to the timeline
+ ],
+ 'mail' => [
'full_log' => false
- ),
- 'views' => array(
+ ],
+ 'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
- ),
- 'route' => array(
+ ],
+ 'route' => [
'label' => true // show complete route on bar
- ),
- 'logs' => array(
+ ],
+ 'logs' => [
'file' => null
- ),
- ),
+ ],
+ ],
/*
|--------------------------------------------------------------------------
@@ -122,6 +122,6 @@ return array(
|
*/
- 'inject' => true,
+ 'inject' => true,
-);
+];
diff --git a/app/config/packages/barryvdh/laravel-ide-helper/config.php b/app/config/packages/barryvdh/laravel-ide-helper/config.php
index 89b3dada2f..a49a469e62 100644
--- a/app/config/packages/barryvdh/laravel-ide-helper/config.php
+++ b/app/config/packages/barryvdh/laravel-ide-helper/config.php
@@ -1,6 +1,6 @@
<?php
-return array(
+return [
/*
|--------------------------------------------------------------------------
@@ -11,7 +11,7 @@ return array(
|
*/
- 'filename' => '_ide_helper.php',
+ 'filename' => '_ide_helper.php',
/*
|--------------------------------------------------------------------------
@@ -25,9 +25,9 @@ return array(
'include_helpers' => false,
- 'helper_files' => array(
- base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
- ),
+ 'helper_files' => [
+ base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
+ ],
/*
|--------------------------------------------------------------------------
@@ -39,9 +39,9 @@ return array(
|
*/
- 'model_locations' => array(
+ 'model_locations' => [
'app/models',
- ),
+ ],
/*
@@ -53,14 +53,14 @@ return array(
|
*/
- 'extra' => array(
- 'Artisan' => array('Illuminate\Foundation\Artisan'),
- 'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'),
- 'Session' => array('Illuminate\Session\Store'),
- ),
+ 'extra' => [
+ 'Artisan' => ['Illuminate\Foundation\Artisan'],
+ 'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'],
+ 'Session' => ['Illuminate\Session\Store'],
+ ],
- 'magic' => array(
- 'Log' => array(
+ 'magic' => [
+ 'Log' => [
'debug' => 'Monolog\Logger::addDebug',
'info' => 'Monolog\Logger::addInfo',
'notice' => 'Monolog\Logger::addNotice',
@@ -69,7 +69,8 @@ return array(
'critical' => 'Monolog\Logger::addCritical',
'alert' => 'Monolog\Logger::addAlert',
'emergency' => 'Monolog\Logger::addEmergency',
- )
- )
+ ]
+ ]
-);
+
+];
diff --git a/app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php b/app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php
index a46482b491..e58b40faa9 100644
--- a/app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php
+++ b/app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php
@@ -1,5 +1,5 @@
<?php
-return array(
+return [
'view' => 'laravel-breadcrumbs::bootstrap3',
-);
+];
diff --git a/app/config/testing/cache.php b/app/config/testing/cache.php
index 66a8a39a86..729ae3a825 100644
--- a/app/config/testing/cache.php
+++ b/app/config/testing/cache.php
@@ -1,6 +1,6 @@
<?php
-return array(
+return [
/*
|--------------------------------------------------------------------------
@@ -17,4 +17,4 @@ return array(
'driver' => 'array',
-);
+];
diff --git a/app/config/testing/session.php b/app/config/testing/session.php
index 0364b63dcc..46bf726a27 100644
--- a/app/config/testing/session.php
+++ b/app/config/testing/session.php
@@ -1,6 +1,6 @@
<?php
-return array(
+return [
/*
|--------------------------------------------------------------------------
@@ -18,4 +18,4 @@ return array(
'driver' => 'array',
-);
+];
diff --git a/app/config/view.php b/app/config/view.php
index e0529fb669..f3b156d455 100644
--- a/app/config/view.php
+++ b/app/config/view.php
@@ -1,6 +1,6 @@
<?php
return [
- 'paths' => array(__DIR__ . '/../views'),
+ 'paths' => [__DIR__ . '/../views'],
'pagination' => 'pagination::slider-3',
];
diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php
index 18ca03429a..5d101c850f 100644
--- a/app/controllers/UserController.php
+++ b/app/controllers/UserController.php
@@ -92,6 +92,7 @@ class UserController extends BaseController
return View::make('user.registered');
}
+
return View::make('user.register');
}
diff --git a/app/filters.php b/app/filters.php
index 49ca4c8666..a55467f0e3 100644
--- a/app/filters.php
+++ b/app/filters.php
@@ -68,6 +68,7 @@ Route::filter(
if (Auth::check()) {
return Redirect::to('/');
}
+ return null;
}
);
diff --git a/app/lang/en/pagination.php b/app/lang/en/pagination.php
index 6b99ef5fd8..88e22db661 100644
--- a/app/lang/en/pagination.php
+++ b/app/lang/en/pagination.php
@@ -1,6 +1,6 @@
<?php
-return array(
+return [
/*
|--------------------------------------------------------------------------
@@ -17,4 +17,4 @@ return array(
'next' => 'Next &raquo;',
-);
+];
diff --git a/app/lang/en/reminders.php b/app/lang/en/reminders.php
index e42148e9fb..a416c65cb5 100644
--- a/app/lang/en/reminders.php
+++ b/app/lang/en/reminders.php
@@ -1,24 +1,24 @@
<?php
-return array(
+return [
- /*
- |--------------------------------------------------------------------------
- | Password Reminder Language Lines
- |--------------------------------------------------------------------------
- |
- | The following language lines are the default lines which match reasons
- | that are given by the password broker for a password update attempt
- | has failed, such as for an invalid token or invalid new password.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Password Reminder Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are the default lines which match reasons
+ | that are given by the password broker for a password update attempt
+ | has failed, such as for an invalid token or invalid new password.
+ |
+ */
- "password" => "Passwords must be at least six characters and match the confirmation.",
+ "password" => "Passwords must be at least six characters and match the confirmation.",
- "user" => "We can't find a user with that e-mail address.",
+ "user" => "We can't find a user with that e-mail address.",
- "token" => "This password reset token is invalid.",
+ "token" => "This password reset token is invalid.",
- "sent" => "Password reminder sent!",
+ "sent" => "Password reminder sent!",
-);
+];
diff --git a/app/lang/en/validation.php b/app/lang/en/validation.php
index 4c17703856..e6ee8b9253 100644
--- a/app/lang/en/validation.php
+++ b/app/lang/en/validation.php
@@ -21,12 +21,12 @@ return [
"alpha_num" => "The :attribute may only contain letters and numbers.",
"array" => "The :attribute must be an array.",
"before" => "The :attribute must be a date before :date.",
- "between" => array(
+ "between" => [
"numeric" => "The :attribute must be between :min and :max.",
"file" => "The :attribute must be between :min and :max kilobytes.",
"string" => "The :attribute must be between :min and :max characters.",
"array" => "The :attribute must have between :min and :max items.",
- ),
+ ],
"confirmed" => "The :attribute confirmation does not match.",
"date" => "The :attribute is not a valid date.",
"date_format" => "The :attribute does not match the format :format.",
@@ -39,19 +39,19 @@ return [
"in" => "The selected :attribute is invalid.",
"integer" => "The :attribute must be an integer.",
"ip" => "The :attribute must be a valid IP address.",
- "max" => array(
+ "max" => [
"numeric" => "The :attribute may not be greater than :max.",
"file" => "The :attribute may not be greater than :max kilobytes.",
"string" => "The :attribute may not be greater than :max characters.",
"array" => "The :attribute may not have more than :max items.",
- ),
+ ],
"mimes" => "The :attribute must be a file of type: :values.",
- "min" => array(
+ "min" => [
"numeric" => "The :attribute must be at least :min.",
"file" => "The :attribute must be at least :min kilobytes.",
"string" => "The :attribute must be at least :min characters.",
"array" => "The :attribute must have at least :min items.",
- ),
+ ],
"not_in" => "The selected :attribute is invalid.",
"numeric" => "The :attribute must be a number.",
"regex" => "The :attribute format is invalid.",
@@ -62,12 +62,12 @@ return [
"required_without" => "The :attribute field is required when :values is not present.",
"required_without_all" => "The :attribute field is required when none of :values are present.",
"same" => "The :attribute and :other must match.",
- "size" => array(
+ "size" => [
"numeric" => "The :attribute must be :size.",
"file" => "The :attribute must be :size kilobytes.",
"string" => "The :attribute must be :size characters.",
"array" => "The :attribute must contain :size items.",
- ),
+ ],
"unique" => "The :attribute has already been taken.",
"url" => "The :attribute format is invalid.",
@@ -82,11 +82,11 @@ return [
|
*/
- 'custom' => array(
- 'attribute-name' => array(
+ 'custom' => [
+ 'attribute-name' => [
'rule-name' => 'custom-message',
- ),
- ),
+ ],
+ ],
'alphabasic' => 'The :attribute field must consist of basic alphanumeric characters.',
/*
@@ -100,6 +100,6 @@ return [
|
*/
- 'attributes' => array(),
+ 'attributes' => [],
];
diff --git a/app/lib/FireflyIII/Database/AccountType.php b/app/lib/FireflyIII/Database/AccountType.php
index 68b3911b8f..6a7131d2b1 100644
--- a/app/lib/FireflyIII/Database/AccountType.php
+++ b/app/lib/FireflyIII/Database/AccountType.php
@@ -109,8 +109,6 @@ class AccountType implements CUD, CommonDatabaseCalls
break;
}
-
- return null;
}
/**
diff --git a/app/lib/FireflyIII/Database/Report.php b/app/lib/FireflyIII/Database/Report.php
index 2c6d7c5780..db48935f09 100644
--- a/app/lib/FireflyIII/Database/Report.php
+++ b/app/lib/FireflyIII/Database/Report.php
@@ -67,6 +67,7 @@ class Report implements ReportInterface
}
}
}
+ return null;
}
);
} else {
@@ -86,6 +87,7 @@ class Report implements ReportInterface
}
}
}
+ return null;
}
);
}
@@ -148,6 +150,7 @@ class Report implements ReportInterface
}
}
}
+ return null;
}
);
} else {
@@ -157,6 +160,7 @@ class Report implements ReportInterface
if ($journal->transactionType->type == 'Deposit') {
return $journal;
}
+ return null;
}
);
}
diff --git a/app/lib/FireflyIII/Database/TransactionType.php b/app/lib/FireflyIII/Database/TransactionType.php
index 6414f7e835..566c60ba45 100644
--- a/app/lib/FireflyIII/Database/TransactionType.php
+++ b/app/lib/FireflyIII/Database/TransactionType.php
@@ -108,8 +108,6 @@ class TransactionType implements CUD, CommonDatabaseCalls
}
-
- return null;
}
/**
diff --git a/app/lib/FireflyIII/FF3ServiceProvider.php b/app/lib/FireflyIII/FF3ServiceProvider.php
index 5069de9eae..0dad668bcf 100644
--- a/app/lib/FireflyIII/FF3ServiceProvider.php
+++ b/app/lib/FireflyIII/FF3ServiceProvider.php
@@ -1,6 +1,12 @@
<?php
namespace FireflyIII;
+use FireflyIII\Shared\Toolkit\Date;
+use FireflyIII\Shared\Toolkit\Filter;
+use FireflyIII\Shared\Toolkit\Form;
+use FireflyIII\Shared\Toolkit\Navigation;
+use FireflyIII\Shared\Toolkit\Reminders;
+use FireflyIII\Shared\Toolkit\Steam;
use FireflyIII\Shared\Validation\FireflyValidator;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
@@ -42,27 +48,27 @@ class FF3ServiceProvider extends ServiceProvider
$this->app->bind(
'reminders', function () {
- return new \FireflyIII\Shared\Toolkit\Reminders;
+ return new Reminders;
}
);
$this->app->bind(
'filter', function () {
- return new \FireflyIII\Shared\Toolkit\Filter;
+ return new Filter;
}
);
$this->app->bind(
'datekit', function () {
- return new \FireflyIII\Shared\Toolkit\Date;
+ return new Date;
}
);
$this->app->bind(
'navigation', function () {
- return new \FireflyIII\Shared\Toolkit\Navigation;
+ return new Navigation;
}
);
$this->app->bind(
'ffform', function () {
- return new \FireflyIII\Shared\Toolkit\Form;
+ return new Form;
}
);
@@ -70,8 +76,8 @@ class FF3ServiceProvider extends ServiceProvider
* For models, various stuff:
*/
$this->app->bind(
- 'steam', function() {
- return new \FireflyIII\Shared\Toolkit\Steam;
+ 'steam', function () {
+ return new Steam;
}
);
diff --git a/app/lib/FireflyIII/Form/Form.php b/app/lib/FireflyIII/Form/Form.php
index 756917e318..7388523742 100644
--- a/app/lib/FireflyIII/Form/Form.php
+++ b/app/lib/FireflyIII/Form/Form.php
@@ -276,6 +276,9 @@ class Form
*
* @param $type
* @param $name
+ *
+ * @return string
+ * @throws FireflyException
*/
public static function ffOptionsList($type, $name)
{
diff --git a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php
index f18851e342..ce330b1d42 100644
--- a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php
+++ b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php
@@ -83,6 +83,7 @@ class Reminders
if (!is_null($piggybank->reminder)) {
return $piggybank;
}
+ return null;
}
);
$today = Carbon::now();
diff --git a/app/routes.php b/app/routes.php
index 3d1ed6653d..cb18fcd3cf 100644
--- a/app/routes.php
+++ b/app/routes.php
@@ -2,7 +2,8 @@
// models:
Route::bind(
- 'account', function ($value, $route) {
+ 'account',
+ function ($value, $route) {
if (Auth::check()) {
$account = Account::
leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')->where('account_types.editable', 1)->where('accounts.id', $value)
diff --git a/app/views/budgets/index.blade.php b/app/views/budgets/index.blade.php
index 7963e5bedf..dbcdb2ff41 100644
--- a/app/views/budgets/index.blade.php
+++ b/app/views/budgets/index.blade.php
@@ -21,9 +21,9 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="progress progress-striped">
- <div class="progress-bar progress-bar-info" id="progress-bar-default" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
- <div class="progress-bar progress-bar-danger" id="progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
- <div class="progress-bar progress-bar-warning" id="progress-bar-warning" role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
+ <div class="progress-bar progress-bar-info" id="progress-bar-default" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0;"></div>
+ <div class="progress-bar progress-bar-danger" id="progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0;"></div>
+ <div class="progress-bar progress-bar-warning" id="progress-bar-warning" role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" style="width: 0;"></div>
</div>
</div>
</div>
diff --git a/codeception.yml b/codeception.yml
index 4acd5b63a3..aeffebe66c 100644
--- a/codeception.yml
+++ b/codeception.yml
@@ -19,13 +19,11 @@ modules:
populate: false
coverage:
enabled: true
-whitelist:
- include:
- - app/*
- exclude:
- - app/storage/*
- blacklist:
+ remote: true
+ whitelist:
include:
- app/controllers/*
+ - app/models/*
+ - app/lib/FireflyIII/*
exclude:
- app/controllers/BaseController.php
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 9bdec79c90..acd8fe328a 100644
--- a/composer.json
+++ b/composer.json
@@ -34,7 +34,8 @@
"satooshi/php-coveralls": "dev-master",
"mockery/mockery": "@stable",
"league/factory-muffin": "~2.0",
- "codeception/codeception": "*"
+ "codeception/codeception": "*",
+ "codeception/c3": "2.*"
},
"autoload": {
@@ -53,11 +54,13 @@
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
- "php artisan optimize"
+ "php artisan optimize",
+ "Codeception\\c3\\Installer::copyC3ToRoot"
],
"post-update-cmd": [
"php artisan clear-compiled",
- "php artisan optimize"
+ "php artisan optimize",
+ "Codeception\\c3\\Installer::copyC3ToRoot"
],
"post-create-project-cmd": [
"php artisan key:generate"
diff --git a/public/index.php b/public/index.php
index 50f994dcdc..fd92e0e2e7 100644
--- a/public/index.php
+++ b/public/index.php
@@ -6,6 +6,15 @@
* @author Taylor Otwell <[email protected]>
*/
+
+/**
+ * Adding c3.php for code coverage during codeception tests
+ * ref: https://github.com/Codeception/c3
+ */
+if (file_exists(__DIR__ . '/../c3.php')) {
+ require __DIR__ . '/../c3.php';
+}
+
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
@@ -18,8 +27,7 @@
|
*/
-require __DIR__.'/../bootstrap/autoload.php';
-
+require __DIR__ . '/../bootstrap/autoload.php';
/*
@@ -34,7 +42,7 @@ require __DIR__.'/../bootstrap/autoload.php';
|
*/
-$app = require_once __DIR__.'/../bootstrap/start.php';
+$app = require_once __DIR__ . '/../bootstrap/start.php';
/*
|--------------------------------------------------------------------------
diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml
index db30cd1d3a..86edef7270 100644
--- a/tests/functional.suite.yml
+++ b/tests/functional.suite.yml
@@ -8,5 +8,8 @@ class_name: FunctionalTester
modules:
enabled: [Db, Filesystem, FunctionalHelper, Laravel4]
config:
+ Db:
+ populate: false
+ cleanup: false
Laravel4:
environment: 'testing'
\ No newline at end of file
diff --git a/tests/functional/FunctionalTester.php b/tests/functional/FunctionalTester.php
index cfaccd7f1c..7e84a3ff8d 100644
--- a/tests/functional/FunctionalTester.php
+++ b/tests/functional/FunctionalTester.php
@@ -1,4 +1,4 @@
-<?php //[STAMP] 53e78415f2bf7c271c646ffe2b3f72b5
+<?php //[STAMP] 783e39b9effa232e3a9a3fc0349ec983
// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build
diff --git a/tests/functional/RegisterCept.php b/tests/functional/RegisterCept.php
index 9b6724b321..e7d150a947 100644
--- a/tests/functional/RegisterCept.php
+++ b/tests/functional/RegisterCept.php
@@ -4,4 +4,4 @@ $I->wantTo('register a new account');
$I->amOnPage('/register');
$I->submitForm('#register', ['email' => '[email protected]']);
$I->see('Password sent!');
-$I->seeInDatabase('users', ['email' => '[email protected]']);
\ No newline at end of file
+$I->seeRecord('users', ['email' => '[email protected]']);
\ No newline at end of file