Expand test code.

This commit is contained in:
James Cole
2021-03-19 06:12:28 +01:00
parent b4d44fdd2b
commit 03d3ede036
37 changed files with 1343 additions and 1187 deletions

View File

@@ -37,6 +37,15 @@ class StoreControllerTest extends TestCase
{
use RandomValues, TestHelpers, CollectsValues;
/**
* @return array
*/
public function emptyDataProvider(): array
{
return [[[]]];
}
/**
*
*/
@@ -47,32 +56,6 @@ class StoreControllerTest extends TestCase
Log::info(sprintf('Now in %s.', get_class($this)));
}
/**
* @param array $submission
*
* emptyDataProvider / storeDataProvider
*
* @dataProvider storeDataProvider
*/
public function testStore(array $submission): void
{
if ([] === $submission) {
$this->markTestSkipped('Empty data provider');
}
$route = 'api.v1.currencies.store';
$this->storeAndCompare($route, $submission);
}
/**
* @return array
*/
public function emptyDataProvider(): array
{
return [[[]]];
}
/**
* @return array
*/
@@ -81,19 +64,20 @@ class StoreControllerTest extends TestCase
$minimalSets = $this->minimalSets();
$optionalSets = $this->optionalSets();
$regenConfig = [
'code' => function () {
'code' => function () {
$faker = Factory::create();
return substr($faker->uuid, 0, 3);
},
'name' => function () {
'name' => function () {
$faker = Factory::create();
return $faker->uuid;
},
'symbol' => function () {
$faker = Factory::create();
return $faker->randomAscii.$faker->randomAscii;
return $faker->randomAscii . $faker->randomAscii;
},
];
@@ -113,13 +97,12 @@ class StoreControllerTest extends TestCase
'fields' => [
'code' => substr($faker->uuid, 0, 3),
'name' => $faker->uuid,
'symbol' => $faker->randomAscii.$faker->randomAscii,
'symbol' => $faker->randomAscii . $faker->randomAscii,
],
],
];
}
/**
* @return \array[][]
*/
@@ -133,12 +116,12 @@ class StoreControllerTest extends TestCase
'enabled' => $faker->boolean,
],
],
'default' => [
'default' => [
'fields' => [
'default' => $faker->boolean,
],
],
'decimal_places' => [
'decimal_places' => [
'fields' => [
'decimal_places' => $faker->numberBetween(1, 6),
],
@@ -146,4 +129,20 @@ class StoreControllerTest extends TestCase
];
}
/**
* @param array $submission
*
* emptyDataProvider / storeDataProvider
*
* @dataProvider storeDataProvider
*/
public function testStore(array $submission): void
{
if ([] === $submission) {
$this->markTestSkipped('Empty data provider');
}
$route = 'api.v1.currencies.store';
$this->storeAndCompare($route, $submission);
}
}

View File

@@ -102,7 +102,7 @@ class UpdateControllerTest extends TestCase
'symbol' => [
'id' => 'RUB',
'fields' => [
'description' => ['test_value' => $faker->randomAscii.$faker->randomAscii],
'description' => ['test_value' => $faker->randomAscii . $faker->randomAscii],
],
'extra_ignore' => [],
],