Expand API test to bill store.

This commit is contained in:
James Cole
2021-03-13 16:47:29 +01:00
parent bdb298740a
commit c9f7f877c0
15 changed files with 679 additions and 178 deletions

View File

@@ -61,7 +61,7 @@ class StoreControllerTest extends TestCase
}
// run account store with a minimal data set:
$route = 'api.v1.accounts.store';
$this->submitAndCompare($route, $submission);
$this->storeAndCompare($route, $submission);
}
/**
@@ -106,79 +106,81 @@ class StoreControllerTest extends TestCase
*/
private function optionalSets(): array
{
$faker = Factory::create();
$currencies = [
$faker = Factory::create();
$currencies = [
1 => 'EUR',
2 => 'HUF',
3 => 'GBP',
4 => 'UAH',
];
$rand = rand(1, 4);
$rand = rand(1, 4);
// rand
return [
'active' => [
'active' => [
'fields' => [
'active' => $faker->boolean,
],
],
// 'iban' => [
// 'fields' => [
// 'iban' => $faker->iban(),
// ],
// ],
// 'bic' => [
// 'fields' => [
// 'bic' => $faker->swiftBicNumber,
// ],
// ],
// 'account_number' => [
// 'fields' => [
// 'account_number' => $faker->iban(),
// ],
// ],
// 'ob' => [
// 'fields' => [
// 'opening_balance' => $this->getRandomAmount(),
// 'opening_balance_date' => $this->getRandomDateString(),
// ],
// ],
// 'virtual_balance' => [
// 'fields' => [
// 'virtual_balance' => $this->getRandomAmount(),
// ],
// ],
// 'currency_id' => [
// 'fields' => [
// 'currency_id' => $rand,
// ],
// ],
// 'currency_code' => [
// 'fields' => [
// 'currency_code' => $currencies[$rand],
// ],
// ],
// 'order' => [
// 'fields' => [
// 'order' => $faker->numberBetween(1, 5),
// ],
// ],
// 'include_net_worth' => [
// 'fields' => [
// 'include_net_worth' => $faker->boolean,
// ],
// ],
// 'notes' => [
// 'fields' => [
// 'notes' => join(' ', $faker->words(5)),
// ],
// ],
// 'location' => [
// 'fields' => [
// 'latitude' => $faker->latitude,
// 'longitude' => $faker->longitude,
// 'zoom_level' => $faker->numberBetween(1, 10),
// ],
// ],
'iban' => [
'fields' => [
'iban' => $faker->iban(),
],
],
'bic' => [
'fields' => [
'bic' => $faker->swiftBicNumber,
],
],
'account_number' => [
'fields' => [
'account_number' => $faker->iban(),
],
],
'ob' => [
'fields' => [
'opening_balance' => $this->getRandomAmount(),
'opening_balance_date' => $this->getRandomDateString(),
],
],
'virtual_balance' => [
'fields' => [
'virtual_balance' => $this->getRandomAmount(),
],
],
'currency_id' => [
'fields' => [
'currency_id' => $rand,
],
],
'currency_code' => [
'fields' => [
'currency_code' => $currencies[$rand],
],
],
'order' => [
'fields' => [
'order' => $faker->numberBetween(1, 5),
],
],
'include_net_worth' => [
'fields' => [
'include_net_worth' => $faker->boolean,
],
],
'notes' => [
'fields' => [
'notes' => join(' ', $faker->words(5)),
],
],
'location' => [
'fields' => [
'latitude' => $faker->latitude,
'longitude' => $faker->longitude,
'zoom_level' => $faker->numberBetween(1, 10),
],
],
];
}

View File

@@ -92,7 +92,7 @@ class UpdateControllerTest extends TestCase
$accountRoles = ['defaultAsset', 'sharedAsset', 'savingAsset'];
$accountRole = $accountRoles[rand(0, count($accountRoles) - 1)];
$liabilityRoles = ['loan', 'debt', 'asset'];
$liabilityRoles = ['loan', 'debt', 'mortgage'];
$liabilityRole = $liabilityRoles[rand(0, count($liabilityRoles) - 1)];
$interestPeriods = ['daily', 'monthly', 'yearly'];
@@ -179,7 +179,7 @@ class UpdateControllerTest extends TestCase
'notes' => [
'id' => 1,
'fields' => [
'notes' => ['test_value' => $faker->randomAscii],
'notes' => ['test_value' => join(' ', $faker->words(3))],
],
'extra_ignore' => [],
],