mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Max out the number of iterations
This commit is contained in:
@@ -60,6 +60,7 @@ return [
|
||||
'less' => ':attribute must be less than 10,000,000',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'date_after' => 'End date must be before start date.',
|
||||
'alpha' => 'The :attribute may only contain letters.',
|
||||
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
|
||||
'alpha_num' => 'The :attribute may only contain letters and numbers.',
|
||||
|
@@ -50,7 +50,7 @@ class StoreControllerTest extends TestCase
|
||||
/**
|
||||
* @param array $submission
|
||||
* emptyDataProvider / storeDataProvider
|
||||
* @dataProvider emptyDataProvider
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
@@ -193,7 +193,7 @@ class StoreControllerTest extends TestCase
|
||||
'asset' => [
|
||||
'parameters' => [],
|
||||
'fields' => [
|
||||
'name' => $faker->name . join(' ', $faker->words(2)),
|
||||
'name' => $faker->uuid,
|
||||
'type' => 'asset',
|
||||
'account_role' => $this->randomAccountRole(),
|
||||
],
|
||||
@@ -201,14 +201,14 @@ class StoreControllerTest extends TestCase
|
||||
'expense' => [
|
||||
'parameters' => [],
|
||||
'fields' => [
|
||||
'name' => $faker->name,
|
||||
'name' => $faker->uuid,
|
||||
'type' => 'expense',
|
||||
],
|
||||
],
|
||||
'liability' => [
|
||||
'parameters' => [],
|
||||
'fields' => [
|
||||
'name' => $faker->name,
|
||||
'name' => $faker->uuid,
|
||||
'type' => 'liabilities',
|
||||
'liability_type' => $this->randomLiabilityType(),
|
||||
'liability_amount' => $this->getRandomAmount(),
|
||||
@@ -219,7 +219,7 @@ class StoreControllerTest extends TestCase
|
||||
],
|
||||
'cc' => [
|
||||
'fields' => [
|
||||
'name' => $faker->name,
|
||||
'name' => $faker->uuid,
|
||||
'type' => 'asset',
|
||||
'account_role' => 'ccAsset',
|
||||
'credit_card_type' => 'monthlyFull',
|
||||
|
@@ -102,7 +102,7 @@ class UpdateControllerTest extends TestCase
|
||||
'name' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'name' => ['test_value' => $faker->text(64)],
|
||||
'name' => ['test_value' => $faker->uuid],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
|
@@ -52,7 +52,7 @@ class StoreControllerTest extends TestCase
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
* @dataProvider emptyDataProvider
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
@@ -125,7 +125,7 @@ class StoreControllerTest extends TestCase
|
||||
return [
|
||||
'title' => [
|
||||
'fields' => [
|
||||
'title' => join(' ', $faker->words(3)),
|
||||
'title' => $faker->uuid,
|
||||
],
|
||||
],
|
||||
'notes' => [
|
||||
|
@@ -95,7 +95,7 @@ class UpdateControllerTest extends TestCase
|
||||
'title' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'title' => ['test_value' => $faker->text(64)],
|
||||
'title' => ['test_value' => $faker->uuid],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
|
@@ -52,7 +52,7 @@ class StoreControllerTest extends TestCase
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
* @dataProvider emptyDataProvider
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
|
@@ -52,7 +52,7 @@ class StoreControllerTest extends TestCase
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
* @dataProvider emptyDataProvider
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
@@ -104,7 +104,7 @@ class StoreControllerTest extends TestCase
|
||||
return [
|
||||
'default_bill' => [
|
||||
'fields' => [
|
||||
'name' => join(',', $faker->words(5)),
|
||||
'name' => $faker->uuid,
|
||||
'amount_min' => number_format($faker->randomFloat(2, 10, 50), 2),
|
||||
'amount_max' => number_format($faker->randomFloat(2, 60, 90), 2),
|
||||
'date' => $faker->dateTimeBetween('-1 year', 'now')->format('Y-m-d'),
|
||||
@@ -146,7 +146,7 @@ class StoreControllerTest extends TestCase
|
||||
],
|
||||
'name' => [
|
||||
'fields' => [
|
||||
'name' => join(' ', $faker->words(5)),
|
||||
'name' => $faker->uuid,
|
||||
],
|
||||
],
|
||||
'amount_min' => [
|
||||
|
@@ -99,7 +99,7 @@ class UpdateControllerTest extends TestCase
|
||||
'name' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'name' => ['test_value' => join(' ', $faker->words(4))],
|
||||
'name' => ['test_value' => $faker->uuid],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
|
@@ -52,7 +52,7 @@ class StoreControllerTest extends TestCase
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
* @dataProvider emptyDataProvider
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
@@ -101,7 +101,7 @@ class StoreControllerTest extends TestCase
|
||||
return [
|
||||
'default_budget' => [
|
||||
'fields' => [
|
||||
'name' => join(',', $faker->words(5)),
|
||||
'name' => $faker->uuid,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
@@ -103,7 +103,7 @@ class UpdateControllerTest extends TestCase
|
||||
'name' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'name' => ['test_value' => join(' ', $faker->words(4))],
|
||||
'name' => ['test_value' => $faker->uuid],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
|
@@ -52,7 +52,7 @@ class StoreControllerTest extends TestCase
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
* @dataProvider emptyDataProvider
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
|
@@ -32,6 +32,7 @@ use Tests\Traits\CollectsValues;
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
use CreatesApplication, CollectsValues;
|
||||
protected const MAX_ITERATIONS = 2;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
|
@@ -53,7 +53,8 @@ trait TestHelpers
|
||||
// then loop and add fields:
|
||||
$optionalSets = $startOptionalSets;
|
||||
$keys = array_keys($optionalSets);
|
||||
for ($i = 1; $i <= count($keys); $i++) {
|
||||
$count = count($keys) > self::MAX_ITERATIONS ? self::MAX_ITERATIONS : count($keys);
|
||||
for ($i = 1; $i <= $count; $i++) {
|
||||
$combinations = $this->combinationsOf($i, $keys);
|
||||
// expand body with N extra fields:
|
||||
foreach ($combinations as $extraFields) {
|
||||
@@ -71,6 +72,7 @@ trait TestHelpers
|
||||
}
|
||||
unset($second);
|
||||
}
|
||||
|
||||
return $submissions;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user