Route fixes and fix tests.

This commit is contained in:
James Cole
2018-08-09 19:44:36 +02:00
parent 2ed433c96d
commit 5908b4b000
15 changed files with 19 additions and 37 deletions

View File

@@ -166,7 +166,6 @@ class ShowControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Account\ShowController
* @expectedExceptionMessage Expected a transaction
*/
public function testShowBrokenInitial(): void
{
@@ -180,7 +179,9 @@ class ShowControllerTest extends TestCase
$this->be($this->user());
$account = $this->user()->accounts()->where('account_type_id', 6)->orderBy('id', 'ASC')->whereNull('deleted_at')->first();
$response = $this->get(route('accounts.show', [$account->id]));
$response->assertStatus(500);
$response->assertStatus(302);
$response->assertRedirect(route('index'));
$response->assertSessionHas('error');
}
/**

View File

@@ -220,18 +220,10 @@ class IndexControllerTest extends TestCase
$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]));
$repository->shouldReceive('collectBudgetInformation')->andReturn($budgetInfo);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('budgets.index', ['Hello-there']));
$response->assertStatus(200);
// has bread crumb
$response->assertSee('<ol class="breadcrumb">');
$response->assertStatus(404);
}
}

View File

@@ -61,6 +61,8 @@ class ExportControllerTest extends TestCase
$repository = $this->mock(ExportJobRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('changeStatus')->once();
$repository->shouldReceive('exists')->once()->andReturn(true);
$repository->shouldReceive('getContent')->once()->andReturn('Some content beep boop');

View File

@@ -100,7 +100,7 @@ class CreateControllerTest extends TestCase
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new Rule);
$repository->shouldReceive('find')->withArgs([0])->andReturn(new Rule)->once();
//$repository->shouldReceive('find')->withArgs([0])->andReturn(new Rule)->once();
$this->session(['rules.create.uri' => 'http://localhost']);
$data = [

View File

@@ -106,7 +106,6 @@ class EditControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$rule = Rule::find(1);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('find')->withArgs([1])->andReturn($rule)->once();
$repository->shouldReceive('update');
$data = [

View File

@@ -229,6 +229,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('setUser')->once();
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$account = $this->user()->accounts()->first();
@@ -272,6 +273,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('setUser')->once();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -318,6 +320,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('setUser')->once();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -390,6 +393,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('setUser')->once();
$this->be($this->user());
$withdrawal = TransactionJournal::where('transaction_type_id', 1)
@@ -439,6 +443,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('setUser')->once();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -487,6 +492,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('setUser')->once();
$account = $this->user()->accounts()->first();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -528,6 +534,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('setUser')->once();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();