mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 04:21:20 +00:00
Expand tests.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
@@ -30,6 +31,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
@@ -47,6 +49,7 @@ class BillControllerTest extends TestCase
|
||||
public function testCreate()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
@@ -63,6 +66,7 @@ class BillControllerTest extends TestCase
|
||||
public function testDelete()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
@@ -79,6 +83,7 @@ class BillControllerTest extends TestCase
|
||||
public function testDestroy()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
@@ -97,6 +102,7 @@ class BillControllerTest extends TestCase
|
||||
public function testEdit()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
@@ -115,6 +121,7 @@ class BillControllerTest extends TestCase
|
||||
public function testIndex()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$bill = factory(Bill::class)->make();
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
@@ -125,7 +132,6 @@ class BillControllerTest extends TestCase
|
||||
$repository->shouldReceive('getPaidDatesInRange')->twice()->andReturn(new Collection([new Carbon, new Carbon, new Carbon]));
|
||||
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('bills.index'));
|
||||
$response->assertStatus(200);
|
||||
@@ -139,6 +145,7 @@ class BillControllerTest extends TestCase
|
||||
public function testRescan()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journal = factory(TransactionJournal::class)->make();
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
@@ -158,7 +165,9 @@ class BillControllerTest extends TestCase
|
||||
public function testRescanInactive()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@@ -173,6 +182,7 @@ class BillControllerTest extends TestCase
|
||||
public function testShow()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
@@ -204,10 +214,13 @@ class BillControllerTest extends TestCase
|
||||
public function testStore()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('store')->andReturn(new Bill);
|
||||
$attachHelper->shouldReceive('saveAttachmentsForModel');
|
||||
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
|
||||
|
||||
$data = [
|
||||
'name' => 'New Bill ' . rand(1000, 9999),
|
||||
@@ -233,10 +246,13 @@ class BillControllerTest extends TestCase
|
||||
public function testUpdate()
|
||||
{
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('update')->andReturn(new Bill);
|
||||
$attachHelper->shouldReceive('saveAttachmentsForModel');
|
||||
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
|
||||
|
||||
$data = [
|
||||
'name' => 'Updated Bill ' . rand(1000, 9999),
|
||||
|
||||
Reference in New Issue
Block a user