Building split transactions and fixing tests.

This commit is contained in:
James Cole
2016-05-05 18:59:46 +02:00
parent 21a197ba46
commit eb3d2b1749
18 changed files with 317 additions and 159 deletions

View File

@@ -155,11 +155,9 @@ class JsonControllerTest extends TestCase
*/
public function testTransactionJournals($range)
{
$type = factory(FireflyIII\Models\TransactionType::class)->make();
$repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
$repository->shouldReceive('getTransactionType')->with('deposit')->once()->andReturn($type);
$repository->shouldReceive('getJournalsOfType')->with($type)->once()->andReturn(new Collection);
$paginator = new \Illuminate\Pagination\LengthAwarePaginator(new Collection, 0, 40);
$repository->shouldReceive('getJournals')->withAnyArgs()->once()->andReturn($paginator);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);

View File

@@ -68,7 +68,7 @@ class TransactionControllerTest extends TestCase
public function testIndex($range)
{
$journals = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
$journals->shouldReceive('getJournalsOfTypes')->once()->andReturn(new LengthAwarePaginator([], 0, 50));
$journals->shouldReceive('getJournals')->once()->andReturn(new LengthAwarePaginator([], 0, 50));
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
@@ -117,8 +117,8 @@ class TransactionControllerTest extends TestCase
$args = [
'what' => 'withdrawal',
'description' => 'Something',
'account_id' => '1',
'expense_account' => 'Some expense',
'source_account_id' => '1',
'destination_account_name' => 'Some expense',
'amount' => 100,
'amount_currency_id_amount' => 1,
'date' => '2015-01-01',
@@ -141,10 +141,10 @@ class TransactionControllerTest extends TestCase
$args = [
'what' => 'withdrawal',
'id' => 2,
'id' => 4,
'description' => 'Something new',
'account_id' => '1',
'expense_account' => 'Some expense',
'source_account_id' => '1',
'destination_account_name' => 'Some expense account',
'amount' => 100,
'amount_currency_id_amount' => 1,
'date' => '2015-01-01',