mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix test method names.
This commit is contained in:
@@ -148,6 +148,40 @@ class AvailableBudgetControllerTest extends TestCase
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store new available budget without a valid currency.
|
||||
*
|
||||
* @covers \FireflyIII\Api\V1\Controllers\AvailableBudgetController
|
||||
* @covers \FireflyIII\Api\V1\Requests\AvailableBudgetRequest
|
||||
*/
|
||||
public function testStoreNoCurrencyAtAll(): void
|
||||
{
|
||||
// mock stuff:
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
|
||||
// mock calls:
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(null)->once();
|
||||
$currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(null)->once();
|
||||
|
||||
// data to submit
|
||||
$data = [
|
||||
'currency_id' => '1',
|
||||
'currency_code' => 'EUR',
|
||||
'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.'); // the amount
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store new available budget without a valid currency.
|
||||
*
|
||||
@@ -186,40 +220,6 @@ class AvailableBudgetControllerTest extends TestCase
|
||||
$response->assertSee($availableBudget->amount); // the amount
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
/**
|
||||
* Store new available budget without a valid currency.
|
||||
*
|
||||
* @covers \FireflyIII\Api\V1\Controllers\AvailableBudgetController
|
||||
* @covers \FireflyIII\Api\V1\Requests\AvailableBudgetRequest
|
||||
*/
|
||||
public function testStoreNoCurrencyAtAll(): void
|
||||
{
|
||||
// mock stuff:
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
|
||||
// mock calls:
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(null)->once();
|
||||
$currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(null)->once();
|
||||
|
||||
// data to submit
|
||||
$data = [
|
||||
'currency_id' => '1',
|
||||
'currency_code' => 'EUR',
|
||||
'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.'); // the amount
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update available budget.
|
||||
|
Reference in New Issue
Block a user