Fix test method names.

This commit is contained in:
James Cole
2018-09-02 20:27:26 +02:00
parent de754ca4e0
commit eaf2667abb
90 changed files with 675 additions and 676 deletions

View File

@@ -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.