Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
First run of all tests
James Cole657726e6678b
diff --git a/app/Api/V1/Controllers/Models/TransactionLink/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionLink/UpdateController.phpindex a1c3caca0b..68c65ecb53 100644--- a/app/Api/V1/Controllers/Models/TransactionLink/UpdateController.php+++ b/app/Api/V1/Controllers/Models/TransactionLink/UpdateController.php@@ -53,6 +53,8 @@ class UpdateController extends Controller** @return JsonResponse* @throws FireflyException+ *+ * TODO generates query exception when link exists.*/public function update(UpdateRequest $request, TransactionJournalLink $journalLink): JsonResponse{diff --git a/phpunit.xml b/phpunit.xmlindex 73f6dfa065..0a4cb707e6 100644--- a/phpunit.xml+++ b/phpunit.xml@@ -29,36 +29,39 @@convertWarningsToExceptions="true"processIsolation="false"xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">- <coverage processUncoveredFiles="true">- <include>- <directory suffix=".php">./app</directory>- </include>- </coverage>- <testsuites>- <testsuite name="Api">- <!--+ <coverage processUncoveredFiles="true">+ <include>+ <directory suffix=".php">./app</directory>+ </include>+ </coverage>+ <testsuites>+ <testsuite name="Api">+ <!--+ -->- <directory suffix="Test.php">./tests/Api/Models/Account</directory>- <directory suffix="Test.php">./tests/Api/Models/Attachment</directory>- <directory suffix="Test.php">./tests/Api/Models/AvailableBudget</directory>- <directory suffix="Test.php">./tests/Api/Models/Bill</directory>- <directory suffix="Test.php">./tests/Api/Models/Budget</directory>- <directory suffix="Test.php">./tests/Api/Models/BudgetLimit</directory>- <directory suffix="Test.php">./tests/Api/Models/Category</directory>- <directory suffix="Test.php">./tests/Api/Models/ObjectGroup</directory>- <directory suffix="Test.php">./tests/Api/Models/PiggyBank</directory>- <directory suffix="Test.php">./tests/Api/Models/Recurrence</directory>- <directory suffix="Test.php">./tests/Api/Models/Rule</directory>- <directory suffix="Test.php">./tests/Api/Models/RuleGroup</directory>- <directory suffix="Test.php">./tests/Api/Models/Tag</directory>- -->- <directory suffix="Test.php">./tests/Api/Models/Transaction</directory>- </testsuite>- </testsuites>- <php>- <env name="APP_ENV" value="testing"/>- <env name="CACHE_DRIVER" value="array"/>- <env name="SESSION_DRIVER" value="array"/>- <env name="QUEUE_DRIVER" value="sync"/>- </php>+ <directory suffix="Test.php">./tests/Api/Models/Account</directory>+ <directory suffix="Test.php">./tests/Api/Models/Attachment</directory>+ <directory suffix="Test.php">./tests/Api/Models/AvailableBudget</directory>+ <directory suffix="Test.php">./tests/Api/Models/Bill</directory>+ <directory suffix="Test.php">./tests/Api/Models/Budget</directory>+ <directory suffix="Test.php">./tests/Api/Models/BudgetLimit</directory>+ <directory suffix="Test.php">./tests/Api/Models/Category</directory>+ <directory suffix="Test.php">./tests/Api/Models/ObjectGroup</directory>+ <directory suffix="Test.php">./tests/Api/Models/PiggyBank</directory>+ <directory suffix="Test.php">./tests/Api/Models/Recurrence</directory>+ <directory suffix="Test.php">./tests/Api/Models/Rule</directory>+ <directory suffix="Test.php">./tests/Api/Models/RuleGroup</directory>+ <directory suffix="Test.php">./tests/Api/Models/Tag</directory>+ <directory suffix="Test.php">./tests/Api/Models/Transaction</directory>+ <directory suffix="Test.php">./tests/Api/Models/TransactionCurrency</directory>+ <directory suffix="Test.php">./tests/Api/Models/TransactionLink</directory>+ <directory suffix="Test.php">./tests/Api/Models/TransactionLinkType</directory>+ </testsuite>+ </testsuites>+ <php>+ <env name="APP_ENV" value="testing"/>+ <env name="CACHE_DRIVER" value="array"/>+ <env name="SESSION_DRIVER" value="array"/>+ <env name="QUEUE_DRIVER" value="sync"/>+ </php></phpunit>diff --git a/tests/Api/Models/TransactionCurrency/StoreControllerTest.php b/tests/Api/Models/TransactionCurrency/StoreControllerTest.phpindex 81b72172bd..ac6101f1c5 100644--- a/tests/Api/Models/TransactionCurrency/StoreControllerTest.php+++ b/tests/Api/Models/TransactionCurrency/StoreControllerTest.php@@ -25,6 +25,9 @@ namespace Tests\Api\Models\TransactionCurrency;use Faker\Factory;use Laravel\Passport\Passport;use Log;+use Tests\Objects\Field;+use Tests\Objects\FieldSet;+use Tests\Objects\TestConfiguration;use Tests\TestCase;use Tests\Traits\CollectsValues;@@ -61,72 +64,41 @@ class StoreControllerTest extends TestCase*/public function storeDataProvider(): array{- $minimalSets = $this->minimalSets();- $optionalSets = $this->optionalSets();- $regenConfig = [- 'code' => function () {- $faker = Factory::create();-- return substr($faker->uuid, 0, 3);- },- 'name' => function () {- $faker = Factory::create();-- return $faker->uuid;- },- 'symbol' => function () {- $faker = Factory::create();-- return $faker->randomAscii . $faker->randomAscii;- },- ];-- return $this->genericDataProvider($minimalSets, $optionalSets, $regenConfig);- }+ // some test configs:+ $configuration = new TestConfiguration;- /**- * @return array- */- private function minimalSets(): array- {- $faker = Factory::create();-- return [- 'default_currency' => [- 'parameters' => [],- 'fields' => [- 'code' => substr($faker->uuid, 0, 3),- 'name' => $faker->uuid,- 'symbol' => $faker->randomAscii . $faker->randomAscii,- ],- ],- ];- }+ // default test set:+ $defaultSet = new FieldSet();+ $defaultSet->title = 'default_object';+ $defaultSet->addField(Field::createBasic('code', 'random-new-currency-code'));+ $defaultSet->addField(Field::createBasic('name', 'uuid'));+ $defaultSet->addField(Field::createBasic('symbol', 'random-new-currency-symbol'));++ // 'code' => substr($faker->uuid, 0, 3),+ // 'name' => $faker->uuid,+ // 'symbol' => $faker->randomAscii . $faker->randomAscii,++ $configuration->addMandatoryFieldSet($defaultSet);++ // optionals+ $fieldSet = new FieldSet;+ $field = Field::createBasic('enabled', 'boolean');+ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('enabled', $fieldSet);++ $fieldSet = new FieldSet;+ $field = Field::createBasic('default', 'boolean');+ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('default', $fieldSet);++ $fieldSet = new FieldSet;+ $field = Field::createBasic('decimal_places', 'currency-dp');+ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('decimal_places', $fieldSet);+++ return $configuration->generateAll();- /**- * @return \array[][]- */- private function optionalSets(): array- {- $faker = Factory::create();-- return [- 'enabled' => [- 'fields' => [- 'enabled' => $faker->boolean,- ],- ],- 'default' => [- 'fields' => [- 'default' => $faker->boolean,- ],- ],- 'decimal_places' => [- 'fields' => [- 'decimal_places' => $faker->numberBetween(1, 6),- ],- ],- ];}/**@@ -139,10 +111,15 @@ class StoreControllerTest extends TestCasepublic function testStore(array $submission): void{if ([] === $submission) {- $this->markTestSkipped('Empty data provider');+ $this->markTestSkipped('Empty provider.');}- $route = 'api.v1.currencies.store';- $this->storeAndCompare($route, $submission);+ Log::debug('testStoreUpdated()');+ Log::debug('submission :', $submission['submission']);+ Log::debug('expected :', $submission['expected']);+ Log::debug('ignore :', $submission['ignore']);+ // run account store with a minimal data set:+ $address = route('api.v1.currencies.store');+ $this->assertPOST($address, $submission);}}\ No newline at end of filediff --git a/tests/Api/Models/TransactionCurrency/UpdateControllerTest.php b/tests/Api/Models/TransactionCurrency/UpdateControllerTest.phpindex 008c0193f3..8a36f8bb56 100644--- a/tests/Api/Models/TransactionCurrency/UpdateControllerTest.php+++ b/tests/Api/Models/TransactionCurrency/UpdateControllerTest.php@@ -25,6 +25,9 @@ namespace Tests\Api\Models\TransactionCurrency;use Faker\Factory;use Laravel\Passport\Passport;use Log;+use Tests\Objects\Field;+use Tests\Objects\FieldSet;+use Tests\Objects\TestConfiguration;use Tests\TestCase;use Tests\Traits\CollectsValues;@@ -53,13 +56,17 @@ class UpdateControllerTest extends TestCase*/public function testUpdate(array $submission): void{- $ignore = [- 'created_at',- 'updated_at',- ];- $route = route('api.v1.currencies.update', [$submission['id']]);-- $this->updateAndCompare($route, $submission, $ignore);+ if ([] === $submission) {+ $this->markTestSkipped('Empty provider.');+ }+ Log::debug('testStoreUpdated()');+ Log::debug('submission :', $submission['submission']);+ Log::debug('expected :', $submission['expected']);+ Log::debug('ignore :', $submission['ignore']);+ Log::debug('parameters :', $submission['parameters']);++ $route = route('api.v1.currencies.update', $submission['parameters']);+ $this->assertPUT($route, $submission);}@@ -68,13 +75,43 @@ class UpdateControllerTest extends TestCase*/public function updateDataProvider(): array{- $submissions = [];- $all = $this->updateDataSet();- foreach ($all as $name => $data) {- $submissions[] = [$data];- }-- return $submissions;+ $configuration = new TestConfiguration;++ $fieldSet = new FieldSet;+ $fieldSet->parameters = ['RMB'];+ $fieldSet->addField(Field::createBasic('name', 'uuid'));+ $configuration->addOptionalFieldSet('name', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = ['RMB'];+ $fieldSet->addField(Field::createBasic('symbol', 'random-new-currency-symbol'));+ $configuration->addOptionalFieldSet('symbol', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = ['RMB'];+ $field = Field::createBasic('enabled', 'boolean');+ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('enabled', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = ['RMB'];+ $field = Field::createBasic('default', 'boolean-true');+ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('default', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = ['RMB'];+ $field = Field::createBasic('decimal_places', 'currency-dp');+ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('decimal_places', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = ['RMB'];+ $fieldSet->addField(Field::createBasic('symbol', 'random-new-currency-code'));+ $configuration->addOptionalFieldSet('code', $fieldSet);+++ return $configuration->generateAll();}diff --git a/tests/Api/Models/TransactionLink/StoreControllerTest.php b/tests/Api/Models/TransactionLink/StoreControllerTest.phpindex af228a99a9..320a41da9d 100644--- a/tests/Api/Models/TransactionLink/StoreControllerTest.php+++ b/tests/Api/Models/TransactionLink/StoreControllerTest.php@@ -25,6 +25,9 @@ namespace Tests\Api\Models\TransactionLink;use Faker\Factory;use Laravel\Passport\Passport;use Log;+use Tests\Objects\Field;+use Tests\Objects\FieldSet;+use Tests\Objects\TestConfiguration;use Tests\TestCase;use Tests\Traits\CollectsValues;@@ -61,66 +64,33 @@ class StoreControllerTest extends TestCase*/public function storeDataProvider(): array{- $minimalSets = $this->minimalSets();- $optionalSets = $this->optionalSets();- $regenConfig = [- 'inward_id' => function () {- $faker = Factory::create();-- return (string)$faker->numberBetween(1, 10);- },- 'outward_id' => function () {- $faker = Factory::create();-- return (string)$faker->numberBetween(11, 20);- },- ];-- return $this->genericDataProvider($minimalSets, $optionalSets, $regenConfig);- }+ // some test configs:+ $configuration = new TestConfiguration;++ // default test set:+ $defaultSet = new FieldSet();+ $defaultSet->title = 'default_object';+ $defaultSet->addField(Field::createBasic('link_type_id', 'random-link-type-id'));+ $defaultSet->addField(Field::createBasic('inward_id', 'random-low-journal-id'));+ $defaultSet->addField(Field::createBasic('outward_id', 'random-high-journal-id'));+ $configuration->addMandatoryFieldSet($defaultSet);++ $defaultSet = new FieldSet();+ $defaultSet->title = 'default_object_name';+ $defaultSet->addField(Field::createBasic('link_type_name', 'random-link-type-name'));+ $defaultSet->addField(Field::createBasic('inward_id', 'random-low-journal-id'));+ $defaultSet->addField(Field::createBasic('outward_id', 'random-high-journal-id'));+ $configuration->addMandatoryFieldSet($defaultSet);++ // optionals+ $fieldSet = new FieldSet;+ $fieldSet->addField(Field::createBasic('notes', 'uuid'));+ $configuration->addOptionalFieldSet('notes', $fieldSet);++ return $configuration->generateAll();- /**- * @return array- */- private function minimalSets(): array- {- $faker = Factory::create();-- return [- 'default_link_id' => [- 'parameters' => [],- 'fields' => [- 'link_type_id' => (string)$faker->numberBetween(1, 4),- 'inward_id' => (string)$faker->numberBetween(1, 10),- 'outward_id' => (string)$faker->numberBetween(11, 20),- ],- ],- 'default_link_name' => [- 'parameters' => [],- 'fields' => [- 'link_type_name' => 'Related',- 'inward_id' => (string)$faker->numberBetween(1, 10),- 'outward_id' => (string)$faker->numberBetween(11, 20),- ],- ],- ];}- /**- * @return \array[][]- */- private function optionalSets(): array- {- $faker = Factory::create();-- return [- 'notes' => [- 'fields' => [- 'notes' => join(' ', $faker->words(5)),- ],- ],- ];- }/*** @param array $submission@@ -132,10 +102,17 @@ class StoreControllerTest extends TestCasepublic function testStore(array $submission): void{if ([] === $submission) {- $this->markTestSkipped('Empty data provider');+ $this->markTestSkipped('Empty provider.');}- $route = 'api.v1.transaction_links.store';- $this->storeAndCompare($route, $submission);+ Log::debug('testStoreUpdated()');+ Log::debug('submission :', $submission['submission']);+ Log::debug('expected :', $submission['expected']);+ Log::debug('ignore :', $submission['ignore']);+ // run account store with a minimal data set:+ $address = route('api.v1.transaction_links.store');+ $this->assertPOST($address, $submission);++}}\ No newline at end of filediff --git a/tests/Api/Models/TransactionLink/UpdateControllerTest.php b/tests/Api/Models/TransactionLink/UpdateControllerTest.phpindex 03f8b3c8af..4fe4a03d4a 100644--- a/tests/Api/Models/TransactionLink/UpdateControllerTest.php+++ b/tests/Api/Models/TransactionLink/UpdateControllerTest.php@@ -22,12 +22,13 @@namespace Tests\Api\Models\TransactionLink;-use Faker\Factory;use Laravel\Passport\Passport;use Log;+use Tests\Objects\Field;+use Tests\Objects\FieldSet;+use Tests\Objects\TestConfiguration;use Tests\TestCase;use Tests\Traits\CollectsValues;-use Tests\Traits\TestHelpers;/**@@ -53,13 +54,17 @@ class UpdateControllerTest extends TestCase*/public function testUpdate(array $submission): void{- $ignore = [- 'created_at',- 'updated_at',- ];- $route = route('api.v1.transaction_links.update', [$submission['id']]);-- $this->updateAndCompare($route, $submission, $ignore);+ if ([] === $submission) {+ $this->markTestSkipped('Empty provider.');+ }+ Log::debug('testStoreUpdated()');+ Log::debug('submission :', $submission['submission']);+ Log::debug('expected :', $submission['expected']);+ Log::debug('ignore :', $submission['ignore']);+ Log::debug('parameters :', $submission['parameters']);++ $route = route('api.v1.transaction_links.update', $submission['parameters']);+ $this->assertPUT($route, $submission);}@@ -68,61 +73,44 @@ class UpdateControllerTest extends TestCase*/public function updateDataProvider(): array{- $submissions = [];- $all = $this->updateDataSet();- foreach ($all as $name => $data) {- $submissions[] = [$data];- }+ $configuration = new TestConfiguration;- return $submissions;- }+ $fieldSet = new FieldSet;+ $fieldSet->parameters = [1];+ $field = Field::createBasic('link_type_id', 'random-link-type-id');+ $field->ignorableFields = ['link_type_name'];++ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('link_type_id', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = [1];++ $field = Field::createBasic('link_type_name', 'random-link-type-name');+ $field->ignorableFields = ['link_type_id'];++ $fieldSet->addField($field);+ $configuration->addOptionalFieldSet('link_type_name', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = [1];+ $fieldSet->addField(Field::createBasic('inward_id', 'random-low-journal-id'));+ $configuration->addOptionalFieldSet('inward_id', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = [1];+ $fieldSet->addField(Field::createBasic('outward_id', 'random-high-journal-id'));+ $configuration->addOptionalFieldSet('outward_id', $fieldSet);++ $fieldSet = new FieldSet;+ $fieldSet->parameters = [1];+ $fieldSet->addField(Field::createBasic('notes', 'uuid'));+ $configuration->addOptionalFieldSet('notes', $fieldSet);+++ return $configuration->generateAll();- /**- * @return array- */- public function updateDataSet(): array- {- $faker = Factory::create();- $set = [- 'link_type_id' => [- 'id' => 1,- 'fields' => [- 'link_type_id' => ['test_value' => (string)$faker->numberBetween(1, 3)],- ],- 'extra_ignore' => ['link_type_name'],- ],- 'link_type_name' => [- 'id' => 1,- 'fields' => [- 'link_type_name' => ['test_value' => 'Refund'],- ],- 'extra_ignore' => ['link_type_id'],- ],- 'inward_id' => [- 'id' => 1,- 'fields' => [- 'inward_id' => ['test_value' => (string)$faker->numberBetween(11, 20)],- ],- 'extra_ignore' => [],- ],- 'outward_id' => [- 'id' => 1,- 'fields' => [- 'outward_id' => ['test_value' => (string)$faker->numberBetween(11, 30)],- ],- 'extra_ignore' => [],- ],- 'notes' => [- 'id' => 1,- 'fields' => [- 'notes' => ['test_value' => join(' ', $faker->words(5))],- ],- 'extra_ignore' => [],- ],- ];-- return $set;}diff --git a/tests/Api/Models/TransactionLinkType/StoreControllerTest.php b/tests/Api/Models/TransactionLinkType/StoreControllerTest.phpindex 873eb0c21a..acbd63345b 100644--- a/tests/Api/Models/TransactionLinkType/StoreControllerTest.php+++ b/tests/Api/Models/TransactionLinkType/StoreControllerTest.php@@ -25,6 +25,9 @@ namespace Tests\Api\Models\TransactionLinkType;use Faker\Factory;use Laravel\Passport\Passport;use Log;+use Tests\Objects\Field;+use Tests\Objects\FieldSet;+use Tests\Objects\TestConfiguration;use Tests\TestCase;use Tests\Traits\CollectsValues;@@ -61,57 +64,19 @@ class StoreControllerTest extends TestCase*/public function storeDataProvider(): array{- $minimalSets = $this->minimalSets();- $optionalSets = $this->optionalSets();- $regenConfig = [- 'name' => function () {- $faker = Factory::create();+ // some test configs:+ $configuration = new TestConfiguration;- return $faker->uuid;- },- 'inward' => function () {- $faker = Factory::create();+ // default test set:+ $defaultSet = new FieldSet();+ $defaultSet->title = 'default_object';+ $defaultSet->addField(Field::createBasic('name', 'uuid'));+ $defaultSet->addField(Field::createBasic('inward', 'uuid'));+ $defaultSet->addField(Field::createBasic('outward', 'uuid'));+ $configuration->addMandatoryFieldSet($defaultSet);- return $faker->uuid;- },- 'outward' => function () {- $faker = Factory::create();- return $faker->uuid;- },- ];-- return $this->genericDataProvider($minimalSets, $optionalSets, $regenConfig);- }-- /**- * @return array- */- private function minimalSets(): array- {- $faker = Factory::create();-- return [- 'default_link_type' => [- 'parameters' => [],- 'fields' => [- 'name' => $faker->uuid,- 'inward' => $faker->uuid,- 'outward' => $faker->uuid,- ],- ],-- ];- }-- /**- * @return \array[][]- */- private function optionalSets(): array- {- return [-- ];+ return $configuration->generateAll();}/**@@ -123,11 +88,17 @@ class StoreControllerTest extends TestCase*/public function testStore(array $submission): void{+if ([] === $submission) {- $this->markTestSkipped('Empty data provider');+ $this->markTestSkipped('Empty provider.');}- $route = 'api.v1.link_types.store';- $this->storeAndCompare($route, $submission);+ Log::debug('testStoreUpdated()');+ Log::debug('submission :', $submission['submission']);+ Log::debug('expected :', $submission['expected']);+ Log::debug('ignore :', $submission['ignore']);+ // run account store with a minimal data set:+ $address = route('api.v1.link_types.store');+ $this->assertPOST($address, $submission);}}\ No newline at end of filediff --git a/tests/Api/Models/TransactionLinkType/UpdateControllerTest.php b/tests/Api/Models/TransactionLinkType/UpdateControllerTest.phpindex af0b70f778..60ae19a6be 100644--- a/tests/Api/Models/TransactionLinkType/UpdateControllerTest.php+++ b/tests/Api/Models/TransactionLinkType/UpdateControllerTest.php@@ -25,6 +25,9 @@ namespace Tests\Api\Models\TransactionLinkType;use Faker\Factory;use Laravel\Passport\Passport;use Log;+use Tests\Objects\Field;+use Tests\Objects\FieldSet;+use Tests\Objects\TestConfiguration;use Tests\TestCase;use Tests\Traits\CollectsValues;@@ -53,13 +56,17 @@ class UpdateControllerTest extends TestCase*/public function testUpdate(array $submission): void{- $ignore = [- 'created_at',- 'updated_at',- ];- $route = route('api.v1.link_types.update', [$submission['id']]);-- $this->updateAndCompare($route, $submission, $ignore);+ if ([] === $submission) {+ $this->markTestSkipped('Empty provider.');+ }+ Log::debug('testStoreUpdated()');+ Log::debug('submission :', $submission['submission']);+ Log::debug('expected :', $submission['expected']);+ Log::debug('ignore :', $submission['ignore']);+ Log::debug('parameters :', $submission['parameters']);++ $route = route('api.v1.link_types.update', $submission['parameters']);+ $this->assertPUT($route, $submission);}@@ -68,48 +75,24 @@ class UpdateControllerTest extends TestCase*/public function updateDataProvider(): array{- $submissions = [];- $all = $this->updateDataSet();- foreach ($all as $name => $data) {- $submissions[] = [$data];- }+ $configuration = new TestConfiguration;- return $submissions;- }+ $fieldSet = new FieldSet;+ $fieldSet->parameters = [5];+ $fieldSet->addField(Field::createBasic('name', 'uuid'));+ $configuration->addOptionalFieldSet('name', $fieldSet);+ $fieldSet = new FieldSet;+ $fieldSet->parameters = [5];+ $fieldSet->addField(Field::createBasic('inward', 'uuid'));+ $configuration->addOptionalFieldSet('inward', $fieldSet);- /**- * @return array- */- public function updateDataSet(): array- {- $faker = Factory::create();- $set = [- 'name' => [- 'id' => 5,- 'fields' => [- 'name' => ['test_value' => $faker->uuid],- ],- 'extra_ignore' => [],- ],- 'inward' => [- 'id' => 5,- 'fields' => [- 'inward' => ['test_value' => $faker->uuid],- ],- 'extra_ignore' => [],- ],- 'outward' => [- 'id' => 5,- 'fields' => [- 'outward' => ['test_value' => $faker->uuid],- ],- 'extra_ignore' => [],- ],- ];-- return $set;- }+ $fieldSet = new FieldSet;+ $fieldSet->parameters = [5];+ $fieldSet->addField(Field::createBasic('outward', 'uuid'));+ $configuration->addOptionalFieldSet('outward', $fieldSet);+ return $configuration->generateAll();+ }}\ No newline at end of filediff --git a/tests/Objects/TestConfiguration.php b/tests/Objects/TestConfiguration.phpindex f488f420ac..11588fcd23 100644--- a/tests/Objects/TestConfiguration.php+++ b/tests/Objects/TestConfiguration.php@@ -67,7 +67,7 @@ class TestConfiguration$positions = explode('/', $value);$count = count($positions);if (1 === $count) {- $updated[$key] = $updated[$key] ? $updated[$key] : $value;+ $updated[$key] = array_key_exists($key, $updated) ? $updated[$key] : $value;continue;}if (3 === $count) {@@ -286,6 +286,7 @@ class TestConfigurationif (is_array($value) && !array_key_exists($key, $left)) {$this->debugMsg(sprintf('Key %s exists in right only, keep it as it is.', $key));$result[$key] = $right[$key];+ continue;}// value is not an array, can be appended to result (ignore the key):$this->debugMsg(sprintf('Key %s is a string (%s), just append it and return it later.', $key, $value));@@ -401,6 +402,14 @@ class TestConfigurationreturn $faker->randomElement(['loan', 'debt', 'mortgage']);case 'random-journal-id':return $faker->numberBetween(1, 25);+ case 'random-low-journal-id':+ return $faker->numberBetween(1, 9);+ case 'random-high-journal-id':+ return $faker->numberBetween(10, 20);+ case 'random-link-type-id':+ return $faker->numberBetween(1, 4);+ case 'random-link-type-name':+ return $faker->randomElement(['Related', 'Refund', 'Paid', 'Reimbursement']);case 'random-amount':return number_format($faker->randomFloat(2, 10, 100), 2);case 'random-percentage':@@ -423,6 +432,8 @@ class TestConfigurationreturn $faker->randomElement(['withdrawal', 'deposit', 'transfer']);case 'boolean':return $faker->boolean;+ case 'boolean-true':+ return true;case 'iban':case 'account_number':return $faker->iban();@@ -505,6 +516,12 @@ class TestConfigurationreturn $faker->randomElement(['set_category', 'add_tag', 'set_description']);case 'random-rule-group-title':return $faker->randomElement(['Rule group 1', 'Rule group 2']);+ case 'random-new-currency-code':+ return $faker->randomLetter . $faker->randomLetter . $faker->randomLetter;+ case 'random-new-currency-symbol':+ return $faker->randomAscii . $faker->randomAscii;+ case 'currency-dp':+ return $faker->numberBetween(0, 11);}}