Code cleanup.

This commit is contained in:
James Cole
2017-04-09 07:56:46 +02:00
parent 595596d73f
commit 8db96025a3
81 changed files with 228 additions and 276 deletions

View File

@@ -139,7 +139,6 @@ class BillControllerTest extends TestCase
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BillRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());

View File

@@ -81,9 +81,6 @@ class BudgetControllerTest extends TestCase
*/
public function testBudgetLimitWrongLimit()
{
$repository = $this->mock(BudgetRepositoryInterface::class);
$generator = $this->mock(GeneratorInterface::class);
$this->be($this->user());
$response = $this->get(route('chart.budget.budget-limit', [1, 8]));
$response->assertStatus(500);

View File

@@ -34,8 +34,6 @@ class BudgetReportControllerTest extends TestCase
{
$generator = $this->mock(GeneratorInterface::class);
$pieChart = $this->mock(MetaPieChartInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$pieChart->shouldReceive('setAccounts')->once()->andReturnSelf();
$pieChart->shouldReceive('setBudgets')->once()->andReturnSelf();
@@ -57,8 +55,6 @@ class BudgetReportControllerTest extends TestCase
{
$generator = $this->mock(GeneratorInterface::class);
$pieChart = $this->mock(MetaPieChartInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$pieChart->shouldReceive('setAccounts')->once()->andReturnSelf();
$pieChart->shouldReceive('setBudgets')->once()->andReturnSelf();
@@ -82,7 +78,6 @@ class BudgetReportControllerTest extends TestCase
public function testMainChart()
{
$generator = $this->mock(GeneratorInterface::class);
$pieChart = $this->mock(MetaPieChartInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);

View File

@@ -76,7 +76,6 @@ class CurrencyControllerTest extends TestCase
public function testCannotCreate()
{
// mock stuff
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
@@ -95,7 +94,6 @@ class CurrencyControllerTest extends TestCase
public function testCreate()
{
// mock stuff
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
@@ -115,8 +113,6 @@ class CurrencyControllerTest extends TestCase
public function testDefaultCurrency()
{
// mock stuff
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -177,7 +173,6 @@ class CurrencyControllerTest extends TestCase
public function testEdit()
{
// mock stuff
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);

View File

@@ -40,7 +40,6 @@ class ImportControllerTest extends TestCase
public function testComplete()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -57,7 +56,6 @@ class ImportControllerTest extends TestCase
public function testCompleteWrongJob()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -75,7 +73,6 @@ class ImportControllerTest extends TestCase
{
$setup = $this->mock(CsvSetup::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$setup->shouldReceive('setJob')->once();
@@ -97,7 +94,6 @@ class ImportControllerTest extends TestCase
public function testConfigureWrongJob()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -112,7 +108,6 @@ class ImportControllerTest extends TestCase
public function testDownload()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -135,7 +130,6 @@ class ImportControllerTest extends TestCase
public function testFinished()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -152,7 +146,6 @@ class ImportControllerTest extends TestCase
public function testFinishedWrongJob()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -168,7 +161,6 @@ class ImportControllerTest extends TestCase
public function testIndex()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -182,7 +174,6 @@ class ImportControllerTest extends TestCase
public function testJson()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -197,7 +188,6 @@ class ImportControllerTest extends TestCase
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$tag = factory(Tag::class)->make();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -214,7 +204,6 @@ class ImportControllerTest extends TestCase
public function testJsonRunning()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -253,7 +242,6 @@ class ImportControllerTest extends TestCase
public function testPostConfigureWrongJob()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$data = [];
@@ -271,7 +259,6 @@ class ImportControllerTest extends TestCase
public function testPostSettings()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$importer = $this->mock(CsvSetup::class);
@@ -293,7 +280,6 @@ class ImportControllerTest extends TestCase
public function testPostSettingsWrongJob()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$data = [];
@@ -333,7 +319,6 @@ class ImportControllerTest extends TestCase
public function testSettingsUserSettings()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$importer = $this->mock(CsvSetup::class);
@@ -356,7 +341,6 @@ class ImportControllerTest extends TestCase
public function testSettingsWrongJob()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -373,7 +357,6 @@ class ImportControllerTest extends TestCase
public function testSettingsWrongJobAgain()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -388,7 +371,6 @@ class ImportControllerTest extends TestCase
public function testStart()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
/** @var ImportProcedureInterface $procedure */
@@ -409,7 +391,6 @@ class ImportControllerTest extends TestCase
public function testStatus()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
// complete
@@ -426,7 +407,6 @@ class ImportControllerTest extends TestCase
public function testStatusWrongJob()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(ImportJobRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
// complete

View File

@@ -91,7 +91,6 @@ class ReportControllerTest extends TestCase
*/
public function testBalanceAmountDefaultNoBudget()
{
$collector = $this->mock(JournalCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
@@ -126,7 +125,6 @@ class ReportControllerTest extends TestCase
*/
public function testBalanceAmountDefaultRole()
{
$collector = $this->mock(JournalCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
@@ -162,7 +160,6 @@ class ReportControllerTest extends TestCase
*/
public function testBalanceAmountDiffRole()
{
$collector = $this->mock(JournalCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
@@ -170,11 +167,6 @@ class ReportControllerTest extends TestCase
$budget = factory(Budget::class)->make();
$account = factory(Account::class)->make();
$one = factory(Transaction::class)->make();
$two = factory(Transaction::class)->make();
$tag = factory(Tag::class)->make();
$tag->tagMode = 'balancingAct';
$two->transactionJournal->tags()->save($tag);
$budgetRepos->shouldReceive('find')->andReturn($budget)->once()->withArgs([1]);
$accountRepos->shouldReceive('find')->andReturn($account)->once()->withArgs([1]);
@@ -206,10 +198,8 @@ class ReportControllerTest extends TestCase
*/
public function testBalanceAmountTagRole()
{
$collector = $this->mock(JournalCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
$budget = factory(Budget::class)->make();
$account = factory(Account::class)->make();
@@ -243,7 +233,6 @@ class ReportControllerTest extends TestCase
*/
public function testBudgetSpentAmount()
{
$collector = $this->mock(JournalCollectorInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
$budget = factory(Budget::class)->make();
@@ -275,7 +264,6 @@ class ReportControllerTest extends TestCase
*/
public function testCategoryEntry()
{
$collector = $this->mock(JournalCollectorInterface::class);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
$category = factory(Category::class)->make();
@@ -307,7 +295,6 @@ class ReportControllerTest extends TestCase
*/
public function testExpenseEntry()
{
$collector = $this->mock(JournalCollectorInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$account = factory(Account::class)->make();
@@ -339,7 +326,6 @@ class ReportControllerTest extends TestCase
*/
public function testIncomeEntry()
{
$collector = $this->mock(JournalCollectorInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$account = factory(Account::class)->make();
@@ -371,7 +357,6 @@ class ReportControllerTest extends TestCase
*/
public function testWrongLocation()
{
$popupHelper = $this->mock(PopupReportInterface::class);
$this->be($this->user());
$arguments = [
'attributes' => [

View File

@@ -166,7 +166,6 @@ class ProfileControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository = $this->mock(UserRepositoryInterface::class);
$data = [
'password' => 'james2',
];

View File

@@ -120,7 +120,6 @@ class ReportControllerTest extends TestCase
*/
public function testDefaultReportBadDate()
{
$generator = $this->mock(SYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);

View File

@@ -37,8 +37,6 @@ class RuleGroupControllerTest extends TestCase
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
@@ -55,7 +53,6 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('get')->andReturn(new Collection);
@@ -73,7 +70,6 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy');
@@ -93,7 +89,6 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveDown');
@@ -110,8 +105,6 @@ class RuleGroupControllerTest extends TestCase
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -128,7 +121,6 @@ class RuleGroupControllerTest extends TestCase
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection);
@@ -156,7 +148,6 @@ class RuleGroupControllerTest extends TestCase
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
@@ -175,7 +166,6 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->session(['rule-groups.create.uri' => 'http://localhost']);
@@ -202,7 +192,6 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveUp');
@@ -220,7 +209,6 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$data = [

View File

@@ -36,7 +36,6 @@ class TagControllerTest extends TestCase
public function testCreate()
{
// mock stuff
$repository = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -52,7 +51,6 @@ class TagControllerTest extends TestCase
public function testDelete()
{
// mock stuff
$repository = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);