mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
First code for liabilities and some tests.
This commit is contained in:
@@ -148,6 +148,38 @@ class AvailableBudgetControllerTest extends TestCase
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store new available budget but the budget currency is invalid.
|
||||
*
|
||||
* @covers \FireflyIII\Api\V1\Controllers\AvailableBudgetController
|
||||
* @covers \FireflyIII\Api\V1\Requests\AvailableBudgetRequest
|
||||
*/
|
||||
public function testStoreInvalidCurrency(): void
|
||||
{
|
||||
// mock stuff:
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
|
||||
// mock calls:
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$currencyRepository->shouldReceive('findNull')->andReturn(null);
|
||||
|
||||
// data to submit
|
||||
$data = [
|
||||
'transaction_currency_id' => '1',
|
||||
'amount' => '100',
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
];
|
||||
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/available_budgets', $data,['Accept' => 'application/json']);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('Could not find the indicated currency.');
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update available budget.
|
||||
*
|
||||
|
Reference in New Issue
Block a user