Expand tests.

This commit is contained in:
James Cole
2018-02-28 15:50:00 +01:00
parent 28debb46be
commit 46f4fa1a7d
34 changed files with 987 additions and 403 deletions

View File

@@ -41,6 +41,10 @@ class LinkControllerTest extends TestCase
*/
public function testDelete()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('transactions.link.delete', [1]));
$response->assertStatus(200);
@@ -51,8 +55,12 @@ class LinkControllerTest extends TestCase
*/
public function testDestroy()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(LinkTypeRepositoryInterface::class);
$repository->shouldReceive('destroyLink');
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$this->session(['journal_links.delete.uri' => 'http://localhost/']);
@@ -117,11 +125,15 @@ class LinkControllerTest extends TestCase
*/
public function testStoreInvalid()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
$data = [
'link_other' => 0,
'link_type' => '1_inward',
];
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->post(route('transactions.link.store', [1]), $data);
$response->assertStatus(302);
@@ -134,7 +146,9 @@ class LinkControllerTest extends TestCase
*/
public function testSwitchLink()
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(LinkTypeRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('switchLink')->andReturn(false);
$this->be($this->user());
$response = $this->get(route('transactions.link.switch', [1]));