mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup.
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
<?php
|
||||
|
||||
class ExampleTest extends TestCase {
|
||||
/**
|
||||
* Class ExampleTest
|
||||
*/
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* A basic functional test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicExample()
|
||||
{
|
||||
$response = $this->call('GET', '/');
|
||||
/**
|
||||
* A basic functional test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicExample()
|
||||
{
|
||||
$response = $this->call('GET', '/');
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
<?php
|
||||
|
||||
class TestCase extends Illuminate\Foundation\Testing\TestCase {
|
||||
/**
|
||||
* Class TestCase
|
||||
*/
|
||||
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Illuminate\Foundation\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Illuminate\Foundation\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
||||
|
||||
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||
|
||||
return $app;
|
||||
}
|
||||
return $app;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -155,20 +155,6 @@ class AccountControllerCest
|
||||
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function storeValidateOnly(FunctionalTester $I)
|
||||
{
|
||||
$I->amOnPage('/accounts/create/asset');
|
||||
$I->wantTo('validate a new asset account');
|
||||
$I->see('Create a new asset account');
|
||||
$I->submitForm(
|
||||
'#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
|
||||
);
|
||||
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
@@ -197,19 +183,4 @@ class AccountControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function validateUpdateOnly(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update an asset account and validate only');
|
||||
$I->amOnPage('/accounts/edit/2');
|
||||
$I->see('Edit asset account "Savings account"');
|
||||
$I->submitForm(
|
||||
'#update', ['name' => 'Savings accountXX', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
|
||||
);
|
||||
$I->dontSeeRecord('accounts', ['name' => 'Savings accountXX']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
|
||||
/**
|
||||
* @SuppressWarnings("CamelCase")
|
||||
* @SuppressWarnings("short")
|
||||
@@ -27,6 +28,9 @@ class RelatedControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function alreadyRelated(FunctionalTester $I)
|
||||
{
|
||||
$group = TransactionGroup::first();
|
||||
@@ -38,6 +42,9 @@ class RelatedControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function alreadyRelatedNoRelations(FunctionalTester $I)
|
||||
{
|
||||
$journal = TransactionJournal::first();
|
||||
@@ -48,6 +55,9 @@ class RelatedControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function relate(FunctionalTester $I)
|
||||
{
|
||||
$journal = TransactionJournal::leftJoin(
|
||||
@@ -67,6 +77,9 @@ class RelatedControllerCest
|
||||
$I->see('true');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function related(FunctionalTester $I)
|
||||
{
|
||||
$group = TransactionGroup::first();
|
||||
@@ -77,6 +90,9 @@ class RelatedControllerCest
|
||||
$I->see('Big expense in ');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function removeRelation(FunctionalTester $I)
|
||||
{
|
||||
$group = TransactionGroup::first();
|
||||
@@ -88,6 +104,9 @@ class RelatedControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function search(FunctionalTester $I)
|
||||
{
|
||||
$one = TransactionJournal::first();//$group = TransactionGroup::first();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use FireflyIII\Models\Reminder;
|
||||
|
||||
/**
|
||||
* Class ReminderControllerCest
|
||||
*
|
||||
@@ -29,7 +30,7 @@ class ReminderControllerCest
|
||||
*/
|
||||
public function act(FunctionalTester $I)
|
||||
{
|
||||
$reminder = Reminder::leftJoin('piggy_banks', 'piggy_banks.id', '=', 'reminders.remindersable_id')->where('piggy_banks.reminder','!=','')->first(
|
||||
$reminder = Reminder::leftJoin('piggy_banks', 'piggy_banks.id', '=', 'reminders.remindersable_id')->where('piggy_banks.reminder', '!=', '')->first(
|
||||
['reminders.*']
|
||||
);
|
||||
|
||||
@@ -73,12 +74,12 @@ class ReminderControllerCest
|
||||
*/
|
||||
public function show(FunctionalTester $I)
|
||||
{
|
||||
$reminder = Reminder::leftJoin('piggy_banks', 'piggy_banks.id', '=', 'reminders.remindersable_id')->where('piggy_banks.reminder','!=','')->first(
|
||||
$reminder = Reminder::leftJoin('piggy_banks', 'piggy_banks.id', '=', 'reminders.remindersable_id')->where('piggy_banks.reminder', '!=', '')->first(
|
||||
['reminders.*']
|
||||
);
|
||||
|
||||
$I->wantTo('see a reminder');
|
||||
$I->amOnPage('/reminders/'.$reminder->id);
|
||||
$I->amOnPage('/reminders/' . $reminder->id);
|
||||
$I->see('A reminder about');
|
||||
$I->see('your piggy bank labelled "Nieuwe spullen"');
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ class ReportControllerCest
|
||||
$I->amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function budget(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see a budget report');
|
||||
@@ -31,6 +34,9 @@ class ReportControllerCest
|
||||
$I->see('Budget report for September 2014');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function budgetInvalidDate(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see a budget report for an invalid date');
|
||||
@@ -38,6 +44,9 @@ class ReportControllerCest
|
||||
$I->see('Invalid date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function index(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see all possible reports');
|
||||
@@ -47,6 +56,9 @@ class ReportControllerCest
|
||||
$I->see('Budget reports');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function month(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see a monthly report');
|
||||
@@ -54,6 +66,9 @@ class ReportControllerCest
|
||||
$I->see('Report for September 2014');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function monthInvalidDate(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see a monthly report for an invalid month');
|
||||
@@ -61,6 +76,9 @@ class ReportControllerCest
|
||||
$I->see('Invalid date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function year(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see a yearly report');
|
||||
@@ -69,6 +87,9 @@ class ReportControllerCest
|
||||
$I->see('Account balance');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function yearInvalidDate(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see a yearly report for an invalid year');
|
||||
|
||||
@@ -20,6 +20,9 @@ class SearchControllerCest
|
||||
$I->amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function index(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('search for "salary"');
|
||||
@@ -29,6 +32,9 @@ class SearchControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function indexNoQuery(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('Search for empty string');
|
||||
|
||||
@@ -23,6 +23,9 @@ class TransactionControllerCest
|
||||
$I->amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function create(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('create a transaction');
|
||||
@@ -30,6 +33,9 @@ class TransactionControllerCest
|
||||
$I->see('Add a new withdrawal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function deleteWithdrawal(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -42,6 +48,9 @@ class TransactionControllerCest
|
||||
$I->see('Delete withdrawal "' . $journal->description . '"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function destroyDeposit(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -56,6 +65,9 @@ class TransactionControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function destroyTransfer(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -72,6 +84,9 @@ class TransactionControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function destroyTransferWithEvent(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -87,6 +102,9 @@ class TransactionControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function destroyWithdrawal(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -102,6 +120,9 @@ class TransactionControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function edit(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -115,6 +136,9 @@ class TransactionControllerCest
|
||||
$I->see('Edit transfer "' . $journal->description . '"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function index(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see all withdrawals');
|
||||
@@ -122,6 +146,9 @@ class TransactionControllerCest
|
||||
$I->see('Expenses');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function indexExpenses(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see all expenses');
|
||||
@@ -129,6 +156,9 @@ class TransactionControllerCest
|
||||
$I->see('Revenue, income and deposits');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function indexTransfers(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see all transfers');
|
||||
@@ -136,6 +166,9 @@ class TransactionControllerCest
|
||||
$I->see('Transfers');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function show(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -168,6 +201,9 @@ class TransactionControllerCest
|
||||
$I->see($journal->description);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function store(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a transaction');
|
||||
@@ -188,6 +224,9 @@ class TransactionControllerCest
|
||||
$I->see('Transaction "Test" stored.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function storeAndFail(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a transaction and fail');
|
||||
@@ -208,6 +247,9 @@ class TransactionControllerCest
|
||||
$I->see('Could not store transaction: The description field is required.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function storeAndReturn(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a transaction');
|
||||
@@ -228,6 +270,9 @@ class TransactionControllerCest
|
||||
$I->see('Transaction "Test" stored.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function storeValidate(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('validate a transaction');
|
||||
@@ -250,6 +295,9 @@ class TransactionControllerCest
|
||||
$I->dontSeeRecord('transaction_journals', ['description' => 'TestValidateMe']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function update(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -276,6 +324,9 @@ class TransactionControllerCest
|
||||
$I->see($journal->description . '!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function updateAndFail(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -302,6 +353,9 @@ class TransactionControllerCest
|
||||
$I->see('Could not update transaction: The description field is required.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function updateAndReturn(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
@@ -327,6 +381,9 @@ class TransactionControllerCest
|
||||
$I->see($journal->description . '!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function updateValidate(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
|
||||
Reference in New Issue
Block a user