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

View File

@@ -92,7 +92,6 @@ class LoginController extends Controller
} }
if ($this->attemptLogin($request)) { if ($this->attemptLogin($request)) {
// user is logged in. Save in session if the user requested session to be remembered: // user is logged in. Save in session if the user requested session to be remembered:
$request->session()->put('remember_login', $request->filled('remember')); $request->session()->put('remember_login', $request->filled('remember'));
@@ -111,6 +110,7 @@ class LoginController extends Controller
* Log the user out of the application. * Log the user out of the application.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function logout(Request $request, CookieJar $cookieJar) public function logout(Request $request, CookieJar $cookieJar)
@@ -166,7 +166,6 @@ class LoginController extends Controller
$email = $request->old('email'); $email = $request->old('email');
$remember = $request->old('remember'); $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

@@ -99,10 +99,8 @@ class TwoFactorController extends Controller
// wants to remember session? // wants to remember session?
$remember = $request->session()->get('remember_login') ?? false; $remember = $request->session()->get('remember_login') ?? false;
$minutes = config('session.lifetime'); $minutes = config('session.lifetime');
if ($remember === true) { if (true === $remember) {
// set cookie with a long lifetime (30 days) // set cookie with a long lifetime (30 days)
$minutes = 43200; $minutes = 43200;
} }

View File

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

View File

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

View File

@@ -89,6 +89,7 @@ class Amount implements ConverterInterface
} }
$number = strval(number_format(round(floatval($value), 12), 12, '.', '')); $number = strval(number_format(round(floatval($value), 12), 12, '.', ''));
return $number; return $number;
} }
} }

View File

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

View File

@@ -228,11 +228,12 @@ trait FindAccountsTrait
* @param Account $account * @param Account $account
* *
* @return Account|null * @return Account|null
*
* @throws FireflyException * @throws FireflyException
*/ */
public function getReconciliation(Account $account): ?Account 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)); throw new FireflyException(sprintf('%s is not an asset account.', $account->name));
} }
$name = $account->name . ' reconciliation'; $name = $account->name . ' reconciliation';

View File

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

View File

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

View File

@@ -58,7 +58,7 @@ class Transaction extends Twig_Extension
$coloured = true; $coloured = true;
// at this point amount is always negative. // 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'); $amount = bcmul($amount, '-1');
} }
@@ -290,7 +290,7 @@ class Transaction extends Twig_Extension
return $cache->get(); return $cache->get();
} }
if($transaction->transaction_type_type === TransactionType::RECONCILIATION) { if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) {
return '&mdash;'; return '&mdash;';
} }
@@ -476,7 +476,7 @@ class Transaction extends Twig_Extension
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
if($transaction->transaction_type_type === TransactionType::RECONCILIATION) { if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) {
return '&mdash;'; 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 * @return Twig_SimpleFilter
*/ */
@@ -181,7 +166,6 @@ class General extends Twig_Extension
); );
} }
/** /**
* @return Twig_SimpleFunction * @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 * @return Twig_SimpleFilter
*/ */

View File

@@ -82,7 +82,6 @@ $factory->define(
} }
); );
$factory->define( $factory->define(
FireflyIII\Models\TransactionJournal::class, FireflyIII\Models\TransactionJournal::class,
function (Faker\Generator $faker) { function (Faker\Generator $faker) {
@@ -209,7 +208,6 @@ $factory->define(
'end_date' => '2017-01-31', 'end_date' => '2017-01-31',
'amount' => '300', 'amount' => '300',
'budget_id' => $faker->numberBetween(1, 6), 'budget_id' => $faker->numberBetween(1, 6),
]; ];
} }
); );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
<?php <?php
declare(strict_types=1);
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
@@ -13,8 +13,6 @@ class ChangesForV470 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down()
{ {
@@ -26,7 +24,6 @@ class ChangesForV470 extends Migration
* Run the migrations. * Run the migrations.
* *
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up() public function up()
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -8,7 +8,6 @@
* *
* See the LICENSE file for details. * See the LICENSE file for details.
*/ */
declare(strict_types=1); declare(strict_types=1);
use FireflyIII\Models\TransactionCurrency; 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' => 'XBT', 'name' => 'Bitcoin', 'symbol' => '₿', 'decimal_places' => 8]);
TransactionCurrency::create(['code' => 'BCH', 'name' => 'Bitcoin cash', 'symbol' => '₿C', '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]); TransactionCurrency::create(['code' => 'ETH', 'name' => 'Ethereum', 'symbol' => 'Ξ', 'decimal_places' => 12]);
} }
} }

View File

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

View File

@@ -21,8 +21,6 @@
var allCharts = {}; var allCharts = {};
/* /*
Make some colours: Make some colours:
*/ */
@@ -61,8 +59,6 @@ Chart.defaults.global.responsive = true;
Chart.defaults.global.maintainAspectRatio = false; Chart.defaults.global.maintainAspectRatio = false;
/** /**
* Chart line thing * Chart line thing
*/ */
@@ -92,12 +88,15 @@ const verticalLinePlugin = {
afterDatasetsDraw: function (chart, easing) { afterDatasetsDraw: function (chart, easing) {
if (chart.config.lineAtIndex) { 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); Chart.plugins.register(verticalLinePlugin);
/** /**
* *
* @param data * @param data

View File

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

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Feature\Controllers; namespace Tests\Feature\Controllers;
@@ -42,7 +41,6 @@ use Tests\TestCase;
/** /**
* Class AccountControllerTest * Class AccountControllerTest
* *
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -79,7 +77,6 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])->andReturn(new Collection); $repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])->andReturn(new Collection);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
$response = $this->get(route('accounts.delete', [$account->id])); $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('getJournals')->andReturn(new Collection([$transaction]));
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10)); $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));
$this->be($this->user()); $this->be($this->user());
$this->changeDateRange($this->user(), $range); $this->changeDateRange($this->user(), $range);
$response = $this->get(route('accounts.show', [1])); $response = $this->get(route('accounts.show', [1]));
@@ -222,7 +218,6 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10)); $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));
$tasker = $this->mock(AccountTaskerInterface::class); $tasker = $this->mock(AccountTaskerInterface::class);
$tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1'); $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
$tasker->shouldReceive('amountInInPeriod')->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 * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Feature\Controllers\Admin; namespace Tests\Feature\Controllers\Admin;
use FireflyConfig; use FireflyConfig;
use FireflyIII\Models\Configuration; use FireflyIII\Models\Configuration;
use Tests\TestCase; use Tests\TestCase;
@@ -31,14 +29,12 @@ use Tests\TestCase;
/** /**
* Class ConfigurationControllerTest * Class ConfigurationControllerTest
* *
* @package Tests\Feature\Controllers\Admin
* @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/ */
class ConfigurationControllerTest extends TestCase class ConfigurationControllerTest extends TestCase
{ {
/** /**
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::__construct * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::__construct
@@ -80,5 +76,4 @@ class ConfigurationControllerTest extends TestCase
$response->assertSessionHas('success'); $response->assertSessionHas('success');
$response->assertStatus(302); $response->assertStatus(302);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Feature\Controllers; namespace Tests\Feature\Controllers;
@@ -30,14 +29,12 @@ use Tests\TestCase;
/** /**
* Class HelpControllerTest * Class HelpControllerTest
* *
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/ */
class HelpControllerTest extends TestCase class HelpControllerTest extends TestCase
{ {
/** /**
* @covers \FireflyIII\Http\Controllers\HelpController::show * @covers \FireflyIII\Http\Controllers\HelpController::show
* @covers \FireflyIII\Http\Controllers\HelpController::getHelpText * @covers \FireflyIII\Http\Controllers\HelpController::getHelpText
@@ -65,7 +62,7 @@ class HelpControllerTest extends TestCase
{ {
// force pref in dutch for test // force pref in dutch for test
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete(); 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 = $this->mock(HelpInterface::class);
$help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once(); $help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once();
@@ -83,7 +80,7 @@ class HelpControllerTest extends TestCase
// put English back: // put English back:
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete(); 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 // force pref in dutch for test
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete(); 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 = $this->mock(HelpInterface::class);
$help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once(); $help->shouldReceive('hasRoute')->withArgs(['index'])->andReturn(true)->once();
@@ -112,7 +109,7 @@ class HelpControllerTest extends TestCase
// put English back: // put English back:
Preference::where('user_id', $this->user()->id)->where('name', 'language')->delete(); 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->assertStatus(200);
$response->assertSee('There is no help for this route.'); $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 * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Feature\Controllers; namespace Tests\Feature\Controllers;
@@ -36,7 +35,6 @@ use Tests\TestCase;
/** /**
* Class HomeControllerTest * Class HomeControllerTest
* *
* @package Tests\Feature\Controllers
* @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -53,7 +51,6 @@ class HomeControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$args = [ $args = [
@@ -76,7 +73,6 @@ class HomeControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$args = [ $args = [
@@ -191,5 +187,4 @@ class HomeControllerTest extends TestCase
$response->assertSessionHas('warning'); $response->assertSessionHas('warning');
$response->assertSessionHas('error'); $response->assertSessionHas('error');
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Unit\Helpers; namespace Tests\Unit\Helpers;
use FireflyIII\Helpers\Attachments\AttachmentHelper; use FireflyIII\Helpers\Attachments\AttachmentHelper;
use FireflyIII\Models\Attachment; use FireflyIII\Models\Attachment;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
@@ -34,7 +32,6 @@ use Tests\TestCase;
/** /**
* Class AttachmentHelperTest * Class AttachmentHelperTest
* *
* @package Tests\Unit\Helpers
* @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -63,7 +60,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::hasFile * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::hasFile
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
*
*/ */
public function testInvalidMime() public function testInvalidMime()
{ {
@@ -93,7 +89,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments
*
*/ */
public function testSave() public function testSave()
{ {
@@ -129,7 +124,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments * @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments
*
*/ */
public function testSaveSecond() public function testSaveSecond()
{ {
@@ -146,6 +140,4 @@ class AttachmentHelperTest extends TestCase
$this->assertCount(0, $messages); $this->assertCount(0, $messages);
$this->assertEquals('Uploaded file "apple-touch-icon.png" is already attached to this object.', $errors->first()); $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 * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Unit\Helpers; namespace Tests\Unit\Helpers;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Chart\MetaPieChart; use FireflyIII\Helpers\Chart\MetaPieChart;
use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -40,7 +38,6 @@ use Tests\TestCase;
/** /**
* Class MetaPieChartTest * Class MetaPieChartTest
* *
* @package Tests\Unit\Helpers
* @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -87,7 +84,6 @@ class MetaPieChartTest extends TestCase
$accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]); $accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]);
$accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]); $accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]);
$helper = new MetaPieChart(); $helper = new MetaPieChart();
$helper->setUser($this->user()); $helper->setUser($this->user());
$helper->setStart($som); $helper->setStart($som);
@@ -98,12 +94,10 @@ class MetaPieChartTest extends TestCase
$keys = array_keys($chart); $keys = array_keys($chart);
$this->assertEquals($keys[0], $accounts[1]->name); $this->assertEquals($keys[0], $accounts[1]->name);
$this->assertEquals($keys[1], $accounts[2]->name); $this->assertEquals($keys[1], $accounts[2]->name);
$this->assertTrue(bccomp('1000', $chart[$accounts[1]->name]) === 0); $this->assertTrue(0 === bccomp('1000', $chart[$accounts[1]->name]));
$this->assertTrue(bccomp('1000', $chart[$accounts[2]->name]) === 0); $this->assertTrue(0 === bccomp('1000', $chart[$accounts[2]->name]));
$this->assertTrue(true); $this->assertTrue(true);
} }
/** /**
@@ -149,7 +143,6 @@ class MetaPieChartTest extends TestCase
$accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]); $accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]);
$accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]); $accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]);
$helper = new MetaPieChart(); $helper = new MetaPieChart();
$helper->setCollectOtherObjects(true); $helper->setCollectOtherObjects(true);
$helper->setUser($this->user()); $helper->setUser($this->user());
@@ -161,20 +154,18 @@ class MetaPieChartTest extends TestCase
$keys = array_keys($chart); $keys = array_keys($chart);
$this->assertEquals($keys[0], $accounts[1]->name); $this->assertEquals($keys[0], $accounts[1]->name);
$this->assertEquals($keys[1], $accounts[2]->name); $this->assertEquals($keys[1], $accounts[2]->name);
$this->assertTrue(bccomp('1000', $chart[$accounts[1]->name]) === 0); $this->assertTrue(0 === bccomp('1000', $chart[$accounts[1]->name]));
$this->assertTrue(bccomp('1000', $chart[$accounts[2]->name]) === 0); $this->assertTrue(0 === bccomp('1000', $chart[$accounts[2]->name]));
$this->assertTrue(bccomp('1000', $chart['Everything else']) === 0); $this->assertTrue(0 === bccomp('1000', $chart['Everything else']));
$this->assertTrue(true); $this->assertTrue(true);
} }
private function fakeOthers(): Collection private function fakeOthers(): Collection
{ {
$set = new Collection; $set = new Collection;
for ($i = 0; $i < 30; $i++) { for ($i = 0; $i < 30; ++$i) {
$transaction = new Transaction; $transaction = new Transaction;
// basic fields. // basic fields.
@@ -193,7 +184,7 @@ class MetaPieChartTest extends TestCase
private function fakeTransactions(): Collection private function fakeTransactions(): Collection
{ {
$set = new Collection; $set = new Collection;
for ($i = 0; $i < 10; $i++) { for ($i = 0; $i < 10; ++$i) {
$transaction = new Transaction; $transaction = new Transaction;
// basic fields. // basic fields.
@@ -206,7 +197,7 @@ class MetaPieChartTest extends TestCase
$set->push($transaction); $set->push($transaction);
} }
for ($i = 0; $i < 10; $i++) { for ($i = 0; $i < 10; ++$i) {
$transaction = new Transaction; $transaction = new Transaction;
// basic fields. // basic fields.
@@ -221,5 +212,4 @@ class MetaPieChartTest extends TestCase
return $set; return $set;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions; namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\RemoveAllTags; use FireflyIII\TransactionRules\Actions\RemoveAllTags;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/** /**
* Class RemoveAllTagsTest * Class RemoveAllTagsTest
*
* @package Tests\Unit\TransactionRules\Actions
*/ */
class RemoveAllTagsTest extends TestCase class RemoveAllTagsTest extends TestCase
{ {

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>. * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions; namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\RemoveTag; use FireflyIII\TransactionRules\Actions\RemoveTag;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/** /**
* Class RemoveTagTest * Class RemoveTagTest
*
* @package Tests\Unit\TransactionRules\Actions
*/ */
class RemoveTagTest extends TestCase class RemoveTagTest extends TestCase
{ {

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