From d12f6845886dee9c84efc3092d63982f68e09324 Mon Sep 17 00:00:00 2001 From: danloa Date: Sun, 8 Sep 2024 22:28:49 -0400 Subject: [PATCH 1/2] Screen translation tests --- tests/Feature/Api/TranslationTest.php | 169 ++++++++++++++++++++++++++ tests/Fixtures/translation_test.json | 1 + 2 files changed, 170 insertions(+) create mode 100644 tests/Feature/Api/TranslationTest.php create mode 100644 tests/Fixtures/translation_test.json diff --git a/tests/Feature/Api/TranslationTest.php b/tests/Feature/Api/TranslationTest.php new file mode 100644 index 0000000000..be162e2150 --- /dev/null +++ b/tests/Feature/Api/TranslationTest.php @@ -0,0 +1,169 @@ +create(['is_administrator' => true]); + $portugueseUser = User::factory()->create(['is_administrator' => true, 'language' => 'pt']); + $spanishUser = User::factory()->create(['is_administrator' => true, 'language' => 'es']); + + $this->user = $defaultAdminUser; + + $fileName = __DIR__ . '/../../Fixtures/translation_test.json'; + $file = new UploadedFile($fileName, 'translation_test.json', null, null, true); + Storage::putFileAs('import', $file, 'payload.json'); + $hash = md5_file(Storage::path(ImportV2::FILE_PATH)); + ImportV2::dispatchSync($this->user->id, null, $hash, false); + + $process = Process::orderBy('id', 'desc')->first(); + + WorkflowManager::triggerStartEvent( + $process, + $process->getDefinitions()->getEvent('node_1'), + [] + ); + + $task = ProcessRequestToken::orderBy('id', 'desc')->first(); + + // The first task should be created + $this->assertNotEmpty($task); + + $url = route('api.tasks.show', [$task->id]); + $response = $this->apiCall('GET', "$url?include=screen"); + $response->assertStatus(200); + + $responseData = $response->json(); + $items = collect($responseData['screen']['config'][0]['items']); + $firstNameItem = $items->firstWhere('config.name', 'first_name'); + $lastNameItem = $items->firstWhere('config.name', 'last_name'); + $ageItem = $items->firstWhere('config.name', 'age'); + + $this->assertEquals('First Name', $firstNameItem['config']['label']); + $this->assertEquals('Last Name', $lastNameItem['config']['label']); + $this->assertEquals('Age', $ageItem['config']['label']); + + + // As portuguese is not translated, english must be used + $this->user = $portugueseUser; + $response = $this->apiCall('GET', "$url?include=screen"); + $responseData = $response->json(); + $items = collect($responseData['screen']['config'][0]['items']); + $firstNameItem = $items->firstWhere('config.name', 'first_name'); + $lastNameItem = $items->firstWhere('config.name', 'last_name'); + $ageItem = $items->firstWhere('config.name', 'age'); + + $this->assertEquals('First Name', $firstNameItem['config']['label']); + $this->assertEquals('Last Name', $lastNameItem['config']['label']); + $this->assertEquals('Age', $ageItem['config']['label']); + + + // Spanish has translation, so it should be used for the screen: + $this->user = $spanishUser; + $response = $this->apiCall('GET', "$url?include=screen"); + $responseData = $response->json(); + $items = collect($responseData['screen']['config'][0]['items']); + $firstNameItem = $items->firstWhere('config.name', 'first_name'); + $lastNameItem = $items->firstWhere('config.name', 'last_name'); + $ageItem = $items->firstWhere('config.name', 'age'); + + $this->assertEquals('Nombre', $firstNameItem['config']['label']); + $this->assertEquals('Apellido', $lastNameItem['config']['label']); + $this->assertEquals('Edad', $ageItem['config']['label']); + } + + + public function testTranslationWithLanguageThatDoesNotHaveTranslation() + { + $defaultAdminUser = User::factory()->create(['is_administrator' => true]); + $portugueseUser = User::factory()->create(['is_administrator' => true, 'language' => 'pt']); + + $this->user = $defaultAdminUser; + + $fileName = __DIR__ . '/../../Fixtures/translation_test.json'; + $file = new UploadedFile($fileName, 'translation_test.json', null, null, true); + Storage::putFileAs('import', $file, 'payload.json'); + $hash = md5_file(Storage::path(ImportV2::FILE_PATH)); + ImportV2::dispatchSync($this->user->id, null, $hash, false); + + $process = Process::orderBy('id', 'desc')->first(); + + WorkflowManager::triggerStartEvent( + $process, + $process->getDefinitions()->getEvent('node_1'), + [] + ); + + $task = ProcessRequestToken::orderBy('id', 'desc')->first(); + + $this->user = $portugueseUser; + $url = route('api.tasks.show', [$task->id]); + $response = $this->apiCall('GET', "$url?include=screen"); + $response->assertStatus(200); + + // As portuguese is not translated, english must be used + $response = $this->apiCall('GET', "$url?include=screen"); + $responseData = $response->json(); + $items = collect($responseData['screen']['config'][0]['items']); + $firstNameItem = $items->firstWhere('config.name', 'first_name'); + $lastNameItem = $items->firstWhere('config.name', 'last_name'); + $ageItem = $items->firstWhere('config.name', 'age'); + + $this->assertEquals('First Name', $firstNameItem['config']['label']); + $this->assertEquals('Last Name', $lastNameItem['config']['label']); + $this->assertEquals('Age', $ageItem['config']['label']); + } + + public function testTranslationWithLanguageThatHasTranslation() + { + + $spanishUser = User::factory()->create(['is_administrator' => true, 'language' => 'es']); + $this->user = User::factory()->create(['is_administrator' => true]); + + $fileName = __DIR__ . '/../../Fixtures/translation_test.json'; + $file = new UploadedFile($fileName, 'translation_test.json', null, null, true); + Storage::putFileAs('import', $file, 'payload.json'); + $hash = md5_file(Storage::path(ImportV2::FILE_PATH)); + ImportV2::dispatchSync($this->user->id, null, $hash, false); + + $process = Process::orderBy('id', 'desc')->first(); + + WorkflowManager::triggerStartEvent( + $process, + $process->getDefinitions()->getEvent('node_1'), + [] + ); + + $newTask = ProcessRequestToken::orderBy('id', 'desc')->first(); + $url = route('api.tasks.show', [$newTask->id]); + $response = $this->apiCall('GET', "$url?include=screen"); + + // Spanish has translation, so it should be used for the screen: + $this->user = $spanishUser; + $response = $this->apiCall('GET', "$url?include=screen"); + $responseData = $response->json(); + $items = collect($responseData['screen']['config'][0]['items']); + $firstNameItem = $items->firstWhere('config.name', 'first_name'); + $lastNameItem = $items->firstWhere('config.name', 'last_name'); + $ageItem = $items->firstWhere('config.name', 'age'); + + $this->assertEquals('Nombre', $firstNameItem['config']['label']); + $this->assertEquals('Apellido', $lastNameItem['config']['label']); + $this->assertEquals('Edad', $ageItem['config']['label']); + } +} diff --git a/tests/Fixtures/translation_test.json b/tests/Fixtures/translation_test.json new file mode 100644 index 0000000000..322815ed28 --- /dev/null +++ b/tests/Fixtures/translation_test.json @@ -0,0 +1 @@ +{"type":"process_package","version":"2","root":"9cf47c7e-334f-4e1c-9cd1-252efd4d2d05","name":"TranslationTest","export":{"9cf47c7e-334f-4e1c-9cd1-252efd4d2d05":{"exporter":"ProcessMaker\\ImportExport\\Exporters\\ProcessExporter","type":"Process","type_human":"Process","type_plural":"Processes","type_human_plural":"Processes","last_modified_by":"Admin User","last_modified_by_id":1,"model":"ProcessMaker\\Models\\Process","force_password_protect":false,"hidden":false,"mode":"update","saveAssetsMode":"saveAllAssets","explicit_discard":false,"dependents":[{"type":"user","uuid":"9cea0b37-2e38-4422-9c3c-92825afa0c3b","meta":null,"exporterClass":"ProcessMaker\\ImportExport\\Exporters\\UserExporter","modelClass":"ProcessMaker\\Models\\User","fallbackMatches":{"email":"admin@processmaker.com","username":"admin"},"name":"","discard":false},{"type":"screens","uuid":"9cf47d78-6875-463c-ac60-bc57ce03af48","meta":{"path":"\/bpmn:definitions\/bpmn:process\/bpmn:task[1]"},"exporterClass":"ProcessMaker\\ImportExport\\Exporters\\ScreenExporter","modelClass":"ProcessMaker\\Models\\Screen","fallbackMatches":{"key":null,"title":"Register User"},"name":"Register User","discard":false},{"type":"screens","uuid":"9cf48199-06ef-4e3c-b3b4-ccd86ca44c04","meta":{"path":"\/bpmn:definitions\/bpmn:process\/bpmn:task[2]"},"exporterClass":"ProcessMaker\\ImportExport\\Exporters\\ScreenExporter","modelClass":"ProcessMaker\\Models\\Screen","fallbackMatches":{"key":null,"title":"Summary Screen"},"name":"Summary Screen","discard":false},{"type":"process_launchpad","uuid":"9cf48515-0f41-4426-90bf-5c68b131bdfe","meta":null,"exporterClass":"ProcessMaker\\ImportExport\\Exporters\\ProcessLaunchpadExporter","modelClass":"ProcessMaker\\Models\\ProcessLaunchpad","fallbackMatches":[],"name":"Setting","discard":false}],"name":"Planets","description":"Planets","process_manager":"","process_manager_id":null,"attributes":{"id":631,"uuid":"9cf47c7e-334f-4e1c-9cd1-252efd4d2d05","process_category_id":2,"user_id":1,"bpmn":"\n\n \n \n node_46<\/bpmn:outgoing>\n <\/bpmn:startEvent>\n \n node_46<\/bpmn:incoming>\n node_57<\/bpmn:outgoing>\n <\/bpmn:task>\n \n node_57<\/bpmn:incoming>\n node_61<\/bpmn:outgoing>\n <\/bpmn:task>\n \n node_61<\/bpmn:incoming>\n <\/bpmn:endEvent>\n \n \n \n <\/bpmn:process>\n \n \n \n \n <\/bpmndi:BPMNShape>\n \n \n <\/bpmndi:BPMNShape>\n \n \n <\/bpmndi:BPMNShape>\n \n \n <\/bpmndi:BPMNShape>\n \n \n \n <\/bpmndi:BPMNEdge>\n \n \n \n <\/bpmndi:BPMNEdge>\n \n \n \n <\/bpmndi:BPMNEdge>\n <\/bpmndi:BPMNPlane>\n <\/bpmndi:BPMNDiagram>\n<\/bpmn:definitions>","description":"Planets","name":"Planets","cancel_screen_id":null,"request_detail_screen_id":null,"status":"ACTIVE","is_valid":1,"package_key":null,"pause_timer_start":0,"deleted_at":null,"created_at":"2024-09-07 19:52:25","updated_at":"2024-09-07 20:14:13","updated_by":1,"start_events":"[{\"id\": \"node_1\", \"name\": \"Start Event\", \"config\": \"{\\\"web_entry\\\":null}\", \"ownerProcessId\": \"ProcessId\", \"eventDefinitions\": [], \"ownerProcessName\": \"ProcessName\", \"allowInterstitial\": \"true\", \"interstitialScreenRef\": \"\"}]","warnings":null,"self_service_tasks":"[]","svg":"<\/marker><\/marker><\/marker><\/marker><\/defs>Start\u00a0Event<\/tspan><\/text><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g>End\u00a0Event<\/tspan><\/text><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g>Register<\/tspan><\/text><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g>View<\/tspan><\/text><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g><\/g>
SSN ###-##-####
Phone (###) ###-####\", \"validation\": null}}, {\"type\": \"FormInput\", \"field\": \"customCssSelector\", \"config\": {\"label\": \"CSS Selector Name\", \"helper\": \"Use this in your custom css rules\", \"validation\": \"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]\"}}, {\"type\": \"FormInput\", \"field\": \"ariaLabel\", \"config\": {\"label\": \"Aria Label\", \"helper\": \"Attribute designed to help assistive technology (e.g. screen readers) attach a label\"}}, {\"type\": \"FormInput\", \"field\": \"tabindex\", \"config\": {\"label\": \"Tab Order\", \"helper\": \"Order in which a user will move focus from one control to another by pressing the Tab key\", \"validation\": \"regex: [0-9]*\"}}], \"editor-control\": \"FormInput\", \"editor-component\": \"FormInput\"}, {\"label\": \"Line Input\", \"config\": {\"icon\": \"far fa-square\", \"name\": \"last_name\", \"type\": \"text\", \"label\": \"Last Name\", \"helper\": null, \"readonly\": false, \"dataFormat\": \"string\", \"validation\": [], \"placeholder\": null}, \"component\": \"FormInput\", \"inspector\": [{\"type\": \"FormInput\", \"field\": \"name\", \"config\": {\"name\": \"Variable Name\", \"label\": \"Variable Name\", \"helper\": \"A variable name is a symbolic name to reference information.\", \"validation\": \"regex:\/^([a-zA-Z]([a-zA-Z0-9_]?)+\\\\.?)+(? Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####\", \"validation\": null}}, {\"type\": \"FormInput\", \"field\": \"customCssSelector\", \"config\": {\"label\": \"CSS Selector Name\", \"helper\": \"Use this in your custom css rules\", \"validation\": \"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]\"}}, {\"type\": \"FormInput\", \"field\": \"ariaLabel\", \"config\": {\"label\": \"Aria Label\", \"helper\": \"Attribute designed to help assistive technology (e.g. screen readers) attach a label\"}}, {\"type\": \"FormInput\", \"field\": \"tabindex\", \"config\": {\"label\": \"Tab Order\", \"helper\": \"Order in which a user will move focus from one control to another by pressing the Tab key\", \"validation\": \"regex: [0-9]*\"}}], \"editor-control\": \"FormInput\", \"editor-component\": \"FormInput\"}, {\"label\": \"Line Input\", \"config\": {\"icon\": \"far fa-square\", \"name\": \"age\", \"type\": \"text\", \"label\": \"Age\", \"helper\": null, \"readonly\": false, \"dataFormat\": \"int\", \"validation\": [], \"placeholder\": null}, \"component\": \"FormInput\", \"inspector\": [{\"type\": \"FormInput\", \"field\": \"name\", \"config\": {\"name\": \"Variable Name\", \"label\": \"Variable Name\", \"helper\": \"A variable name is a symbolic name to reference information.\", \"validation\": \"regex:\/^([a-zA-Z]([a-zA-Z0-9_]?)+\\\\.?)+(? Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####\", \"validation\": null}}, {\"type\": \"FormInput\", \"field\": \"customCssSelector\", \"config\": {\"label\": \"CSS Selector Name\", \"helper\": \"Use this in your custom css rules\", \"validation\": \"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]\"}}, {\"type\": \"FormInput\", \"field\": \"ariaLabel\", \"config\": {\"label\": \"Aria Label\", \"helper\": \"Attribute designed to help assistive technology (e.g. screen readers) attach a label\"}}, {\"type\": \"FormInput\", \"field\": \"tabindex\", \"config\": {\"label\": \"Tab Order\", \"helper\": \"Order in which a user will move focus from one control to another by pressing the Tab key\", \"validation\": \"regex: [0-9]*\"}}], \"editor-control\": \"FormInput\", \"editor-component\": \"FormInput\"}, {\"label\": \"Submit Button\", \"config\": {\"icon\": \"fas fa-share-square\", \"name\": null, \"event\": \"submit\", \"label\": \"Save\", \"loading\": false, \"tooltip\": [], \"variant\": \"primary\", \"fieldValue\": null, \"loadingLabel\": \"Loading...\", \"defaultSubmit\": true}, \"component\": \"FormButton\", \"inspector\": [{\"type\": \"FormInput\", \"field\": \"label\", \"config\": {\"label\": \"Label\", \"helper\": \"The label describes the button's text\"}}, {\"type\": \"FormInput\", \"field\": \"name\", \"config\": {\"name\": \"Variable Name\", \"label\": \"Variable Name\", \"helper\": \"A variable name is a symbolic name to reference information.\", \"validation\": \"regex:\/^(?:[A-Za-z])(?:[0-9A-Z_.a-z])*(? Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####\", \"validation\": null}}, {\"type\": \"FormInput\", \"field\": \"customCssSelector\", \"config\": {\"label\": \"CSS Selector Name\", \"helper\": \"Use this in your custom css rules\", \"validation\": \"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]\"}}, {\"type\": \"FormInput\", \"field\": \"ariaLabel\", \"config\": {\"label\": \"Aria Label\", \"helper\": \"Attribute designed to help assistive technology (e.g. screen readers) attach a label\"}}, {\"type\": \"FormInput\", \"field\": \"tabindex\", \"config\": {\"label\": \"Tab Order\", \"helper\": \"Order in which a user will move focus from one control to another by pressing the Tab key\", \"validation\": \"regex: [0-9]*\"}}], \"editor-control\": \"FormSubmit\", \"editor-component\": \"FormButton\"}], \"order\": 1}]","computed":"[]","custom_css":null,"created_at":"2024-09-07 19:55:09","updated_at":"2024-09-07 20:14:41","status":"ACTIVE","key":null,"watchers":"[]","translations":"{\"es\": {\"strings\": [{\"key\": \"First Name\", \"string\": \"Nombre\"}, {\"key\": \"Last Name\", \"string\": \"Apellido\"}, {\"key\": \"Age\", \"string\": \"Edad\"}, {\"key\": \"Save\", \"string\": \"Guardar\"}], \"created_at\": \"2024-09-07T20:14:41.526065Z\", \"updated_at\": \"2024-09-07T20:14:41.526065Z\"}}","is_template":0,"asset_type":null},"extraAttributes":{"translatedLanguages":{"es":"Spanish"}},"references":{"uncategorized-category":true}},"9cf48199-06ef-4e3c-b3b4-ccd86ca44c04":{"exporter":"ProcessMaker\\ImportExport\\Exporters\\ScreenExporter","type":"Screen","type_human":"Screen","type_plural":"Screens","type_human_plural":"Screens","last_modified_by":"","last_modified_by_id":null,"model":"ProcessMaker\\Models\\Screen","force_password_protect":false,"hidden":false,"mode":"update","saveAssetsMode":"saveAllAssets","explicit_discard":false,"dependents":[],"name":"Summary Screen","description":"summary","process_manager":"","process_manager_id":null,"attributes":{"id":1183,"uuid":"9cf48199-06ef-4e3c-b3b4-ccd86ca44c04","title":"Summary Screen","description":"summary","type":"FORM","config":"[{\"name\": \"Summary Screen\", \"items\": [{\"label\": \"Line Input\", \"config\": {\"icon\": \"far fa-square\", \"name\": \"summary\", \"type\": \"text\", \"label\": \"Summary\", \"helper\": null, \"readonly\": false, \"dataFormat\": \"string\", \"validation\": [], \"placeholder\": null}, \"component\": \"FormInput\", \"inspector\": [{\"type\": \"FormInput\", \"field\": \"name\", \"config\": {\"name\": \"Variable Name\", \"label\": \"Variable Name\", \"helper\": \"A variable name is a symbolic name to reference information.\", \"validation\": \"regex:\/^([a-zA-Z]([a-zA-Z0-9_]?)+\\\\.?)+(? Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####\", \"validation\": null}}, {\"type\": \"FormInput\", \"field\": \"customCssSelector\", \"config\": {\"label\": \"CSS Selector Name\", \"helper\": \"Use this in your custom css rules\", \"validation\": \"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]\"}}, {\"type\": \"FormInput\", \"field\": \"ariaLabel\", \"config\": {\"label\": \"Aria Label\", \"helper\": \"Attribute designed to help assistive technology (e.g. screen readers) attach a label\"}}, {\"type\": \"FormInput\", \"field\": \"tabindex\", \"config\": {\"label\": \"Tab Order\", \"helper\": \"Order in which a user will move focus from one control to another by pressing the Tab key\", \"validation\": \"regex: [0-9]*\"}}], \"editor-control\": \"FormInput\", \"editor-component\": \"FormInput\"}, {\"label\": \"Submit Button\", \"config\": {\"icon\": \"fas fa-share-square\", \"name\": null, \"event\": \"submit\", \"label\": \"Submit\", \"loading\": false, \"tooltip\": [], \"variant\": \"primary\", \"fieldValue\": null, \"loadingLabel\": \"Loading...\", \"defaultSubmit\": true}, \"component\": \"FormButton\", \"inspector\": [{\"type\": \"FormInput\", \"field\": \"label\", \"config\": {\"label\": \"Label\", \"helper\": \"The label describes the button's text\"}}, {\"type\": \"FormInput\", \"field\": \"name\", \"config\": {\"name\": \"Variable Name\", \"label\": \"Variable Name\", \"helper\": \"A variable name is a symbolic name to reference information.\", \"validation\": \"regex:\/^(?:[A-Za-z])(?:[0-9A-Z_.a-z])*(? Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####\", \"validation\": null}}, {\"type\": \"FormInput\", \"field\": \"customCssSelector\", \"config\": {\"label\": \"CSS Selector Name\", \"helper\": \"Use this in your custom css rules\", \"validation\": \"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]\"}}, {\"type\": \"FormInput\", \"field\": \"ariaLabel\", \"config\": {\"label\": \"Aria Label\", \"helper\": \"Attribute designed to help assistive technology (e.g. screen readers) attach a label\"}}, {\"type\": \"FormInput\", \"field\": \"tabindex\", \"config\": {\"label\": \"Tab Order\", \"helper\": \"Order in which a user will move focus from one control to another by pressing the Tab key\", \"validation\": \"regex: [0-9]*\"}}], \"editor-control\": \"FormSubmit\", \"editor-component\": \"FormButton\"}], \"order\": 1}]","computed":"[]","custom_css":null,"created_at":"2024-09-07 20:06:42","updated_at":"2024-09-07 20:14:41","status":"ACTIVE","key":null,"watchers":"[]","translations":"{\"es\": {\"strings\": [], \"created_at\": \"2024-09-07T20:14:41.557954Z\", \"updated_at\": \"2024-09-07T20:14:41.557954Z\"}}","is_template":0,"asset_type":null},"extraAttributes":{"translatedLanguages":{"es":"Spanish"}},"references":{"uncategorized-category":true}},"9cf48515-0f41-4426-90bf-5c68b131bdfe":{"exporter":"ProcessMaker\\ImportExport\\Exporters\\ProcessLaunchpadExporter","type":"LaunchpadSetting","type_human":"Launchpad Setting","type_plural":"LaunchpadSettings","type_human_plural":"Launchpad Settings","last_modified_by":"","last_modified_by_id":null,"model":"ProcessMaker\\Models\\ProcessLaunchpad","force_password_protect":false,"hidden":false,"mode":"update","saveAssetsMode":"saveAllAssets","explicit_discard":false,"dependents":[{"type":"user","uuid":"9cea0b37-2e38-4422-9c3c-92825afa0c3b","meta":null,"exporterClass":"ProcessMaker\\ImportExport\\Exporters\\UserExporter","modelClass":"ProcessMaker\\Models\\User","fallbackMatches":{"email":"admin@processmaker.com","username":"admin"},"name":"","discard":false}],"name":"Setting","description":null,"process_manager":"","process_manager_id":null,"attributes":{"id":193,"uuid":"9cf48515-0f41-4426-90bf-5c68b131bdfe","process_id":631,"user_id":1,"properties":"{\"icon\": \"Default Icon\", \"tabs\": [], \"screen_id\": 0, \"icon_label\": \"Default Icon\", \"screen_uuid\": \"\", \"screen_title\": \"Default Launchpad\", \"saved_chart_id\": 0, \"saved_chart_title\": \"Default Launchpad Chart\"}","created_at":"2024-09-07 20:16:27","updated_at":"2024-09-07 20:16:27"},"extraAttributes":{"translatedLanguages":[]},"references":[]}}} From 5f71c25b257c50d6243a4674413c3c3e30e98e39 Mon Sep 17 00:00:00 2001 From: danloa Date: Mon, 9 Sep 2024 06:51:22 -0400 Subject: [PATCH 2/2] Add options file for importing in tests --- tests/Feature/Api/TranslationTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Feature/Api/TranslationTest.php b/tests/Feature/Api/TranslationTest.php index be162e2150..5c0301d5f7 100644 --- a/tests/Feature/Api/TranslationTest.php +++ b/tests/Feature/Api/TranslationTest.php @@ -28,6 +28,7 @@ public function testTranslationWithDefaultLanguage() $fileName = __DIR__ . '/../../Fixtures/translation_test.json'; $file = new UploadedFile($fileName, 'translation_test.json', null, null, true); Storage::putFileAs('import', $file, 'payload.json'); + Storage::put('import/options.json', '{}'); $hash = md5_file(Storage::path(ImportV2::FILE_PATH)); ImportV2::dispatchSync($this->user->id, null, $hash, false); @@ -98,6 +99,7 @@ public function testTranslationWithLanguageThatDoesNotHaveTranslation() $fileName = __DIR__ . '/../../Fixtures/translation_test.json'; $file = new UploadedFile($fileName, 'translation_test.json', null, null, true); Storage::putFileAs('import', $file, 'payload.json'); + Storage::put('import/options.json', '{}'); $hash = md5_file(Storage::path(ImportV2::FILE_PATH)); ImportV2::dispatchSync($this->user->id, null, $hash, false); @@ -138,6 +140,7 @@ public function testTranslationWithLanguageThatHasTranslation() $fileName = __DIR__ . '/../../Fixtures/translation_test.json'; $file = new UploadedFile($fileName, 'translation_test.json', null, null, true); Storage::putFileAs('import', $file, 'payload.json'); + Storage::put('import/options.json', '{}'); $hash = md5_file(Storage::path(ImportV2::FILE_PATH)); ImportV2::dispatchSync($this->user->id, null, $hash, false);