Code cleanup.

This commit is contained in:
James Cole
2017-11-22 21:12:27 +01:00
parent 4e6b782204
commit 781ca052d8
142 changed files with 213 additions and 859 deletions

View File

@@ -70,11 +70,12 @@ class ReconcileController extends Controller
* @param Carbon $end
*
* @return \Illuminate\Http\JsonResponse
*
* @throws FireflyException
*/
public function overview(Request $request, Account $account, Carbon $start, Carbon $end)
{
if ($account->accountType->type !== AccountType::ASSET) {
if (AccountType::ASSET !== $account->accountType->type) {
throw new FireflyException(sprintf('Account %s is not an asset account.', $account->name));
}
$startBalance = $request->get('startBalance');
@@ -102,7 +103,7 @@ class ReconcileController extends Controller
foreach ($cleared as $transaction) {
if ($transaction->transactionJournal->date <= $end) {
$clearedAmount = bcadd($clearedAmount, $transaction->amount);
$countCleared++;
++$countCleared;
}
}
@@ -120,7 +121,7 @@ class ReconcileController extends Controller
'accounts.reconcile.overview',
compact(
'account', 'start', 'diffCompare', 'difference', 'end', 'clearedIds', 'transactionIds', 'clearedAmount', 'startBalance', 'endBalance', 'amount',
'route','countCleared'
'route', 'countCleared'
)
)->render();
@@ -212,7 +213,7 @@ class ReconcileController extends Controller
}
// create reconciliation transaction (if necessary):
if ($request->get('reconcile') === 'create') {
if ('create' === $request->get('reconcile')) {
/** @var AccountRepositoryInterface $accountRepos */
$accountRepos = app(AccountRepositoryInterface::class);
$reconciliation = $accountRepos->getReconciliation($account);
@@ -243,8 +244,6 @@ class ReconcileController extends Controller
Session::flash('success', trans('firefly.reconciliation_stored'));
return redirect(route('accounts.show', [$account->id]));
}
/**

View File

@@ -74,7 +74,7 @@ class LoginController extends Controller
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
@@ -92,7 +92,6 @@ class LoginController extends Controller
}
if ($this->attemptLogin($request)) {
// user is logged in. Save in session if the user requested session to be remembered:
$request->session()->put('remember_login', $request->filled('remember'));
@@ -110,7 +109,8 @@ class LoginController extends Controller
/**
* Log the user out of the application.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function logout(Request $request, CookieJar $cookieJar)
@@ -166,7 +166,6 @@ class LoginController extends Controller
$email = $request->old('email');
$remember = $request->old('remember');
return view('auth.login', compact('allowRegistration', 'email', 'remember'));//->withCookie($cookie);
return view('auth.login', compact('allowRegistration', 'email', 'remember')); //->withCookie($cookie);
}
}

View File

@@ -74,9 +74,9 @@ class TwoFactorController extends Controller
*/
public function lostTwoFactor()
{
$user = auth()->user();
$user = auth()->user();
$siteOwner = env('SITE_OWNER', '');
$title = strval(trans('firefly.two_factor_forgot_title'));
$title = strval(trans('firefly.two_factor_forgot_title'));
Log::info(
'To reset the two factor authentication for user #' . $user->id .
@@ -99,10 +99,8 @@ class TwoFactorController extends Controller
// wants to remember session?
$remember = $request->session()->get('remember_login') ?? false;
$minutes = config('session.lifetime');
if ($remember === true) {
$minutes = config('session.lifetime');
if (true === $remember) {
// set cookie with a long lifetime (30 days)
$minutes = 43200;
}

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Middleware;
use Closure;
use Cookie;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Log;

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Middleware;
use Closure;
use Cookie;
use Illuminate\Support\Facades\Auth;
use Preferences;

View File

@@ -88,7 +88,8 @@ class Amount implements ConverterInterface
Log::debug(sprintf('No decimal character found. Converted amount from "%s" to "%s".', $oldValue, $value));
}
$number = strval(number_format(round(floatval($value), 12), 12,'.',''));
$number = strval(number_format(round(floatval($value), 12), 12, '.', ''));
return $number;
}
}

View File

@@ -24,7 +24,6 @@ namespace FireflyIII\Import\Object;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Import\Converter\Amount;
use FireflyIII\Import\Converter\ConverterInterface;
use FireflyIII\Import\MapperPreProcess\PreProcessorInterface;
use FireflyIII\User;
@@ -131,7 +130,7 @@ class ImportJournal
$converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amountCredit['role'])));
$info = $this->amountCredit;
}
if (count($info) === 0) {
if (0 === count($info)) {
throw new FireflyException('No amount information for this row.');
}

View File

@@ -228,11 +228,12 @@ trait FindAccountsTrait
* @param Account $account
*
* @return Account|null
*
* @throws FireflyException
*/
public function getReconciliation(Account $account): ?Account
{
if ($account->accountType->type !== AccountType::ASSET) {
if (AccountType::ASSET !== $account->accountType->type) {
throw new FireflyException(sprintf('%s is not an asset account.', $account->name));
}
$name = $account->name . ' reconciliation';

View File

@@ -189,7 +189,7 @@ class JournalRepository implements JournalRepositoryInterface
->where('transaction_journals.user_id', $this->user->id)
->whereNull('transaction_journals.deleted_at')
->whereNull('transactions.deleted_at')
->get( ['transactions.*']);
->get(['transactions.*']);
return $set;
}

View File

@@ -35,15 +35,6 @@ use Illuminate\Support\MessageBag;
*/
interface JournalRepositoryInterface
{
/**
* @param array $transactionIds
*
* @return Collection
*/
public function getTransactionsById(array $transactionIds): Collection;
/**
* @param TransactionJournal $journal
* @param TransactionType $type
@@ -105,6 +96,13 @@ interface JournalRepositoryInterface
*/
public function getTransactionTypes(): Collection;
/**
* @param array $transactionIds
*
* @return Collection
*/
public function getTransactionsById(array $transactionIds): Collection;
/**
* @param TransactionJournal $journal
*

View File

@@ -258,7 +258,7 @@ class Roles implements ConfigurationInterface
if ('_ignore' !== $role) {
++$assigned;
}
if (in_array($role, ['amount','amount_credit','amount_debet'])) {
if (in_array($role, ['amount', 'amount_credit', 'amount_debet'])) {
$hasAmount = true;
}
}

View File

@@ -127,7 +127,6 @@ class Preferences
{
$fullName = sprintf('preference%s%s', $user->id, $name);
if (Cache::has($fullName)) {
return Cache::get($fullName);
}

View File

@@ -58,7 +58,7 @@ class Transaction extends Twig_Extension
$coloured = true;
// at this point amount is always negative.
if ($transaction->transaction_type_type === TransactionType::RECONCILIATION && bccomp(strval($transaction->transaction_amount),'0') === 1) {
if (TransactionType::RECONCILIATION === $transaction->transaction_type_type && 1 === bccomp(strval($transaction->transaction_amount), '0')) {
$amount = bcmul($amount, '-1');
}
@@ -290,7 +290,7 @@ class Transaction extends Twig_Extension
return $cache->get();
}
if($transaction->transaction_type_type === TransactionType::RECONCILIATION) {
if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) {
return '&mdash;';
}
@@ -476,7 +476,7 @@ class Transaction extends Twig_Extension
if ($cache->has()) {
return $cache->get();
}
if($transaction->transaction_type_type === TransactionType::RECONCILIATION) {
if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) {
return '&mdash;';
}

View File

@@ -148,21 +148,6 @@ class General extends Twig_Extension
);
}
/**
* @return Twig_SimpleFilter
*/
protected function markdown(): Twig_SimpleFilter
{
return new Twig_SimpleFilter(
'markdown',
function (string $text): string {
$converter = new CommonMarkConverter;
return $converter->convertToHtml($text);
},['is_safe' => ['html']]
);
}
/**
* @return Twig_SimpleFilter
*/
@@ -181,7 +166,6 @@ class General extends Twig_Extension
);
}
/**
* @return Twig_SimpleFunction
*/
@@ -244,6 +228,21 @@ class General extends Twig_Extension
);
}
/**
* @return Twig_SimpleFilter
*/
protected function markdown(): Twig_SimpleFilter
{
return new Twig_SimpleFilter(
'markdown',
function (string $text): string {
$converter = new CommonMarkConverter;
return $converter->convertToHtml($text);
}, ['is_safe' => ['html']]
);
}
/**
* @return Twig_SimpleFilter
*/

View File

@@ -280,13 +280,13 @@ return [
'converter' => 'Amount',
'field' => 'amount',
],
'amount_debet' => [
'amount_debet' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'AmountDebet',
'field' => 'amount_debet',
],
'amount_credit' => [
'amount_credit' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'AmountCredit',

View File

@@ -29,10 +29,10 @@ $factory->define(
static $password;
return [
'email' => $faker->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
'email' => $faker->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
}
);
@@ -40,13 +40,13 @@ $factory->define(
FireflyIII\Models\CurrencyExchangeRate::class,
function (Faker\Generator $faker) {
return [
'user_id' => 1,
'from_currency_id' => 1,
'to_currency_id' => 2,
'date' => '2017-01-01',
'rate' => '1.5',
'user_rate' => null,
];
'user_id' => 1,
'from_currency_id' => 1,
'to_currency_id' => 2,
'date' => '2017-01-01',
'rate' => '1.5',
'user_rate' => null,
];
}
);
@@ -54,10 +54,10 @@ $factory->define(
FireflyIII\Models\TransactionCurrency::class,
function (Faker\Generator $faker) {
return [
'name' => $faker->words(1, true),
'code' => 'ABC',
'symbol' => 'x',
];
'name' => $faker->words(1, true),
'code' => 'ABC',
'symbol' => 'x',
];
}
);
@@ -65,44 +65,43 @@ $factory->define(
FireflyIII\Models\ImportJob::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 100),
'user_id' => 1,
'key' => $faker->words(1, true),
'file_type' => 'csv',
'status' => 'import_status_never_started',
'configuration' => null,
'extended_status' => [
'total_steps' => 0,
'steps_done' => 0,
'import_count' => 0,
'importTag' => 0,
'errors' => [],
],
];
'id' => $faker->numberBetween(1, 100),
'user_id' => 1,
'key' => $faker->words(1, true),
'file_type' => 'csv',
'status' => 'import_status_never_started',
'configuration' => null,
'extended_status' => [
'total_steps' => 0,
'steps_done' => 0,
'import_count' => 0,
'importTag' => 0,
'errors' => [],
],
];
}
);
$factory->define(
FireflyIII\Models\TransactionJournal::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(1000, 10000),
'user_id' => 1,
'transaction_type_id' => 1,
'bill_id' => null,
// TODO update this transaction currency reference.
'transaction_currency_id' => 1,
'description' => $faker->words(3, true),
'date' => '2017-01-01',
'interest_date' => null,
'book_date' => null,
'process_date' => null,
'order' => 0,
'tag_count' => 0,
'encrypted' => 0,
'completed' => 1,
];
'id' => $faker->unique()->numberBetween(1000, 10000),
'user_id' => 1,
'transaction_type_id' => 1,
'bill_id' => null,
// TODO update this transaction currency reference.
'transaction_currency_id' => 1,
'description' => $faker->words(3, true),
'date' => '2017-01-01',
'interest_date' => null,
'book_date' => null,
'process_date' => null,
'order' => 0,
'tag_count' => 0,
'encrypted' => 0,
'completed' => 1,
];
}
);
@@ -110,19 +109,19 @@ $factory->define(
FireflyIII\Models\Bill::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'user_id' => 1,
'name' => $faker->words(3, true),
'match' => $faker->words(3, true),
'amount_min' => '100.00',
'amount_max' => '100.00',
'date' => '2017-01-01',
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 1,
'name_encrypted' => 0,
'match_encrypted' => 0,
];
'id' => $faker->numberBetween(1, 10),
'user_id' => 1,
'name' => $faker->words(3, true),
'match' => $faker->words(3, true),
'amount_min' => '100.00',
'amount_max' => '100.00',
'date' => '2017-01-01',
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 1,
'name_encrypted' => 0,
'match_encrypted' => 0,
];
}
);
@@ -130,12 +129,12 @@ $factory->define(
FireflyIII\Models\PiggyBankRepetition::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(100, 10000),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'startdate' => '2017-01-01',
'targetdate' => '2020-01-01',
'currentamount' => 10,
];
'id' => $faker->unique()->numberBetween(100, 10000),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'startdate' => '2017-01-01',
'targetdate' => '2020-01-01',
'currentamount' => 10,
];
}
);
@@ -143,15 +142,15 @@ $factory->define(
FireflyIII\Models\PiggyBank::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(100, 10000),
'account_id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
'target_amount' => '1000.00',
'startdate' => '2017-01-01',
'order' => 1,
'active' => 1,
'encrypted' => 0,
];
'id' => $faker->unique()->numberBetween(100, 10000),
'account_id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
'target_amount' => '1000.00',
'startdate' => '2017-01-01',
'order' => 1,
'active' => 1,
'encrypted' => 0,
];
}
);
@@ -159,11 +158,11 @@ $factory->define(
FireflyIII\Models\Tag::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(200, 10000),
'user_id' => 1,
'tagMode' => 'nothing',
'tag' => $faker->words(1, true),
];
'id' => $faker->unique()->numberBetween(200, 10000),
'user_id' => 1,
'tagMode' => 'nothing',
'tag' => $faker->words(1, true),
];
}
);
@@ -171,9 +170,9 @@ $factory->define(
FireflyIII\Models\Category::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
}
);
@@ -181,9 +180,9 @@ $factory->define(
FireflyIII\Models\Budget::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
}
);
@@ -191,12 +190,12 @@ $factory->define(
FireflyIII\Models\PiggyBankEvent::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'date' => $faker->date('Y-m-d'),
'amount' => '100',
];
'id' => $faker->numberBetween(1, 10),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'date' => $faker->date('Y-m-d'),
'amount' => '100',
];
}
);
@@ -204,13 +203,12 @@ $factory->define(
FireflyIII\Models\BudgetLimit::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'start_date' => '2017-01-01',
'end_date' => '2017-01-31',
'amount' => '300',
'budget_id' => $faker->numberBetween(1, 6),
];
'id' => $faker->numberBetween(1, 10),
'start_date' => '2017-01-01',
'end_date' => '2017-01-31',
'amount' => '300',
'budget_id' => $faker->numberBetween(1, 6),
];
}
);
@@ -218,11 +216,11 @@ $factory->define(
FireflyIII\Models\Account::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(1000, 10000),
'name' => $faker->words(3, true),
'account_type_id' => 1,
'active' => true,
];
'id' => $faker->unique()->numberBetween(1000, 10000),
'name' => $faker->words(3, true),
'account_type_id' => 1,
'active' => true,
];
}
);
@@ -230,31 +228,31 @@ $factory->define(
FireflyIII\Models\Transaction::class,
function (Faker\Generator $faker) {
return [
'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
'opposing_account_id' => $faker->numberBetween(1, 10),
'source_account_id' => $faker->numberBetween(1, 10),
'opposing_account_name' => $faker->words(3, true),
'description' => $faker->words(3, true),
'source_account_name' => $faker->words(3, true),
'destination_account_id' => $faker->numberBetween(1, 10),
'date' => new Carbon,
'destination_account_name' => $faker->words(3, true),
'amount' => strval($faker->randomFloat(2, -100, 100)),
'budget_id' => 0,
'category' => $faker->words(3, true),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'journal_id' => $faker->numberBetween(1, 10),
'transaction_currency_code' => 'EUR',
'transaction_type_type' => 'Withdrawal',
'account_encrypted' => 0,
'account_name' => 'Some name',
'transaction_currency_id' => 1,
'transaction_currency_symbol' => '€',
'foreign_destination_amount' => null,
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_currency_symbol' => null,
];
'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
'opposing_account_id' => $faker->numberBetween(1, 10),
'source_account_id' => $faker->numberBetween(1, 10),
'opposing_account_name' => $faker->words(3, true),
'description' => $faker->words(3, true),
'source_account_name' => $faker->words(3, true),
'destination_account_id' => $faker->numberBetween(1, 10),
'date' => new Carbon,
'destination_account_name' => $faker->words(3, true),
'amount' => strval($faker->randomFloat(2, -100, 100)),
'budget_id' => 0,
'category' => $faker->words(3, true),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'journal_id' => $faker->numberBetween(1, 10),
'transaction_currency_code' => 'EUR',
'transaction_type_type' => 'Withdrawal',
'account_encrypted' => 0,
'account_name' => 'Some name',
'transaction_currency_id' => 1,
'transaction_currency_symbol' => '€',
'foreign_destination_amount' => null,
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_currency_symbol' => null,
];
}
);

View File

@@ -20,7 +20,6 @@ class CreateSupportTables extends Migration
{
/**
* Reverse the migrations.
*
*/
public function down()
{
@@ -124,8 +123,7 @@ class CreateSupportTables extends Migration
Schema::create(
'jobs',
function (Blueprint $table) {
// straight from Laravel
// straight from Laravel
$table->bigIncrements('id');
$table->string('queue');
$table->longText('payload');

View File

@@ -60,7 +60,6 @@ class CreateMainTables extends Migration
*/
public function up()
{
//
$this->createAccountTables();
$this->createPiggyBanksTable();
$this->createAttachmentsTable();
@@ -433,7 +432,6 @@ class CreateMainTables extends Migration
$table->boolean('active')->default(1);
$table->boolean('stop_processing')->default(0);
// link rule id to rules table
$table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade');
}
@@ -454,7 +452,6 @@ class CreateMainTables extends Migration
$table->boolean('active')->default(1);
$table->boolean('stop_processing')->default(0);
// link rule id to rules table
$table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade');
}
@@ -583,7 +580,6 @@ class CreateMainTables extends Migration
);
}
if (!Schema::hasTable('piggy_bank_events')) {
Schema::create(
'piggy_bank_events',

View File

@@ -23,7 +23,6 @@ class ChangesFor3101 extends Migration
*/
public function down()
{
//
}
/**

View File

@@ -18,7 +18,6 @@ use Illuminate\Database\Schema\Blueprint;
*/
class FixNullables extends Migration
{
/**
* Reverse the migrations.
*/

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
@@ -24,7 +23,6 @@ class ExpandTransactionsTable extends Migration
*/
public function down()
{
//
}
/**

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
@@ -24,7 +23,6 @@ class ChangesForV420 extends Migration
*/
public function down()
{
//
}
/**

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -47,7 +45,6 @@ class ChangesForV430 extends Migration
$table->date('start_date');
$table->date('end_date');
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
}

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
@@ -21,8 +20,6 @@ class ChangesForV431 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -40,7 +37,6 @@ class ChangesForV431 extends Migration
}
);
// remove date field "end_date"
Schema::table(
'budget_limits',

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -22,8 +20,6 @@ class ChangesForV440 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -36,7 +32,6 @@ class ChangesForV440 extends Migration
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{
@@ -60,7 +55,7 @@ class ChangesForV440 extends Migration
}
);
}
//
Schema::table(
'transactions',
function (Blueprint $table) {

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -22,8 +20,6 @@ class ChangesForV450 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -33,7 +29,6 @@ class ChangesForV450 extends Migration
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -13,8 +13,6 @@ class ChangesForV470 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -26,7 +24,6 @@ class ChangesForV470 extends Migration
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{
@@ -42,7 +39,7 @@ class ChangesForV470 extends Migration
$table->string('inward');
$table->boolean('editable');
$table->unique(['name', 'outward','inward']);
$table->unique(['name', 'outward', 'inward']);
}
);
}
@@ -62,7 +59,7 @@ class ChangesForV470 extends Migration
$table->foreign('source_id')->references('id')->on('transaction_journals')->onDelete('cascade');
$table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade');
$table->unique(['link_type_id','source_id','destination_id']);
$table->unique(['link_type_id', 'source_id', 'destination_id']);
}
);
}

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -10,19 +10,15 @@ class ChangesForV470a extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
/**
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\AccountType;

View File

@@ -19,8 +19,6 @@ class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{

View File

@@ -7,10 +7,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\LinkType;
use Illuminate\Database\Seeder;

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\Role;
use Illuminate\Database\Seeder;

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\TransactionCurrency;
@@ -50,11 +49,5 @@ class TransactionCurrencySeeder extends Seeder
TransactionCurrency::create(['code' => 'XBT', 'name' => 'Bitcoin', 'symbol' => '₿', 'decimal_places' => 8]);
TransactionCurrency::create(['code' => 'BCH', 'name' => 'Bitcoin cash', 'symbol' => '₿C', 'decimal_places' => 8]);
TransactionCurrency::create(['code' => 'ETH', 'name' => 'Ethereum', 'symbol' => 'Ξ', 'decimal_places' => 12]);
}
}

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\TransactionType;

View File

@@ -21,8 +21,6 @@
var allCharts = {};
/*
Make some colours:
*/
@@ -61,8 +59,6 @@ Chart.defaults.global.responsive = true;
Chart.defaults.global.maintainAspectRatio = false;
/**
* Chart line thing
*/
@@ -92,12 +88,15 @@ const verticalLinePlugin = {
afterDatasetsDraw: function (chart, easing) {
if (chart.config.lineAtIndex) {
chart.config.lineAtIndex.forEach(pointIndex => this.renderVerticalLine(chart, pointIndex));
chart.config.lineAtIndex.forEach(pointIndex = > this.renderVerticalLine(chart, pointIndex)
)
;
}
}
};
Chart.plugins.register(verticalLinePlugin);
/**
*
* @param data
@@ -343,8 +342,8 @@ function drawAChart(URI, container, chartType, options, colorData, today) {
options: options,
lineAtIndex: []
};
if(today >= 0) {
chartOpts.lineAtIndex.push(today-1);
if (today >= 0) {
chartOpts.lineAtIndex.push(today - 1);
console.log('push opt');
}
allCharts[container] = new Chart(ctx, chartOpts);

View File

@@ -29,7 +29,7 @@ $(function () {
function drawChart() {
"use strict";
if(today >= 0) {
if (today >= 0) {
lineChartWithDay(accountFrontpageUri, 'accounts-chart', today);
} else {
lineChart(accountFrontpageUri, 'accounts-chart');

View File

@@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests;
use Illuminate\Contracts\Console\Kernel;

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -42,7 +41,6 @@ use Tests\TestCase;
/**
* Class AccountControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -79,7 +77,6 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])->andReturn(new Collection);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
$response = $this->get(route('accounts.delete', [$account->id]));
@@ -191,7 +188,6 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]));
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('accounts.show', [1]));
@@ -222,7 +218,6 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));
$tasker = $this->mock(AccountTaskerInterface::class);
$tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
$tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Admin;
use FireflyConfig;
use FireflyIII\Models\Configuration;
use Tests\TestCase;
@@ -31,14 +29,12 @@ use Tests\TestCase;
/**
* Class ConfigurationControllerTest
*
* @package Tests\Feature\Controllers\Admin
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ConfigurationControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::__construct
@@ -80,5 +76,4 @@ class ConfigurationControllerTest extends TestCase
$response->assertSessionHas('success');
$response->assertStatus(302);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Admin;
@@ -28,14 +27,12 @@ use Tests\TestCase;
/**
* Class HomeControllerTest
*
* @package Tests\Feature\Controllers\Admin
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class HomeControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Admin\HomeController::index
*/
@@ -47,5 +44,4 @@ class HomeControllerTest extends TestCase
// has bread crumb
$response->assertSee('<ol class="breadcrumb">');
}
}

View File

@@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Admin;
use FireflyIII\Repositories\User\UserRepositoryInterface;
@@ -31,7 +29,6 @@ use Tests\TestCase;
/**
* Class UserControllerTest
*
* @package Tests\Feature\Controllers\Admin
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -111,6 +108,4 @@ class UserControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
@@ -32,7 +30,6 @@ use Tests\TestCase;
/**
* Class AttachmentControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -103,7 +100,6 @@ class AttachmentControllerTest extends TestCase
$repository->shouldReceive('exists')->once()->andReturn(false);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('attachments.download', [1]));
$response->assertStatus(500);
@@ -159,6 +155,4 @@ class AttachmentControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,19 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Auth;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Tests\TestCase;
/**
* Class ForgotPasswordControllerTest
*
* @package Tests\Feature\Controllers\Auth
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Auth;
use FireflyIII\Models\Preference;
use PragmaRX\Google2FA\Contracts\Google2FA;
use Preferences;
@@ -32,7 +30,6 @@ use Tests\TestCase;
/**
* Class TwoFactorControllerTest
*
* @package Tests\Feature\Controllers\Auth
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -51,7 +48,6 @@ class TwoFactorControllerTest extends TestCase
$secretPreference = new Preference;
$secretPreference->data = 'BlablaSeecret';
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once();
@@ -130,5 +126,4 @@ class TwoFactorControllerTest extends TestCase
$response = $this->post(route('two-factor.post'), $data);
$response->assertStatus(302);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
use Carbon\Carbon;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Bill;
@@ -37,7 +35,6 @@ use Tests\TestCase;
/**
* Class BillControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -252,7 +249,5 @@ class BillControllerTest extends TestCase
$response = $this->post(route('bills.update', [1]), $data);
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -38,7 +37,6 @@ use Tests\TestCase;
/**
* Class BudgetControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -184,7 +182,6 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('collectBudgetInformation')->andReturn($budgetInfo);
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('budgets.index'));
@@ -231,7 +228,6 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
$repository->shouldReceive('collectBudgetInformation')->andReturn($budgetInfo);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('budgets.index', ['2017-01-01']));
@@ -278,7 +274,6 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
$repository->shouldReceive('collectBudgetInformation')->andReturn($budgetInfo);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('budgets.index', ['Hello-there']));
@@ -455,7 +450,6 @@ class BudgetControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\BudgetController::showByBudgetLimit
* @expectedExceptionMessage This budget limit is not part of
*
*/
public function testShowByBadBudgetLimit()
{
@@ -484,7 +478,6 @@ class BudgetControllerTest extends TestCase
$accountRepository = $this->mock(AccountRepositoryInterface::class);
$accountRepository->shouldReceive('getAccountsByType')->andReturn(new Collection);
// mock budget repository
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
$budgetRepository->shouldReceive('spentInPeriod')->andReturn('1');
@@ -500,7 +493,6 @@ class BudgetControllerTest extends TestCase
$collector->shouldReceive('withBudgetInformation')->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('budgets.show.limit', [1, 1]));
@@ -575,5 +567,4 @@ class BudgetControllerTest extends TestCase
$response = $this->get(route('budgets.income', ['2017-01-01', '2017-01-31']));
$response->assertStatus(200);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -40,7 +39,6 @@ use Tests\TestCase;
/**
* Class CategoryControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -89,7 +87,6 @@ class CategoryControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy')->andReturn(true);
$this->session(['categories.delete.uri' => 'http://localhost']);
@@ -360,7 +357,6 @@ class CategoryControllerTest extends TestCase
$repository->shouldReceive('spentInPeriod')->andReturn('-1');
$repository->shouldReceive('earnedInPeriod')->andReturn('1');
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('categories.show', [1, '2015-01-01']));
@@ -456,6 +452,4 @@ class CategoryControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -43,14 +41,12 @@ use Tests\TestCase;
/**
* Class AccountControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AccountControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::all
*/
@@ -85,7 +81,6 @@ class AccountControllerTest extends TestCase
$generator->shouldReceive('singleSet')->andReturn([]);
Steam::shouldReceive('balancesByAccounts')->twice()->andReturn([]);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.account.expense'));
@@ -114,7 +109,6 @@ class AccountControllerTest extends TestCase
$generator->shouldReceive('pieChart')->andReturn([]);
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.account.expense-budget', [1, '20120101', '20120131']));
@@ -145,7 +139,6 @@ class AccountControllerTest extends TestCase
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection);
$accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromTimestamp(time())->startOfMonth());
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.account.expense-budget-all', [1]));
@@ -374,5 +367,4 @@ class AccountControllerTest extends TestCase
$response = $this->get(route('chart.account.single', [1]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Transaction;
@@ -34,7 +32,6 @@ use Tests\TestCase;
/**
* Class BillControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -82,5 +79,4 @@ class BillControllerTest extends TestCase
$response = $this->get(route('chart.bill.single', [1]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -42,14 +40,12 @@ use Tests\TestCase;
/**
* Class BudgetControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class BudgetControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::__construct
@@ -66,7 +62,6 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
$generator->shouldReceive('singleSet')->andReturn([])->once();
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.budget.budget', [1]));
@@ -84,7 +79,6 @@ class BudgetControllerTest extends TestCase
$repository = $this->mock(BudgetRepositoryInterface::class);
$generator = $this->mock(GeneratorInterface::class);
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
$generator->shouldReceive('singleSet')->once()->andReturn([]);
@@ -214,7 +208,6 @@ class BudgetControllerTest extends TestCase
$budgetLimit->budget_id = $budget->id;
$transaction = factory(Transaction::class)->make();
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]))->once();
$repository->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection([$budgetLimit]));
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
@@ -254,7 +247,6 @@ class BudgetControllerTest extends TestCase
$two->budget_id = $budget->id;
$transaction = factory(Transaction::class)->make();
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]))->once();
$repository->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection([$one, $two]));
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
@@ -290,7 +282,6 @@ class BudgetControllerTest extends TestCase
$budget = factory(Budget::class)->make();
$transaction = factory(Transaction::class)->make();
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]));
$repository->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection);
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
@@ -325,7 +316,6 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
$generator->shouldReceive('multiSet')->once()->andReturn([]);
$this->be($this->user());
$response = $this->get(route('chart.budget.period', [1, '1', '20120101', '20120131']));
$response->assertStatus(200);

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
@@ -41,7 +39,6 @@ use Tests\TestCase;
/**
* Class BudgetReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -117,7 +114,6 @@ class BudgetReportControllerTest extends TestCase
$budgetRepos->shouldReceive('getAllBudgetLimits')->andReturn(new Collection([$one, $two]))->once();
$collector->shouldReceive('setAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL, TransactionType::TRANSFER]])->andReturnSelf();
@@ -134,5 +130,4 @@ class BudgetReportControllerTest extends TestCase
$response = $this->get(route('chart.budget.main', ['1', '1', '20120101', '20120131', 0]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Models\Account;
@@ -37,14 +35,12 @@ use Tests\TestCase;
/**
* Class CategoryControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CategoryControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::all
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::__construct
@@ -64,7 +60,6 @@ class CategoryControllerTest extends TestCase
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();
$generator->shouldReceive('multiSet')->once()->andReturn([]);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.category.all', [1]));
@@ -109,7 +104,6 @@ class CategoryControllerTest extends TestCase
$repository->shouldReceive('periodIncome')->andReturn([])->once();
$generator->shouldReceive('multiSet')->andReturn([])->once();
$this->be($this->user());
$response = $this->get(route('chart.category.period', [1, '1', '20120101', '20120131']));
$response->assertStatus(200);
@@ -156,5 +150,4 @@ class CategoryControllerTest extends TestCase
$response = $this->get(route('chart.category.specific', ['1', '2012-01-01']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -38,14 +36,12 @@ use Tests\TestCase;
/**
* Class CategoryReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CategoryReportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::accountExpense
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::__construct
@@ -160,5 +156,4 @@ class CategoryReportControllerTest extends TestCase
$response = $this->get(route('chart.category.main', ['1', '1', '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
@@ -33,7 +31,6 @@ use Tests\TestCase;
/**
* Class PiggyBankControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -57,6 +54,4 @@ class PiggyBankControllerTest extends TestCase
$response = $this->get(route('chart.piggy-bank.history', [1]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use Steam;
@@ -32,14 +30,12 @@ use Tests\TestCase;
/**
* Class ReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ReportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::netWorth
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::arraySum
@@ -96,5 +92,4 @@ class ReportControllerTest extends TestCase
$response = $this->get(route('chart.report.sum', [1, '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -40,7 +38,6 @@ use Tests\TestCase;
/**
* Class TagReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -88,7 +85,6 @@ class TagReportControllerTest extends TestCase
$this->be($this->user());
$response = $this->get(route('chart.tag.account-income', ['1', 'housing', '20120101', '20120131', 0]));
$response->assertStatus(200);
}
/**
@@ -144,16 +140,13 @@ class TagReportControllerTest extends TestCase
$generator = $this->mock(GeneratorInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$set = new Collection;
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 10; ++$i) {
$transaction = factory(Transaction::class)->make();
$tag = factory(Tag::class)->make();
$transaction->transactionJournal->tags()->save($tag);
$set->push($transaction);
}
$collector->shouldReceive('setAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL, TransactionType::TRANSFER]])->andReturnSelf();
@@ -213,6 +206,4 @@ class TagReportControllerTest extends TestCase
$response = $this->get(route('chart.tag.tag-income', ['1', 'housing', '20120101', '20120131', 0]));
$response->assertStatus(200);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -34,14 +33,12 @@ use Tests\TestCase;
/**
* Class CurrencyControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CurrencyControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\CurrencyController::create
*/
@@ -73,7 +70,6 @@ class CurrencyControllerTest extends TestCase
$repository->shouldReceive('canDeleteCurrency')->andReturn(false);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
$this->be($this->user());
$response = $this->get(route('currencies.delete', [2]));
$response->assertStatus(302);
@@ -95,7 +91,6 @@ class CurrencyControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
$this->session(['currencies.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('currencies.destroy', [1]));
@@ -174,7 +169,6 @@ class CurrencyControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true);
$this->session(['currencies.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('currencies.destroy', [1]));
@@ -328,5 +322,4 @@ class CurrencyControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -37,14 +36,12 @@ use Tests\TestCase;
/**
* Class ExportControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ExportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\ExportController::download
*/
@@ -134,7 +131,6 @@ class ExportControllerTest extends TestCase
['first' => new Carbon('2014-01-01')]
);
$data = [
'export_start_range' => '2015-01-01',
'export_end_range' => '2015-01-21',
@@ -167,5 +163,4 @@ class ExportControllerTest extends TestCase
$response->assertStatus(200);
$response->assertSee('ok');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -30,14 +29,12 @@ use Tests\TestCase;
/**
* Class HelpControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class HelpControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\HelpController::show
* @covers \FireflyIII\Http\Controllers\HelpController::getHelpText
@@ -65,7 +62,7 @@ class HelpControllerTest extends TestCase
{
// force pref in dutch for test
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'nl_NL',]);
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'nl_NL']);
$help = $this->mock(HelpInterface::class);
$help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once();
@@ -83,7 +80,7 @@ class HelpControllerTest extends TestCase
// put English back:
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'en_US',]);
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'en_US']);
}
/**
@@ -94,7 +91,7 @@ class HelpControllerTest extends TestCase
{
// force pref in dutch for test
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'nl_NL',]);
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'nl_NL']);
$help = $this->mock(HelpInterface::class);
$help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once();
@@ -112,7 +109,7 @@ class HelpControllerTest extends TestCase
// put English back:
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete();
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'en_US',]);
Preference::create(['user_id' => $this->user()->id, 'name' => 'language', 'data' => 'en_US']);
}
/**
@@ -146,5 +143,4 @@ class HelpControllerTest extends TestCase
$response->assertStatus(200);
$response->assertSee('There is no help for this route.');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -36,7 +35,6 @@ use Tests\TestCase;
/**
* Class HomeControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -53,7 +51,6 @@ class HomeControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$args = [
@@ -76,7 +73,6 @@ class HomeControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$args = [
@@ -191,5 +187,4 @@ class HomeControllerTest extends TestCase
$response->assertSessionHas('warning');
$response->assertSessionHas('error');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Import;
@@ -33,7 +32,6 @@ use Tests\TestCase;
/**
* Class FileControllerTest
*
* @package Tests\Feature\Controllers\Import
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -54,7 +52,6 @@ class FileControllerTest extends TestCase
$configurator->shouldReceive('getNextView')->once()->andReturn('import.csv.initial');
$configurator->shouldReceive('getNextData')->andReturn(['specifics' => [], 'delimiters' => [], 'accounts' => []])->once();
$this->be($this->user());
$response = $this->get(route('import.file.configure', ['configure']));
$response->assertStatus(200);
@@ -89,7 +86,6 @@ class FileControllerTest extends TestCase
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Import\FileController::initialize
*/
@@ -156,7 +152,6 @@ class FileControllerTest extends TestCase
$configurator->shouldReceive('configureJob')->once()->andReturn(false);
$configurator->shouldReceive('getWarningMessage')->once()->andReturn('');
$this->be($this->user());
$response = $this->post(route('import.file.process-configuration', ['running']));
$response->assertStatus(302);
@@ -172,7 +167,6 @@ class FileControllerTest extends TestCase
$configurator->shouldReceive('setJob')->once();
$configurator->shouldReceive('isJobConfigured')->once()->andReturn(true);
$this->be($this->user());
$response = $this->post(route('import.file.process-configuration', ['running']));
$response->assertStatus(302);
@@ -188,7 +182,6 @@ class FileControllerTest extends TestCase
$importer->shouldReceive('setJob')->once();
$importer->shouldReceive('run')->once()->andReturn(true);
$this->be($this->user());
$response = $this->post(route('import.file.start', ['running']));
$response->assertStatus(200);
@@ -204,7 +197,6 @@ class FileControllerTest extends TestCase
$importer->shouldReceive('setJob')->once();
$importer->shouldReceive('run')->once()->andReturn(false);
$this->be($this->user());
$response = $this->post(route('import.file.start', ['running']));
$response->assertStatus(500);
@@ -230,5 +222,4 @@ class FileControllerTest extends TestCase
$response->assertStatus(302);
$response->assertRedirect(route('import.file.configure', ['new']));
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -28,14 +27,12 @@ use Tests\TestCase;
/**
* Class ImportControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ImportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\ImportController::index
*/
@@ -46,6 +43,4 @@ class ImportControllerTest extends TestCase
$response->assertStatus(200);
$response->assertSee('<ol class="breadcrumb">');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -34,7 +33,6 @@ use Tests\TestCase;
/**
* Class JavascriptControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -83,12 +81,9 @@ class JavascriptControllerTest extends TestCase
*/
public function testVariables(string $range)
{
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('javascript.variables'));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Json;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
@@ -35,13 +33,9 @@ use Tests\TestCase;
/**
* Class AutoCompleteControllerTest
*
* @package Tests\Feature\Controllers\Json
*/
class AutoCompleteControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController::allAccounts
*/
@@ -131,5 +125,4 @@ class AutoCompleteControllerTest extends TestCase
$response->assertStatus(200);
$response->assertExactJson([]);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Json;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Tests\TestCase;
@@ -31,14 +29,12 @@ use Tests\TestCase;
/**
* Class ExchangeControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ExchangeControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Json\ExchangeController::getRate
*/

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -37,7 +36,6 @@ use Tests\TestCase;
/**
* Class JsonControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -93,7 +91,6 @@ class JsonControllerTest extends TestCase
$response->assertExactJson([$category->name]);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::tags
*/
@@ -141,5 +138,4 @@ class JsonControllerTest extends TestCase
$response = $this->get(route('json.trigger'));
$response->assertStatus(200);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -31,14 +30,12 @@ use Tests\TestCase;
/**
* Class NewUserControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class NewUserControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\NewUserController::index
* @covers \FireflyIII\Http\Controllers\NewUserController::__construct
@@ -69,7 +66,6 @@ class NewUserControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('count')->andReturn(1);
$this->be($this->user());
$response = $this->get(route('new-user.index'));
$response->assertStatus(302);
@@ -89,7 +85,6 @@ class NewUserControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('store')->times(2);
$data = [
'bank_name' => 'New bank',
'savings_balance' => '1000',
@@ -121,5 +116,4 @@ class NewUserControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -37,14 +36,12 @@ use Tests\TestCase;
/**
* Class PiggyBankControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class PiggyBankControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::add
*/
@@ -139,7 +136,6 @@ class PiggyBankControllerTest extends TestCase
$repository->shouldReceive('destroy')->andReturn(true);
$this->session(['piggy-banks.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('piggy-banks.destroy', [2]));
@@ -240,7 +236,6 @@ class PiggyBankControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('canAddAmount')->once()->andReturn(false);
$data = ['amount' => '1000'];
$this->be($this->user());
$response = $this->post(route('piggy-banks.add', [1]), $data);
@@ -297,7 +292,6 @@ class PiggyBankControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('piggy-banks.remove', [1]));
$response->assertStatus(200);
@@ -352,7 +346,6 @@ class PiggyBankControllerTest extends TestCase
'targetamount' => '100.123',
'account_id' => 2,
'amount_currency_id_targetamount' => 1,
];
$this->be($this->user());
$response = $this->post(route('piggy-banks.store'), $data);
@@ -378,7 +371,6 @@ class PiggyBankControllerTest extends TestCase
'targetamount' => '100.123',
'account_id' => 2,
'amount_currency_id_targetamount' => 1,
];
$this->be($this->user());
$response = $this->post(route('piggy-banks.update', [3]), $data);
@@ -386,6 +378,4 @@ class PiggyBankControllerTest extends TestCase
$response->assertSessionHas('success');
$response->assertRedirect(route('index'));
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Popup;
use Carbon\Carbon;
use FireflyIII\Helpers\Report\PopupReportInterface;
use FireflyIII\Models\Account;
@@ -35,18 +33,15 @@ use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Illuminate\Support\Collection;
use Tests\TestCase;
/**
* Class ReportControllerTest
*
* @package Tests\Feature\Controllers\Popup
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ReportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::__construct
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
@@ -176,7 +171,6 @@ class ReportControllerTest extends TestCase
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
$budget = factory(Budget::class)->make();
$account = factory(Account::class)->make();
@@ -232,7 +226,6 @@ class ReportControllerTest extends TestCase
],
];
$uri = route('popup.general') . '?' . http_build_query($arguments);
$response = $this->get($uri);
$response->assertStatus(500);
@@ -385,6 +378,4 @@ class ReportControllerTest extends TestCase
$response = $this->get($uri);
$response->assertStatus(500);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -36,14 +35,12 @@ use Tests\TestCase;
/**
* Class PreferencesControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class PreferencesControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\PreferencesController::code
* @covers \FireflyIII\Http\Controllers\PreferencesController::getDomain
@@ -231,5 +228,4 @@ class PreferencesControllerTest extends TestCase
// go to code to get a secret.
$response->assertRedirect(route('preferences.code'));
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -31,14 +30,12 @@ use Tests\TestCase;
/**
* Class ProfileControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ProfileControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\ProfileController::changePassword
*/
@@ -190,5 +187,4 @@ class ProfileControllerTest extends TestCase
$response->assertRedirect(route('profile.delete-account'));
$response->assertSessionHas('error');
}
}

View File

@@ -18,19 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Report;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use Tests\TestCase;
/**
* Class AccountControllerTest
*
* @package Tests\Feature\Controllers\Report
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -52,10 +49,8 @@ class AccountControllerTest extends TestCase
$tasker = $this->mock(AccountTaskerInterface::class);
$tasker->shouldReceive('getAccountReport')->andReturn($return);
$this->be($this->user());
$response = $this->get(route('report-data.account.general', ['1', '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Report;
use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Report\BalanceReportHelperInterface;
use Tests\TestCase;
@@ -31,7 +29,6 @@ use Tests\TestCase;
/**
* Class BalanceControllerTest
*
* @package Tests\Feature\Controllers\Report
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -50,5 +47,4 @@ class BalanceControllerTest extends TestCase
$response = $this->get(route('report-data.balance.general', ['1', '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Report;
use FireflyIII\Helpers\Report\BudgetReportHelperInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Illuminate\Support\Collection;
@@ -32,7 +30,6 @@ use Tests\TestCase;
/**
* Class BudgetControllerTest
*
* @package Tests\Feature\Controllers\Report
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -70,5 +67,4 @@ class BudgetControllerTest extends TestCase
$response = $this->get(route('report-data.budget.period', ['1', '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Report;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Illuminate\Support\Collection;
@@ -32,7 +30,6 @@ use Tests\TestCase;
/**
* Class CategoryControllerTest
*
* @package Tests\Feature\Controllers\Report
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -89,5 +86,4 @@ class CategoryControllerTest extends TestCase
$response = $this->get(route('report-data.category.operations', ['1', '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Report;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Models\Transaction;
@@ -33,7 +31,6 @@ use Tests\TestCase;
/**
* Class OperationsControllerTest
*
* @package Tests\Feature\Controllers\Report
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -55,7 +52,6 @@ class OperationsControllerTest extends TestCase
$collector->shouldReceive('addFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
$collector->shouldReceive('getJournals')->andReturn($transactions);
$this->be($this->user());
$response = $this->get(route('report-data.operations.expenses', ['1', '20160101', '20160131']));
$response->assertStatus(200);
@@ -101,5 +97,4 @@ class OperationsControllerTest extends TestCase
$response = $this->get(route('report-data.operations.operations', ['1', '20160101', '20160131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
use FireflyIII\Generator\Report\Audit\YearReportGenerator as AYRG;
use FireflyIII\Generator\Report\Budget\YearReportGenerator as BYRG;
use FireflyIII\Generator\Report\Category\YearReportGenerator as CYRG;
@@ -46,14 +44,12 @@ use Tests\TestCase;
/**
* Class ReportControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ReportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\ReportController::auditReport
*/
@@ -68,7 +64,6 @@ class ReportControllerTest extends TestCase
$generator->shouldReceive('setAccounts')->once();
$generator->shouldReceive('generate')->andReturn('here-be-report')->once();
$this->be($this->user());
$response = $this->get(route('reports.report.audit', [1, '20160101', '20160131']));
$response->assertStatus(200);
@@ -189,7 +184,6 @@ class ReportControllerTest extends TestCase
$budget = factory(Budget::class)->make();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget]));
$this->be($this->user());
$response = $this->get(route('reports.options', ['budget']));
$response->assertStatus(200);
@@ -458,5 +452,4 @@ class ReportControllerTest extends TestCase
$response = $this->get(route('reports.report.tag', [1, 'TagJanuary', '20160101', '20160131']));
$response->assertStatus(200);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -37,14 +36,12 @@ use Tests\TestCase;
/**
* Class RuleControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class RuleControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\RuleController::create
*/
@@ -77,7 +74,6 @@ class RuleControllerTest extends TestCase
];
$this->session(['_old_input' => $old]);
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -223,7 +219,7 @@ class RuleControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$data = ['actions' => [1, 2, 3],];
$data = ['actions' => [1, 2, 3]];
$repository->shouldReceive('reorderRuleActions')->once();
$this->be($this->user());
@@ -241,7 +237,7 @@ class RuleControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$data = ['triggers' => [1, 2, 3],];
$data = ['triggers' => [1, 2, 3]];
$repository->shouldReceive('reorderRuleTriggers')->once();
$this->be($this->user());
@@ -289,7 +285,6 @@ class RuleControllerTest extends TestCase
}
/**
*
* @covers \FireflyIII\Http\Controllers\RuleController::testTriggers
* @covers \FireflyIII\Http\Controllers\RuleController::getValidTriggerList
*/
@@ -419,5 +414,4 @@ class RuleControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -36,14 +35,12 @@ use Tests\TestCase;
/**
* Class RuleGroupControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class RuleGroupControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\RuleGroupController::create
* @covers \FireflyIII\Http\Controllers\RuleGroupController::__construct
@@ -122,7 +119,6 @@ class RuleGroupControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('rule-groups.edit', [1]));
$response->assertStatus(200);
@@ -191,7 +187,6 @@ class RuleGroupControllerTest extends TestCase
'description' => 'No description',
];
$this->be($this->user());
$response = $this->post(route('rule-groups.store', [1]), $data);
$response->assertStatus(302);
@@ -239,5 +234,4 @@ class RuleGroupControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -29,14 +28,12 @@ use Tests\TestCase;
/**
* Class SearchControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class SearchControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\SearchController::index
* @covers \FireflyIII\Http\Controllers\SearchController::__construct
@@ -51,5 +48,4 @@ class SearchControllerTest extends TestCase
$response->assertStatus(200);
$response->assertSee('<ol class="breadcrumb">');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -33,18 +32,15 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Pagination\LengthAwarePaginator;
use Tests\TestCase;
/**
* Class TagControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class TagControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\TagController::create
*/
@@ -161,7 +157,6 @@ class TagControllerTest extends TestCase
$collector->shouldReceive('setRange')->andReturnSelf()->once();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
$this->be($this->user());
$response = $this->get(route('tags.show', [1]));
$response->assertStatus(200);
@@ -198,7 +193,6 @@ class TagControllerTest extends TestCase
];
$repository->shouldReceive('sumsOfTag')->andReturn($amounts)->once();
$this->be($this->user());
$response = $this->get(route('tags.show', [1, 'all']));
$response->assertStatus(200);
@@ -238,7 +232,6 @@ class TagControllerTest extends TestCase
];
$repository->shouldReceive('sumsOfTag')->andReturn($amounts)->once();
$this->be($this->user());
$response = $this->get(route('tags.show', [1, '2016-01-01']));
$response->assertStatus(200);
@@ -278,7 +271,6 @@ class TagControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->session(['tags.edit.uri' => 'http://localhost']);
$data = [
'tag' => 'Hello updated tag' . rand(999, 10000),
@@ -293,5 +285,4 @@ class TagControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionHas('success');
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Transaction;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
@@ -37,7 +35,6 @@ use Tests\TestCase;
/**
* Class ConvertControllerTest
*
* @package Tests\Feature\Controllers\Transaction
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -217,7 +214,7 @@ class ConvertControllerTest extends TestCase
$accountRepos->shouldReceive('store')->andReturn(new Account);
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$data = ['destination_account_expense' => 'New expense name.',];
$data = ['destination_account_expense' => 'New expense name.'];
$this->be($this->user());
$response = $this->post(route('transactions.convert.index', ['withdrawal', $deposit->id]), $data);
$response->assertStatus(302);
@@ -240,7 +237,7 @@ class ConvertControllerTest extends TestCase
$accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$data = ['destination_account_expense' => '',];
$data = ['destination_account_expense' => ''];
$this->be($this->user());
$response = $this->post(route('transactions.convert.index', ['withdrawal', $deposit->id]), $data);
$response->assertStatus(302);
@@ -261,7 +258,6 @@ class ConvertControllerTest extends TestCase
$repository->shouldReceive('convert')->andReturn($messageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = [
'destination_account_asset' => 2,
@@ -360,7 +356,7 @@ class ConvertControllerTest extends TestCase
$accountRepos->shouldReceive('store')->andReturn(new Account)->once();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = ['source_account_revenue' => 'New revenue name.',];
$data = ['source_account_revenue' => 'New revenue name.'];
$this->be($this->user());
$response = $this->post(route('transactions.convert.index', ['deposit', $withdrawal->id]), $data);
$response->assertStatus(302);
@@ -383,7 +379,7 @@ class ConvertControllerTest extends TestCase
$accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = ['source_account_revenue' => '',];
$data = ['source_account_revenue' => ''];
$this->be($this->user());
$response = $this->post(route('transactions.convert.index', ['deposit', $withdrawal->id]), $data);
$response->assertStatus(302);
@@ -414,6 +410,4 @@ class ConvertControllerTest extends TestCase
$response->assertStatus(302);
$response->assertRedirect(route('transactions.show', [$withdrawal->id]));
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Transaction;
use DB;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
@@ -36,7 +34,6 @@ use Tests\TestCase;
/**
* Class MassControllerTest
*
* @package Tests\Feature\Controllers\Transaction
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -193,7 +190,6 @@ class MassControllerTest extends TestCase
$repository->shouldReceive('update')->once();
$repository->shouldReceive('find')->once()->andReturn($deposit);
$this->session(['transactions.mass-edit.uri' => 'http://localhost']);
$data = [

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Transaction;
use DB;
use FireflyIII\Events\StoredTransactionJournal;
use FireflyIII\Events\UpdatedTransactionJournal;
@@ -45,14 +43,12 @@ use Tests\TestCase;
/**
* Class SingleControllerTest
*
* @package Tests\Feature\Controllers\Transaction
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class SingleControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::cloneTransaction
*/
@@ -78,7 +74,6 @@ class SingleControllerTest extends TestCase
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$piggyRepos->shouldReceive('getPiggyBanksWithAmount')->andReturn(new Collection)->once();
$this->be($this->user());
$response = $this->get(route('transactions.create', ['withdrawal']));
$response->assertStatus(200);
@@ -206,7 +201,6 @@ class SingleControllerTest extends TestCase
$response->assertStatus(302);
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
@@ -317,14 +311,12 @@ class SingleControllerTest extends TestCase
$messages = new MessageBag;
$messages->add('attachments', 'Fake error');
// mock attachment helper, trigger an error AND and info thing.
$attachmentRepo = $this->mock(AttachmentHelperInterface::class);
$attachmentRepo->shouldReceive('saveAttachmentsForModel');
$attachmentRepo->shouldReceive('getErrors')->andReturn($errors);
$attachmentRepo->shouldReceive('getMessages')->andReturn($messages);
$this->session(['transactions.create.uri' => 'http://localhost']);
$this->be($this->user());
@@ -360,7 +352,6 @@ class SingleControllerTest extends TestCase
$journal->description = 'New journal';
$journal->transactionType()->associate($type);
$repository->shouldReceive('update')->andReturn($journal);
$repository->shouldReceive('first')->times(2)->andReturn(new TransactionJournal);
@@ -389,7 +380,5 @@ class SingleControllerTest extends TestCase
$response->assertSee('Updated groceries');
// has bread crumb
$response->assertSee('<ol class="breadcrumb">');
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Transaction;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
@@ -40,7 +38,6 @@ use Tests\TestCase;
/**
* Class SplitControllerTest
*
* @package Tests\Feature\Controllers\Transaction
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -55,7 +52,6 @@ class SplitControllerTest extends TestCase
*/
public function testEdit()
{
$currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
$accountRepository = $this->mock(AccountRepositoryInterface::class);
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
@@ -71,7 +67,6 @@ class SplitControllerTest extends TestCase
$budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
$tasker->shouldReceive('getTransactionsOverview')->andReturn($transactions->toArray());
$this->be($this->user());
$response = $this->get(route('transactions.split.edit', [$deposit->id]));
$response->assertStatus(200);
@@ -98,7 +93,6 @@ class SplitControllerTest extends TestCase
*/
public function testEditSingle()
{
$currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
$accountRepository = $this->mock(AccountRepositoryInterface::class);
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
@@ -114,7 +108,6 @@ class SplitControllerTest extends TestCase
$budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
$tasker->shouldReceive('getTransactionsOverview')->andReturn($transactions->toArray());
$this->be($this->user());
$response = $this->get(route('transactions.split.edit', [$deposit->id]));
$response->assertStatus(200);
@@ -158,7 +151,6 @@ class SplitControllerTest extends TestCase
$repository->shouldReceive('updateSplitJournal')->andReturn($deposit);
$repository->shouldReceive('first')->times(2)->andReturn(new TransactionJournal);
$attachmentRepos = $this->mock(AttachmentHelperInterface::class);
$attachmentRepos->shouldReceive('saveAttachmentsForModel');
$attachmentRepos->shouldReceive('getMessages')->andReturn(new MessageBag);
@@ -191,5 +183,4 @@ class SplitControllerTest extends TestCase
$response->assertStatus(302);
$response->assertSessionMissing('success');
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -36,15 +35,12 @@ use Tests\TestCase;
/**
* Class TransactionControllerTest
*
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class TransactionControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\TransactionController::index
* @covers \FireflyIII\Http\Controllers\TransactionController::__construct
@@ -254,5 +250,4 @@ class TransactionControllerTest extends TestCase
$response = $this->get(route('transactions.show', [$journal->id]));
$response->assertStatus(302);
}
}

View File

@@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature;
use Tests\TestCase;
@@ -30,8 +28,6 @@ class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{

View File

@@ -19,7 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests;
@@ -34,7 +33,6 @@ use Mockery;
/**
* Class TestCase
*
* @package Tests
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
abstract class TestCase extends BaseTestCase
@@ -58,9 +56,8 @@ abstract class TestCase extends BaseTestCase
]
);
// set period to match?
}
if ($range === 'custom') {
if ('custom' === $range) {
$this->session(
[
'start' => Carbon::now()->subDays(20),
@@ -119,5 +116,4 @@ abstract class TestCase extends BaseTestCase
return $object;
}
}

View File

@@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit;
use Tests\TestCase;
@@ -30,8 +28,6 @@ class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Handlers\Events;
use FireflyIII\Events\RegisteredUser;
use FireflyIII\Events\RequestedNewPassword;
use FireflyIII\Handlers\Events\UserEventHandler;
@@ -36,7 +34,6 @@ use Tests\TestCase;
/**
* Class UserEventHandlerTest
*
* @package Tests\Unit\Handlers\Events
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -76,7 +73,7 @@ class UserEventHandlerTest extends TestCase
Mail::assertSent(
RequestedNewPasswordMail::class, function ($mail) use ($user) {
return $mail->hasTo($user->email) && $mail->ipAddress === '127.0.0.1';
return $mail->hasTo($user->email) && '127.0.0.1' === $mail->ipAddress;
}
);
@@ -99,11 +96,10 @@ class UserEventHandlerTest extends TestCase
// must send user an email:
Mail::assertSent(
RegisteredUserMail::class, function ($mail) use ($user) {
return $mail->hasTo($user->email) && $mail->ipAddress === '127.0.0.1';
return $mail->hasTo($user->email) && '127.0.0.1' === $mail->ipAddress;
}
);
$this->assertTrue(true);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Helpers;
use FireflyIII\Helpers\Attachments\AttachmentHelper;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\TransactionJournal;
@@ -34,7 +32,6 @@ use Tests\TestCase;
/**
* Class AttachmentHelperTest
*
* @package Tests\Unit\Helpers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -63,7 +60,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::hasFile
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
*
*/
public function testInvalidMime()
{
@@ -93,7 +89,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments
*
*/
public function testSave()
{
@@ -129,7 +124,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments
*
*/
public function testSaveSecond()
{
@@ -146,6 +140,4 @@ class AttachmentHelperTest extends TestCase
$this->assertCount(0, $messages);
$this->assertEquals('Uploaded file "apple-touch-icon.png" is already attached to this object.', $errors->first());
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Helpers;
use Carbon\Carbon;
use FireflyIII\Helpers\Chart\MetaPieChart;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -40,7 +38,6 @@ use Tests\TestCase;
/**
* Class MetaPieChartTest
*
* @package Tests\Unit\Helpers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -87,7 +84,6 @@ class MetaPieChartTest extends TestCase
$accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]);
$accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]);
$helper = new MetaPieChart();
$helper->setUser($this->user());
$helper->setStart($som);
@@ -98,12 +94,10 @@ class MetaPieChartTest extends TestCase
$keys = array_keys($chart);
$this->assertEquals($keys[0], $accounts[1]->name);
$this->assertEquals($keys[1], $accounts[2]->name);
$this->assertTrue(bccomp('1000', $chart[$accounts[1]->name]) === 0);
$this->assertTrue(bccomp('1000', $chart[$accounts[2]->name]) === 0);
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[1]->name]));
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[2]->name]));
$this->assertTrue(true);
}
/**
@@ -149,7 +143,6 @@ class MetaPieChartTest extends TestCase
$accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]);
$accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]);
$helper = new MetaPieChart();
$helper->setCollectOtherObjects(true);
$helper->setUser($this->user());
@@ -161,20 +154,18 @@ class MetaPieChartTest extends TestCase
$keys = array_keys($chart);
$this->assertEquals($keys[0], $accounts[1]->name);
$this->assertEquals($keys[1], $accounts[2]->name);
$this->assertTrue(bccomp('1000', $chart[$accounts[1]->name]) === 0);
$this->assertTrue(bccomp('1000', $chart[$accounts[2]->name]) === 0);
$this->assertTrue(bccomp('1000', $chart['Everything else']) === 0);
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[1]->name]));
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[2]->name]));
$this->assertTrue(0 === bccomp('1000', $chart['Everything else']));
$this->assertTrue(true);
}
private function fakeOthers(): Collection
{
$set = new Collection;
for ($i = 0; $i < 30; $i++) {
for ($i = 0; $i < 30; ++$i) {
$transaction = new Transaction;
// basic fields.
@@ -193,7 +184,7 @@ class MetaPieChartTest extends TestCase
private function fakeTransactions(): Collection
{
$set = new Collection;
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 10; ++$i) {
$transaction = new Transaction;
// basic fields.
@@ -206,7 +197,7 @@ class MetaPieChartTest extends TestCase
$set->push($transaction);
}
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 10; ++$i) {
$transaction = new Transaction;
// basic fields.
@@ -221,5 +212,4 @@ class MetaPieChartTest extends TestCase
return $set;
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Import\Converter;
@@ -28,8 +27,6 @@ use Tests\TestCase;
/**
* Class AmountTest
*
* @package Tests\Unit\Import\Converter
*/
class AmountTest extends TestCase
{
@@ -83,12 +80,11 @@ class AmountTest extends TestCase
'1.234' => '1234',
'1.234,5' => '1234.5',
'1.234,56' => '1234.56',
];
foreach ($values as $value => $expected) {
$converter = new Amount;
$result = $converter->convert($value);
$this->assertEquals($expected, $result,sprintf('The original value was %s', $value));
$this->assertEquals($expected, $result, sprintf('The original value was %s', $value));
}
}
@@ -101,6 +97,4 @@ class AmountTest extends TestCase
$result = $converter->convert(null);
$this->assertEquals('0', $result);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
@@ -46,7 +44,6 @@ class AddTagTest extends TestCase
$result = $action->act($journal);
$this->assertFalse($result);
$this->assertDatabaseHas('tag_transaction_journal', ['tag_id' => 2, 'transaction_journal_id' => 1]);
}
/**
@@ -64,7 +61,5 @@ class AddTagTest extends TestCase
// find newly created tag:
$tag = Tag::orderBy('id', 'DESC')->first();
$this->assertDatabaseHas('tag_transaction_journal', ['tag_id' => $tag->id, 'transaction_journal_id' => 1]);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\AppendDescription;
@@ -48,7 +46,5 @@ class AppendDescriptionTest extends TestCase
$journal = TransactionJournal::find(1);
$this->assertEquals($oldDescription . 'APPEND', $journal->description);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\Note;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
@@ -32,8 +30,6 @@ use Tests\TestCase;
/**
* Class AppendNotesTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class AppendNotesTest extends TestCase
{
@@ -64,7 +60,6 @@ class AppendNotesTest extends TestCase
$newNote = $journal->notes()->first();
$this->assertEquals($start . $toAppend, $newNote->text);
}
/**
@@ -90,6 +85,5 @@ class AppendNotesTest extends TestCase
$newNote = $journal->notes()->first();
$this->assertEquals($toAppend, $newNote->text);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\ClearBudget;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/**
* Class ClearBudgetTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class ClearBudgetTest extends TestCase
{
@@ -57,6 +53,5 @@ class ClearBudgetTest extends TestCase
// assert result
$this->assertEquals(0, $journal->budgets()->count());
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
@@ -30,8 +29,6 @@ use Tests\TestCase;
/**
* Class ClearCategoryTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class ClearCategoryTest extends TestCase
{
@@ -56,6 +53,5 @@ class ClearCategoryTest extends TestCase
// assert result
$this->assertEquals(0, $journal->categories()->count());
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\Note;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
@@ -32,8 +30,6 @@ use Tests\TestCase;
/**
* Class ClearNotesTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class ClearNotesTest extends TestCase
{
@@ -63,6 +59,5 @@ class ClearNotesTest extends TestCase
// assert result
$this->assertEquals(0, $journal->notes()->count());
}
}

Some files were not shown because too many files have changed in this diff Show More