mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 18:40:12 +00:00
Some code cleanup.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Admin;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Admin;
|
||||
|
||||
|
@@ -81,9 +81,9 @@ class UserControllerTest extends TestCase
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('changePassword')->once();
|
||||
$repository->shouldReceive('changeStatus')->once();
|
||||
$data = [
|
||||
$data = [
|
||||
'id' => 1,
|
||||
'email' => 'test@example.com',
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'james',
|
||||
'password_confirmation' => 'james',
|
||||
'blocked_code' => 'blocked',
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -101,7 +101,7 @@ class TwoFactorControllerTest extends TestCase
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
$data = ['code' => '123456'];
|
||||
$data = ['code' => '123456'];
|
||||
$google = $this->mock(Google2FA::class);
|
||||
$google->shouldReceive('verifyKey')->andReturn(true)->once();
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
@@ -126,6 +126,46 @@ class BudgetControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::collectBudgetInformation
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::__construct
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testIndex(string $range)
|
||||
{
|
||||
// mock stuff
|
||||
$budget = factory(Budget::class)->make();
|
||||
$budgetLimit = factory(BudgetLimit::class)->make();
|
||||
|
||||
// set budget limit to current month:
|
||||
$budgetLimit->start_date = Carbon::now()->startOfMonth();
|
||||
$budgetLimit->end_date = Carbon::now()->endOfMonth();
|
||||
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
|
||||
|
||||
$repository->shouldReceive('cleanupBudgets');
|
||||
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]));
|
||||
$repository->shouldReceive('getInactiveBudgets')->andReturn(new Collection);
|
||||
$repository->shouldReceive('getAvailableBudget')->andReturn('100.123');
|
||||
$repository->shouldReceive('spentInPeriod')->andReturn('-1');
|
||||
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('budgets.index'));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::collectBudgetInformation
|
||||
@@ -206,46 +246,6 @@ class BudgetControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::collectBudgetInformation
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::__construct
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testIndex(string $range)
|
||||
{
|
||||
// mock stuff
|
||||
$budget = factory(Budget::class)->make();
|
||||
$budgetLimit = factory(BudgetLimit::class)->make();
|
||||
|
||||
// set budget limit to current month:
|
||||
$budgetLimit->start_date = Carbon::now()->startOfMonth();
|
||||
$budgetLimit->end_date = Carbon::now()->endOfMonth();
|
||||
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
|
||||
|
||||
$repository->shouldReceive('cleanupBudgets');
|
||||
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]));
|
||||
$repository->shouldReceive('getInactiveBudgets')->andReturn(new Collection);
|
||||
$repository->shouldReceive('getAvailableBudget')->andReturn('100.123');
|
||||
$repository->shouldReceive('spentInPeriod')->andReturn('-1');
|
||||
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('budgets.index'));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::noBudget
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::getPeriodOverview
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -327,7 +327,7 @@ class AccountControllerTest extends TestCase
|
||||
*/
|
||||
public function testRevenueAccounts(string $range)
|
||||
{
|
||||
$account = factory(Account::class)->make();
|
||||
$account = factory(Account::class)->make();
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Chart;
|
||||
|
||||
@@ -54,8 +54,8 @@ class BillControllerTest extends TestCase
|
||||
public function testSingle()
|
||||
{
|
||||
$transaction = factory(Transaction::class)->make();
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setBills')->andReturnSelf()->once();
|
||||
|
@@ -139,7 +139,7 @@ class BudgetControllerTest extends TestCase
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$transactions = factory(Transaction::class, 10)->make();
|
||||
$categories = factory(Category::class, 10)->make();
|
||||
$categories = factory(Category::class, 10)->make();
|
||||
|
||||
$collector->shouldReceive('setAllAssetAccounts')->once()->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->once()->andReturnSelf();
|
||||
|
@@ -35,8 +35,8 @@ class BudgetReportControllerTest extends TestCase
|
||||
*/
|
||||
public function testAccountExpense()
|
||||
{
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$pieChart = $this->mock(MetaPieChartInterface::class);
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$pieChart = $this->mock(MetaPieChartInterface::class);
|
||||
|
||||
$pieChart->shouldReceive('setAccounts')->once()->andReturnSelf();
|
||||
$pieChart->shouldReceive('setBudgets')->once()->andReturnSelf();
|
||||
@@ -56,8 +56,8 @@ class BudgetReportControllerTest extends TestCase
|
||||
*/
|
||||
public function testBudgetExpense()
|
||||
{
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$pieChart = $this->mock(MetaPieChartInterface::class);
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$pieChart = $this->mock(MetaPieChartInterface::class);
|
||||
|
||||
$pieChart->shouldReceive('setAccounts')->once()->andReturnSelf();
|
||||
$pieChart->shouldReceive('setBudgets')->once()->andReturnSelf();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Chart;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Chart;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
@@ -27,6 +27,24 @@ use Tests\TestCase;
|
||||
class CurrencyControllerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::create
|
||||
*/
|
||||
public function testCannotCreate()
|
||||
{
|
||||
// mock stuff
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(false);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.create'));
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('error');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::delete
|
||||
*/
|
||||
@@ -70,24 +88,6 @@ class CurrencyControllerTest extends TestCase
|
||||
$response->assertSessionHas('error');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::create
|
||||
*/
|
||||
public function testCannotCreate()
|
||||
{
|
||||
// mock stuff
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$userRepos->shouldReceive('hasRole')->once()->andReturn(false);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('currencies.create'));
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('error');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::create
|
||||
*/
|
||||
@@ -236,7 +236,7 @@ class CurrencyControllerTest extends TestCase
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::store
|
||||
*/
|
||||
public function testStoreNoRights()
|
||||
public function testStore()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
@@ -263,7 +263,7 @@ class CurrencyControllerTest extends TestCase
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::store
|
||||
*/
|
||||
public function testStore()
|
||||
public function testStoreNoRights()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -188,8 +188,9 @@ class ImportControllerTest extends TestCase
|
||||
$response = $this->post(route('import.start', ['running']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::start
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::start
|
||||
* @expectedExceptionMessage Job did not complete succesfully.
|
||||
*/
|
||||
public function testStartFailed()
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
@@ -26,20 +26,6 @@ use Tests\TestCase;
|
||||
*/
|
||||
class JavascriptControllerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JavascriptController::currencies
|
||||
*/
|
||||
public function testCurrencies()
|
||||
{
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$currency = factory(TransactionCurrency::class)->make();
|
||||
$repository->shouldReceive('get')->andReturn(new Collection([$currency]));
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('javascript.currencies'));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JavascriptController::accounts
|
||||
*/
|
||||
@@ -58,6 +44,20 @@ class JavascriptControllerTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JavascriptController::currencies
|
||||
*/
|
||||
public function testCurrencies()
|
||||
{
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$currency = factory(TransactionCurrency::class)->make();
|
||||
$repository->shouldReceive('get')->andReturn(new Collection([$currency]));
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('javascript.currencies'));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JavascriptController::variables
|
||||
* @covers \FireflyIII\Http\Controllers\JavascriptController::getDateRangePicker
|
||||
|
@@ -94,7 +94,7 @@ class JsonControllerTest extends TestCase
|
||||
$billRepos->shouldReceive('getBillsPaidInRange')->andReturn('-100');
|
||||
|
||||
$this->be($this->user());
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$response = $this->get(route('json.box.paid'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'bills-paid']);
|
||||
@@ -114,7 +114,7 @@ class JsonControllerTest extends TestCase
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$response = $this->get(route('json.box.unpaid'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'bills-unpaid']);
|
||||
@@ -141,7 +141,7 @@ class JsonControllerTest extends TestCase
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$response = $this->get(route('json.box.in'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'in']);
|
||||
@@ -167,7 +167,7 @@ class JsonControllerTest extends TestCase
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$currency = Amount::getDefaultCurrency();
|
||||
$response = $this->get(route('json.box.out'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'out']);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
@@ -159,10 +159,10 @@ class PiggyBankControllerTest extends TestCase
|
||||
public function testIndex()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$one = factory(PiggyBank::class)->make();
|
||||
$two = factory(PiggyBank::class)->make();
|
||||
$repository = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$one = factory(PiggyBank::class)->make();
|
||||
$two = factory(PiggyBank::class)->make();
|
||||
$two->account_id = $one->account_id;
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$one, $two]));
|
||||
|
@@ -13,13 +13,10 @@ namespace Tests\Feature\Controllers\Popup;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Helpers\Report\PopupReportInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
@@ -165,8 +162,8 @@ class ReportControllerTest extends TestCase
|
||||
$popupHelper = $this->mock(PopupReportInterface::class);
|
||||
|
||||
|
||||
$budget = factory(Budget::class)->make();
|
||||
$account = factory(Account::class)->make();
|
||||
$budget = factory(Budget::class)->make();
|
||||
$account = factory(Account::class)->make();
|
||||
|
||||
$budgetRepos->shouldReceive('find')->andReturn($budget)->once()->withArgs([1]);
|
||||
$accountRepos->shouldReceive('find')->andReturn($account)->once()->withArgs([1]);
|
||||
|
@@ -166,7 +166,7 @@ class ProfileControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$data = [
|
||||
$data = [
|
||||
'password' => 'james2',
|
||||
];
|
||||
$this->be($this->user());
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Report;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Report;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Report;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Report;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Report;
|
||||
|
||||
|
@@ -274,22 +274,6 @@ class RuleControllerTest extends TestCase
|
||||
$response->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* This actually hits an error and not the actually code but OK.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::testTriggers
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::getValidTriggerList
|
||||
*/
|
||||
public function testTestTriggersError()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$uri = route('rules.test-triggers');
|
||||
$response = $this->get($uri);
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::testTriggers
|
||||
@@ -314,7 +298,24 @@ class RuleControllerTest extends TestCase
|
||||
$matcher->shouldReceive('findMatchingTransactions')->andReturn(new Collection);
|
||||
|
||||
$this->be($this->user());
|
||||
$uri = route('rules.test-triggers') . '?' . http_build_query($data);
|
||||
$uri = route('rules.test-triggers') . '?' . http_build_query($data);
|
||||
$response = $this->get($uri);
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* This actually hits an error and not the actually code but OK.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::testTriggers
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::getValidTriggerList
|
||||
*/
|
||||
public function testTestTriggersError()
|
||||
{
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$uri = route('rules.test-triggers');
|
||||
$response = $this->get($uri);
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@@ -330,7 +331,7 @@ class RuleControllerTest extends TestCase
|
||||
'rule-trigger-value' => ['Bla bla'],
|
||||
'rule-trigger-stop' => ['1'],
|
||||
];
|
||||
$set = factory(Transaction::class, 10)->make();
|
||||
$set = factory(Transaction::class, 10)->make();
|
||||
|
||||
// mock stuff
|
||||
$matcher = $this->mock(TransactionMatcher::class);
|
||||
@@ -343,7 +344,7 @@ class RuleControllerTest extends TestCase
|
||||
$matcher->shouldReceive('findMatchingTransactions')->andReturn($set);
|
||||
|
||||
$this->be($this->user());
|
||||
$uri = route('rules.test-triggers') . '?' . http_build_query($data);
|
||||
$uri = route('rules.test-triggers') . '?' . http_build_query($data);
|
||||
$response = $this->get($uri);
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
@@ -177,7 +177,6 @@ class RuleGroupControllerTest extends TestCase
|
||||
];
|
||||
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('rule-groups.store', [1]), $data);
|
||||
$response->assertStatus(302);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
|
@@ -151,6 +151,37 @@ class TagControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::show
|
||||
*/
|
||||
public function testShowAll()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(TagRepositoryInterface::class);
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
|
||||
|
||||
$collector->shouldReceive('removeFilter')->andReturnSelf()->times(3);
|
||||
$repository->shouldReceive('sumOfTag')->andReturn('1')->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setTag')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->times(3);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('tags.show', [1, 'all']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::show
|
||||
*/
|
||||
@@ -185,37 +216,6 @@ class TagControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::show
|
||||
*/
|
||||
public function testShowAll()
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(TagRepositoryInterface::class);
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
|
||||
|
||||
$collector->shouldReceive('removeFilter')->andReturnSelf()->times(3);
|
||||
$repository->shouldReceive('sumOfTag')->andReturn('1')->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setTag')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->times(3);
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->times(3);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('tags.show', [1, 'all']));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::store
|
||||
*/
|
||||
|
@@ -15,8 +15,8 @@ namespace Tests\Unit\Handlers\Events;
|
||||
use FireflyIII\Events\RegisteredUser;
|
||||
use FireflyIII\Events\RequestedNewPassword;
|
||||
use FireflyIII\Handlers\Events\UserEventHandler;
|
||||
use FireflyIII\Mail\RequestedNewPassword as RequestedNewPasswordMail;
|
||||
use FireflyIII\Mail\RegisteredUser as RegisteredUserMail;
|
||||
use FireflyIII\Mail\RequestedNewPassword as RequestedNewPasswordMail;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Tests\TestCase;
|
||||
@@ -67,10 +67,11 @@ class UserEventHandlerTest extends TestCase
|
||||
* @covers \FireflyIII\Handlers\Events\UserEventHandler::sendRegistrationMail
|
||||
* @covers \FireflyIII\Events\RegisteredUser
|
||||
*/
|
||||
public function testSendRegistrationMail() {
|
||||
public function testSendRegistrationMail()
|
||||
{
|
||||
Mail::fake();
|
||||
$user = $this->emptyUser();
|
||||
$event = new RegisteredUser($user, '127.0.0.1');
|
||||
$user = $this->emptyUser();
|
||||
$event = new RegisteredUser($user, '127.0.0.1');
|
||||
|
||||
$listener = new UserEventHandler;
|
||||
$listener->sendRegistrationMail($event);
|
||||
|
@@ -153,7 +153,6 @@ class MetaPieChartTest extends TestCase
|
||||
$this->assertTrue(true);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function fakeOthers(): Collection
|
||||
|
Reference in New Issue
Block a user