mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 00:04:24 +00:00
Fix tests.
This commit is contained in:
@@ -177,8 +177,9 @@ class AttachmentControllerTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser');
|
||||||
$repository->shouldReceive('get')->once()->andReturn($attachments);
|
$repository->shouldReceive('get')->once()->andReturn($attachments);
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi There');
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->get('/api/v1/attachments');
|
$response = $this->get('/api/v1/attachments');
|
||||||
@@ -205,7 +206,8 @@ class AttachmentControllerTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser');
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi There');
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->get('/api/v1/attachments/' . $attachment->id);
|
$response = $this->get('/api/v1/attachments/' . $attachment->id);
|
||||||
@@ -234,9 +236,9 @@ class AttachmentControllerTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->atLeast()->once();
|
||||||
$repository->shouldReceive('store')->once()->andReturn($attachment);
|
$repository->shouldReceive('store')->once()->andReturn($attachment);
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi There');
|
||||||
$journalRepos->shouldReceive('setUser')->once();
|
$journalRepos->shouldReceive('setUser')->once();
|
||||||
$journalRepos->shouldReceive('findNull')->once()->andReturn($this->user()->transactionJournals()->find(1));
|
$journalRepos->shouldReceive('findNull')->once()->andReturn($this->user()->transactionJournals()->find(1));
|
||||||
|
|
||||||
@@ -274,9 +276,9 @@ class AttachmentControllerTest extends TestCase
|
|||||||
$attachment = $this->user()->attachments()->first();
|
$attachment = $this->user()->attachments()->first();
|
||||||
|
|
||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser')->atLeast()->once();
|
||||||
$repository->shouldReceive('update')->once()->andReturn($attachment);
|
$repository->shouldReceive('update')->once()->andReturn($attachment);
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi There');
|
||||||
// data to submit
|
// data to submit
|
||||||
$data = [
|
$data = [
|
||||||
'filename' => $attachment->filename,
|
'filename' => $attachment->filename,
|
||||||
|
@@ -87,6 +87,7 @@ class BillControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
$repository->shouldReceive('getPaginator')->withAnyArgs()->andReturn($paginator)->once();
|
$repository->shouldReceive('getPaginator')->withAnyArgs()->andReturn($paginator)->once();
|
||||||
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
|
|
||||||
// test API
|
// test API
|
||||||
$response = $this->get('/api/v1/bills');
|
$response = $this->get('/api/v1/bills');
|
||||||
@@ -113,6 +114,7 @@ class BillControllerTest extends TestCase
|
|||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
// test API
|
// test API
|
||||||
$response = $this->get('/api/v1/bills/' . $bill->id);
|
$response = $this->get('/api/v1/bills/' . $bill->id);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@@ -140,6 +142,7 @@ class BillControllerTest extends TestCase
|
|||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->once();
|
||||||
$repository->shouldReceive('store')->andReturn($bill);
|
$repository->shouldReceive('store')->andReturn($bill);
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
|
|
||||||
// data to submit:
|
// data to submit:
|
||||||
$data = [
|
$data = [
|
||||||
@@ -183,8 +186,9 @@ class BillControllerTest extends TestCase
|
|||||||
$repository = $this->mock(BillRepositoryInterface::class);
|
$repository = $this->mock(BillRepositoryInterface::class);
|
||||||
|
|
||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser')->times(2);
|
$repository->shouldReceive('setUser')->atLeast()->times(2);
|
||||||
$repository->shouldReceive('store')->andReturn($bill);
|
$repository->shouldReceive('store')->andReturn($bill);
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
||||||
// data to submit:
|
// data to submit:
|
||||||
$data = [
|
$data = [
|
||||||
@@ -222,7 +226,8 @@ class BillControllerTest extends TestCase
|
|||||||
$repository = $this->mock(BillRepositoryInterface::class);
|
$repository = $this->mock(BillRepositoryInterface::class);
|
||||||
|
|
||||||
// mock calls:
|
// mock calls:
|
||||||
$repository->shouldReceive('setUser')->times(2);
|
$repository->shouldReceive('setUser')->atleast()->times(2);
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
$repository->shouldReceive('update')->andReturn($bill);
|
$repository->shouldReceive('update')->andReturn($bill);
|
||||||
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
$repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());
|
||||||
// data to submit:
|
// data to submit:
|
||||||
|
@@ -174,6 +174,7 @@ class BillControllerTest extends TestCase
|
|||||||
$collection = new Collection([$bill]);
|
$collection = new Collection([$bill]);
|
||||||
$repository->shouldReceive('getPaginator')->andReturn(new LengthAwarePaginator($collection, 1, 50))->once();
|
$repository->shouldReceive('getPaginator')->andReturn(new LengthAwarePaginator($collection, 1, 50))->once();
|
||||||
$repository->shouldReceive('setUser');
|
$repository->shouldReceive('setUser');
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
$repository->shouldReceive('getPaidDatesInRange')->twice()->andReturn(new Collection([new Carbon, new Carbon, new Carbon]));
|
$repository->shouldReceive('getPaidDatesInRange')->twice()->andReturn(new Collection([new Carbon, new Carbon, new Carbon]));
|
||||||
$repository->shouldReceive('getRulesForBills')->andReturn([]);
|
$repository->shouldReceive('getRulesForBills')->andReturn([]);
|
||||||
|
|
||||||
@@ -259,12 +260,14 @@ class BillControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('getOverallAverage')->andReturn('0');
|
$repository->shouldReceive('getOverallAverage')->andReturn('0');
|
||||||
$repository->shouldReceive('nextExpectedMatch')->andReturn(new Carbon);
|
$repository->shouldReceive('nextExpectedMatch')->andReturn(new Carbon);
|
||||||
$repository->shouldReceive('getRulesForBill')->andReturn(new Collection);
|
$repository->shouldReceive('getRulesForBill')->andReturn(new Collection);
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||||
|
|
||||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||||
$collector->shouldReceive('setBills')->andReturnSelf();
|
$collector->shouldReceive('setBills')->andReturnSelf();
|
||||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||||
|
|
||||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf();
|
$collector->shouldReceive('withBudgetInformation')->andReturnSelf();
|
||||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
||||||
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
|
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||||
@@ -276,6 +279,8 @@ class BillControllerTest extends TestCase
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
// has bread crumb
|
// has bread crumb
|
||||||
$response->assertSee('<ol class="breadcrumb">');
|
$response->assertSee('<ol class="breadcrumb">');
|
||||||
|
$response->assertSee('Hi there');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -75,6 +75,7 @@ class BillTransformerTest extends TestCase
|
|||||||
// mock stuff
|
// mock stuff
|
||||||
$repository = $this->mock(BillRepositoryInterface::class);
|
$repository = $this->mock(BillRepositoryInterface::class);
|
||||||
$repository->shouldReceive('setUser')->andReturnSelf();
|
$repository->shouldReceive('setUser')->andReturnSelf();
|
||||||
|
$repository->shouldReceive('getNoteText')->andReturn('Hi there');
|
||||||
$repository->shouldReceive('getPaidDatesInRange')->andReturn(new Collection([new Carbon('2018-01-02')]));
|
$repository->shouldReceive('getPaidDatesInRange')->andReturn(new Collection([new Carbon('2018-01-02')]));
|
||||||
$bill = Bill::create(
|
$bill = Bill::create(
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user