From b4fb6aa90f00bf94136787b5098b92ae0a49a82d Mon Sep 17 00:00:00 2001 From: David Carr Date: Sat, 16 Nov 2024 20:59:16 +0000 Subject: [PATCH 1/3] set config as the tag --- src/Commands/stubs/scaffold/provider.stub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/stubs/scaffold/provider.stub b/src/Commands/stubs/scaffold/provider.stub index 0a6e9a8a..c451e30a 100644 --- a/src/Commands/stubs/scaffold/provider.stub +++ b/src/Commands/stubs/scaffold/provider.stub @@ -90,7 +90,7 @@ class $CLASS$ extends ServiceProvider $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); $this->mergeConfigFrom($file->getPathname(), $key); } } From 9ce2574e7b8a63fa29443ac55f25ed9c27070948 Mon Sep 17 00:00:00 2001 From: David Carr Date: Sat, 16 Nov 2024 21:09:21 +0000 Subject: [PATCH 2/3] updated snapshots --- ...mespace_with_correct_generated_file__1.txt | 11 -- ...generated_correct_file_with_content__1.txt | 11 -- ...mespace_with_correct_generated_file__1.txt | 29 ---- ...generated_correct_file_with_content__1.txt | 29 ---- ...it_can_change_the_default_namespace__1.txt | 24 ---- ...ange_the_default_namespace_specific__1.txt | 24 ---- ...generated_correct_file_with_content__1.txt | 24 ---- ...mespace_with_correct_generated_file__1.txt | 11 -- ...generated_correct_file_with_content__1.txt | 11 -- ...it_can_change_the_default_namespace__1.txt | 56 -------- ...ange_the_default_namespace_specific__1.txt | 56 -------- ...generated_correct_file_with_content__1.txt | 56 -------- ...t_it_uses_set_command_name_in_class__1.txt | 56 -------- ...it_can_change_the_default_namespace__1.txt | 25 ---- ...generated_correct_file_with_content__1.txt | 25 ---- ...roller_to_class_name_if_not_present__1.txt | 65 --------- ...it_can_change_the_default_namespace__1.txt | 65 --------- ...ange_the_default_namespace_specific__1.txt | 65 --------- ...mespace_with_correct_generated_file__1.txt | 65 --------- ...generated_correct_file_with_content__1.txt | 65 --------- ...est_it_generates_a_plain_controller__1.txt | 9 -- ...test_it_generates_an_api_controller__1.txt | 59 -------- ...t_generates_an_invokable_controller__1.txt | 17 --- ...mespace_with_correct_generated_file__1.txt | 8 -- ...generated_correct_file_with_content__1.txt | 8 -- ...it_can_change_the_default_namespace__1.txt | 34 ----- ...ange_the_default_namespace_specific__1.txt | 34 ----- ...generated_correct_file_with_content__1.txt | 34 ----- ...generated_correct_file_with_content__1.txt | 30 ---- ...mespace_with_correct_generated_file__1.txt | 10 -- ...generated_correct_file_with_content__1.txt | 10 -- ...eCommandTest__test_it_makes_factory__1.txt | 22 --- ...mespace_with_correct_generated_file__1.txt | 11 -- ...generated_correct_file_with_content__1.txt | 11 -- ...mespace_with_correct_generated_file__1.txt | 8 -- ...generated_correct_file_with_content__1.txt | 8 -- ...it_can_change_the_default_namespace__1.txt | 30 ---- ...ange_the_default_namespace_specific__1.txt | 30 ---- ...generated_correct_file_with_content__1.txt | 30 ---- ..._correct_sync_job_file_with_content__1.txt | 27 ---- ...it_can_change_the_default_namespace__1.txt | 25 ---- ...ange_the_default_namespace_specific__1.txt | 25 ---- ...rect_queued_duck_event_with_content__1.txt | 27 ---- ...vent_in_a_subdirectory_with_content__1.txt | 28 ---- ...d_correct_queued_event_with_content__1.txt | 28 ---- ...orrect_sync_duck_event_with_content__1.txt | 25 ---- ...vent_in_a_subdirectory_with_content__1.txt | 26 ---- ...ted_correct_sync_event_with_content__1.txt | 26 ---- ...it_can_change_the_default_namespace__1.txt | 29 ---- ...ange_the_default_namespace_specific__1.txt | 29 ---- ...generated_correct_file_with_content__1.txt | 29 ---- ...it_can_change_the_default_namespace__1.txt | 17 --- ...ange_the_default_namespace_specific__1.txt | 17 --- ...generated_correct_file_with_content__1.txt | 17 --- ..._correct_add_migration_file_content__1.txt | 28 ---- ...rrect_create_migration_file_content__1.txt | 28 ---- ...rect_default_migration_file_content__1.txt | 24 ---- ...rrect_delete_migration_file_content__1.txt | 28 ---- ...correct_drop_migration_file_content__1.txt | 28 ---- ...t_generates_foreign_key_constraints__1.txt | 30 ---- ...it_can_change_the_default_namespace__1.txt | 22 --- ...ange_the_default_namespace_specific__1.txt | 22 --- ...generated_correct_file_with_content__1.txt | 22 --- ...gration_when_both_flags_are_present__1.txt | 65 --------- ...gration_when_both_flags_are_present__2.txt | 28 ---- ...enerates_controller_file_with_model__1.txt | 65 --------- ...le_with_model_using_shortcut_option__1.txt | 65 --------- ...t_generates_correct_fillable_fields__1.txt | 22 --- ...file_name_with_multiple_words_model__1.txt | 28 ---- ...generates_migration_file_with_model__1.txt | 28 ---- ...le_with_model_using_shortcut_option__1.txt | 28 ---- ...nable_and_route_provider_is_disable__1.txt | 135 ------------------ ...enable_and_route_provider_is_enable__1.txt | 135 ------------------ ...enable_and_route_provider_is_enable__2.txt | 50 ------- ...generates_api_module_with_resources__1.txt | 135 ------------------ ...generates_api_module_with_resources__2.txt | 59 -------- ...generates_api_module_with_resources__3.txt | 16 --- ...generates_api_module_with_resources__4.txt | 50 ------- ...t__test_it_generates_api_route_file__1.txt | 19 --- ...ith_multi_segment_default_namespace__1.txt | 19 --- ...generates_correct_composerjson_file__1.txt | 30 ---- ...est__test_it_generates_module_files__1.txt | 11 -- ..._module_namespace_using_studly_case__1.txt | 135 ------------------ ..._test_it_generates_module_resources__1.txt | 135 ------------------ ..._test_it_generates_module_resources__2.txt | 30 ---- ..._test_it_generates_module_resources__3.txt | 50 ------- ..._test_it_generates_module_resources__4.txt | 65 --------- ..._test_it_generates_module_resources__5.txt | 16 --- ...ndTest__test_it_generates_vite_file__1.txt | 57 -------- ...generates_web_module_with_resources__1.txt | 135 ------------------ ...generates_web_module_with_resources__2.txt | 65 --------- ...generates_web_module_with_resources__3.txt | 16 --- ...generates_web_module_with_resources__4.txt | 50 ------- ...es_when_adding_more_than_one_option__1.txt | 135 ------------------ ...es_when_adding_more_than_one_option__2.txt | 65 --------- ...es_when_adding_more_than_one_option__3.txt | 16 --- ...es_when_adding_more_than_one_option__4.txt | 50 ------- ...t__test_it_generates_web_route_file__1.txt | 19 --- ...ith_multi_segment_default_namespace__1.txt | 19 --- ...s_module_with_new_provider_location__1.txt | 11 -- ...s_module_with_new_provider_location__2.txt | 30 ---- ...it_can_change_the_default_namespace__1.txt | 48 ------- ...ange_the_default_namespace_specific__1.txt | 48 ------- ...generated_correct_file_with_content__1.txt | 48 ------- ...CommandTest__test_it_makes_observer__1.txt | 48 ------- ...it_can_change_the_default_namespace__1.txt | 18 --- ...ange_the_default_namespace_specific__1.txt | 18 --- ...keCommandTest__test_it_makes_policy__1.txt | 18 --- ...it_can_change_the_default_namespace__1.txt | 135 ------------------ ...ange_the_default_namespace_specific__1.txt | 135 ------------------ ..._migration_resources_location_paths__1.txt | 135 ------------------ ...generated_correct_file_with_content__1.txt | 24 ---- ...vice_provider_with_resource_loading__1.txt | 135 ------------------ ...mespace_with_correct_generated_file__1.txt | 11 -- ...generated_correct_file_with_content__1.txt | 11 -- ...it_can_change_the_default_namespace__1.txt | 26 ---- ...ange_the_default_namespace_specific__1.txt | 26 ---- ...generated_correct_file_with_content__1.txt | 26 ---- ...it_can_change_the_default_namespace__1.txt | 17 --- ...ange_the_default_namespace_specific__1.txt | 17 --- ...enerate_a_collection_resource_class__1.txt | 17 --- ...generated_correct_file_with_content__1.txt | 17 --- ...nge_the_custom_controller_namespace__1.txt | 50 ------- ...it_can_change_the_default_namespace__1.txt | 50 ------- ...ange_the_default_namespace_specific__1.txt | 50 ------- ...andTest__test_it_can_overwrite_file__1.txt | 50 ------- ...t_it_can_overwrite_route_file_names__1.txt | 50 ------- ...generated_correct_file_with_content__1.txt | 50 ------- ...it_can_change_the_default_namespace__1.txt | 17 --- ...ange_the_default_namespace_specific__1.txt | 17 --- ...ndTest__test_it_makes_implicit_rule__1.txt | 22 --- ...MakeCommandTest__test_it_makes_rule__1.txt | 17 --- ...mespace_with_correct_generated_file__1.txt | 18 --- ...generated_correct_file_with_content__1.txt | 18 --- ...mespace_with_correct_generated_file__1.txt | 11 -- ...generated_correct_file_with_content__1.txt | 11 -- ...hange_the_default_feature_namespace__1.txt | 18 --- ..._default_feature_namespace_specific__1.txt | 18 --- ...n_change_the_default_unit_namespace__1.txt | 16 --- ...the_default_unit_namespace_specific__1.txt | 16 --- ...d_correct_feature_file_with_content__1.txt | 18 --- ...ated_correct_unit_file_with_content__1.txt | 16 --- ...mespace_with_correct_generated_file__1.txt | 8 -- ...generated_correct_file_with_content__1.txt | 8 -- 144 files changed, 5397 deletions(-) delete mode 100644 tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_can_generate_a_cast_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ClassMakeCommandTest__test_it_can_generate_a_class_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ClassMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_uses_set_command_name_in_class__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ComponentClassMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ComponentClassMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_appends_controller_to_class_name_if_not_present__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_can_generate_a_controller_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_a_plain_controller__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_api_controller__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/EventMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/EventMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/EventMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/EventProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/FactoryMakeCommandTest__test_it_makes_factory__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/HelperMakeCommandTest__test_it_can_generate_a_helper_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/HelperMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/InterfaceMakeCommandTest__test_it_can_generate_a_interface_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/InterfaceMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_generated_correct_sync_job_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_queued_duck_event_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_queued_event_in_a_subdirectory_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_queued_event_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_sync_duck_event_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_sync_event_in_a_subdirectory_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_sync_event_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_add_migration_file_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_create_migration_file_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_delete_migration_file_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_drop_migration_file_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_and_migration_when_both_flags_are_present__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_and_migration_when_both_flags_are_present__2.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model_using_shortcut_option__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_correct_fillable_fields__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_correct_migration_file_name_with_multiple_words_model__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__5.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__3.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__3.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt delete mode 100644 tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/PolicyMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/PolicyMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/PolicyMakeCommandTest__test_it_makes_policy__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generates_a_master_service_provider_with_resource_loading__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RequestMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RequestMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RequestMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_can_generate_a_collection_resource_class__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_custom_controller_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_makes_implicit_rule__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_makes_rule__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ScopeMakeCommandTest__test_it_can_generate_a_scope_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ScopeMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ServiceMakeCommandTest__test_it_can_generate_a_service_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/ServiceMakeCommandTest__test_it_generated_correct_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt delete mode 100644 tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_generated_correct_file_with_content__1.txt diff --git a/tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt deleted file mode 100644 index b21fb56e..00000000 --- a/tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt +++ /dev/null @@ -1,11 +0,0 @@ - $attributes - */ - public function get(Model $model, string $key, mixed $value, array $attributes): mixed - { - return $value; - } - - /** - * Prepare the given value for storage. - * - * @param array $attributes - */ - public function set(Model $model, string $key, mixed $value, array $attributes): mixed - { - return $value; - } -} diff --git a/tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt deleted file mode 100644 index 05d8e3e3..00000000 --- a/tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt +++ /dev/null @@ -1,29 +0,0 @@ - $attributes - */ - public function get(Model $model, string $key, mixed $value, array $attributes): mixed - { - return $value; - } - - /** - * Prepare the given value for storage. - * - * @param array $attributes - */ - public function set(Model $model, string $key, mixed $value, array $attributes): mixed - { - return $value; - } -} diff --git a/tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt deleted file mode 100644 index 55d364bf..00000000 --- a/tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt +++ /dev/null @@ -1,24 +0,0 @@ -json([]); - } - - /** - * Store a newly created resource in storage. - */ - public function store(Request $request) - { - // - - return response()->json([]); - } - - /** - * Show the specified resource. - */ - public function show($id) - { - // - - return response()->json([]); - } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, $id) - { - // - - return response()->json([]); - } - - /** - * Remove the specified resource from storage. - */ - public function destroy($id) - { - // - - return response()->json([]); - } -} diff --git a/tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt b/tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt deleted file mode 100644 index 41a1b8ce..00000000 --- a/tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt +++ /dev/null @@ -1,17 +0,0 @@ -json([]); - } -} diff --git a/tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt deleted file mode 100644 index c9edb0b1..00000000 --- a/tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt +++ /dev/null @@ -1,8 +0,0 @@ -> - */ - protected $listen = []; - - /** - * Indicates if events should be discovered. - * - * @var bool - */ - protected static $shouldDiscoverEvents = true; - - /** - * Configure the proper event listeners for email verification. - */ - protected function configureEmailVerification(): void - { - // - } -} diff --git a/tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt deleted file mode 100644 index 4e24c9dc..00000000 --- a/tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt +++ /dev/null @@ -1,10 +0,0 @@ -view('view.name'); - } -} diff --git a/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt deleted file mode 100644 index 45f802ff..00000000 --- a/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt +++ /dev/null @@ -1,29 +0,0 @@ -view('view.name'); - } -} diff --git a/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt deleted file mode 100644 index 5bee369e..00000000 --- a/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt +++ /dev/null @@ -1,29 +0,0 @@ -view('view.name'); - } -} diff --git a/tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt deleted file mode 100644 index e8b58675..00000000 --- a/tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt +++ /dev/null @@ -1,17 +0,0 @@ -id(); - - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('posts'); - } -}; diff --git a/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt b/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt deleted file mode 100644 index 88fa2f36..00000000 --- a/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt +++ /dev/null @@ -1,24 +0,0 @@ -id(); - - $table->timestamps(); - }); - } -}; diff --git a/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt b/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt deleted file mode 100644 index 6546dae4..00000000 --- a/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt +++ /dev/null @@ -1,30 +0,0 @@ -id(); - $table->integer('user_id')->unsigned(); - $table->foreign('user_id')->references('id')->on('users'); - - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('posts'); - } -}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt deleted file mode 100644 index 7355e76a..00000000 --- a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt +++ /dev/null @@ -1,22 +0,0 @@ -id(); - - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('posts'); - } -}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt deleted file mode 100644 index 3a09e23c..00000000 --- a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt +++ /dev/null @@ -1,65 +0,0 @@ -id(); - - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('product_details'); - } -}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt deleted file mode 100644 index 36dc20e8..00000000 --- a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt +++ /dev/null @@ -1,28 +0,0 @@ -id(); - - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('posts'); - } -}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt deleted file mode 100644 index 36dc20e8..00000000 --- a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt +++ /dev/null @@ -1,28 +0,0 @@ -id(); - - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('posts'); - } -}; diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt deleted file mode 100644 index 502378c6..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - // $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt deleted file mode 100644 index fd27431f..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt deleted file mode 100644 index 650b2838..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt deleted file mode 100644 index fd27431f..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt deleted file mode 100644 index bc3afb92..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt +++ /dev/null @@ -1,59 +0,0 @@ -json([]); - } - - /** - * Store a newly created resource in storage. - */ - public function store(Request $request) - { - // - - return response()->json([]); - } - - /** - * Show the specified resource. - */ - public function show($id) - { - // - - return response()->json([]); - } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, $id) - { - // - - return response()->json([]); - } - - /** - * Remove the specified resource from storage. - */ - public function destroy($id) - { - // - - return response()->json([]); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt deleted file mode 100644 index 97e7e2a4..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt +++ /dev/null @@ -1,16 +0,0 @@ -call([]); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt deleted file mode 100644 index 650b2838..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt deleted file mode 100644 index cbdf7602..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt +++ /dev/null @@ -1,19 +0,0 @@ -prefix('v1')->group(function () { - Route::apiResource('blog', BlogController::class)->names('blog'); -}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt deleted file mode 100644 index f063f6cb..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt +++ /dev/null @@ -1,19 +0,0 @@ -prefix('v1')->group(function () { - Route::apiResource('blog', BlogController::class)->names('blog'); -}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt deleted file mode 100644 index 746cae73..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "nwidart/blog", - "description": "", - "authors": [ - { - "name": "Nicolas Widart", - "email": "n.widart@gmail.com" - } - ], - "extra": { - "laravel": { - "providers": [], - "aliases": { - - } - } - }, - "autoload": { - "psr-4": { - "Modules\\Blog\\": "app/", - "Modules\\Blog\\Database\\Factories\\": "database/factories/", - "Modules\\Blog\\Database\\Seeders\\": "database/seeders/" - } - }, - "autoload-dev": { - "psr-4": { - "Modules\\Blog\\Tests\\": "tests/" - } - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt deleted file mode 100644 index 92e3b450..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Blog", - "alias": "blog", - "description": "", - "keywords": [], - "priority": 0, - "providers": [ - "Modules\\Blog\\Providers\\BlogServiceProvider" - ], - "files": [] -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt deleted file mode 100644 index 624b86d2..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt deleted file mode 100644 index fd27431f..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt deleted file mode 100644 index 5f466848..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt +++ /dev/null @@ -1,30 +0,0 @@ -> - */ - protected $listen = []; - - /** - * Indicates if events should be discovered. - * - * @var bool - */ - protected static $shouldDiscoverEvents = true; - - /** - * Configure the proper event listeners for email verification. - */ - protected function configureEmailVerification(): void - { - // - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt deleted file mode 100644 index 650b2838..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt deleted file mode 100644 index 21acf68c..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt +++ /dev/null @@ -1,65 +0,0 @@ -call([]); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt deleted file mode 100644 index 0dd60664..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt +++ /dev/null @@ -1,57 +0,0 @@ -import { defineConfig } from 'vite'; -import laravel from 'laravel-vite-plugin'; -import { readdirSync, statSync } from 'fs'; -import { join,relative,dirname } from 'path'; -import { fileURLToPath } from 'url'; - -export default defineConfig({ - build: { - outDir: '../../public/build-blog', - emptyOutDir: true, - manifest: true, - }, - plugins: [ - laravel({ - publicDirectory: '../../public', - buildDirectory: 'build-blog', - input: [ - __dirname + '/resources/assets/sass/app.scss', - __dirname + '/resources/assets/js/app.js' - ], - refresh: true, - }), - ], -}); -// Scen all resources for assets file. Return array -//function getFilePaths(dir) { -// const filePaths = []; -// -// function walkDirectory(currentPath) { -// const files = readdirSync(currentPath); -// for (const file of files) { -// const filePath = join(currentPath, file); -// const stats = statSync(filePath); -// if (stats.isFile() && !file.startsWith('.')) { -// const relativePath = 'Modules/Blog/'+relative(__dirname, filePath); -// filePaths.push(relativePath); -// } else if (stats.isDirectory()) { -// walkDirectory(filePath); -// } -// } -// } -// -// walkDirectory(dir); -// return filePaths; -//} - -//const __filename = fileURLToPath(import.meta.url); -//const __dirname = dirname(__filename); - -//const assetsDir = join(__dirname, 'resources/assets'); -//export const paths = getFilePaths(assetsDir); - - -//export const paths = [ -// 'Modules/Blog/resources/assets/sass/app.scss', -// 'Modules/Blog/resources/assets/js/app.js', -//]; diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt deleted file mode 100644 index fd27431f..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt deleted file mode 100644 index 21acf68c..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt +++ /dev/null @@ -1,65 +0,0 @@ -call([]); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt deleted file mode 100644 index 650b2838..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt deleted file mode 100644 index fd27431f..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt deleted file mode 100644 index 21acf68c..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt +++ /dev/null @@ -1,65 +0,0 @@ -call([]); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt deleted file mode 100644 index 650b2838..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt deleted file mode 100644 index 082efd6d..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt +++ /dev/null @@ -1,19 +0,0 @@ -names('blog'); -}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt deleted file mode 100644 index ee8df69c..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt +++ /dev/null @@ -1,19 +0,0 @@ -names('blog'); -}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt deleted file mode 100644 index c59f2695..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Blog", - "alias": "blog", - "description": "", - "keywords": [], - "priority": 0, - "providers": [ - "Modules\\Blog\\Base\\Providers\\BlogServiceProvider" - ], - "files": [] -} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt deleted file mode 100644 index 746cae73..00000000 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "nwidart/blog", - "description": "", - "authors": [ - { - "name": "Nicolas Widart", - "email": "n.widart@gmail.com" - } - ], - "extra": { - "laravel": { - "providers": [], - "aliases": { - - } - } - }, - "autoload": { - "psr-4": { - "Modules\\Blog\\": "app/", - "Modules\\Blog\\Database\\Factories\\": "database/factories/", - "Modules\\Blog\\Database\\Seeders\\": "database/seeders/" - } - }, - "autoload-dev": { - "psr-4": { - "Modules\\Blog\\Tests\\": "tests/" - } - } -} diff --git a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt deleted file mode 100644 index 4fb9ff31..00000000 --- a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt +++ /dev/null @@ -1,48 +0,0 @@ -line('The introduction to the notification.') - ->action('Notification Action', 'https://laravel.com') - ->line('Thank you for using our application!'); - } - - /** - * Get the array representation of the notification. - */ - public function toArray($notifiable): array - { - return []; - } -} diff --git a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt deleted file mode 100644 index 4fb9ff31..00000000 --- a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt +++ /dev/null @@ -1,48 +0,0 @@ -line('The introduction to the notification.') - ->action('Notification Action', 'https://laravel.com') - ->line('Thank you for using our application!'); - } - - /** - * Get the array representation of the notification. - */ - public function toArray($notifiable): array - { - return []; - } -} diff --git a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt deleted file mode 100644 index 53e7ab76..00000000 --- a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt +++ /dev/null @@ -1,48 +0,0 @@ -line('The introduction to the notification.') - ->action('Notification Action', 'https://laravel.com') - ->line('Thank you for using our application!'); - } - - /** - * Get the array representation of the notification. - */ - public function toArray($notifiable): array - { - return []; - } -} diff --git a/tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt b/tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt deleted file mode 100644 index f2b38c90..00000000 --- a/tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt +++ /dev/null @@ -1,48 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt deleted file mode 100644 index e13cd1f6..00000000 --- a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt deleted file mode 100644 index 705d88db..00000000 --- a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt +++ /dev/null @@ -1,135 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt deleted file mode 100644 index 922456f3..00000000 --- a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt +++ /dev/null @@ -1,24 +0,0 @@ -registerCommands(); - $this->registerCommandSchedules(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); - } - - /** - * Register the service provider. - */ - public function register(): void - { - $this->app->register(EventServiceProvider::class); - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register commands in the format of Command::class - */ - protected function registerCommands(): void - { - // $this->commands([]); - } - - /** - * Register command Schedules. - */ - protected function registerCommandSchedules(): void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } - - /** - * Register translations. - */ - public function registerTranslations(): void - { - $langPath = resource_path('lang/modules/'.$this->nameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->nameLower); - $this->loadJsonTranslationsFrom($langPath); - } else { - $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); - $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); - } - } - - /** - * Register config. - */ - protected function registerConfig(): void - { - $relativeConfigPath = config('modules.paths.generator.config.path'); - $configPath = module_path($this->name, $relativeConfigPath); - - if (is_dir($configPath)) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); - - foreach ($iterator as $file) { - if ($file->isFile() && $file->getExtension() === 'php') { - $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); - $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); - $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; - - $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); - $this->mergeConfigFrom($file->getPathname(), $key); - } - } - } - } - - /** - * Register views. - */ - public function registerViews(): void - { - $viewPath = resource_path('views/modules/'.$this->nameLower); - $sourcePath = module_path($this->name, 'resources/views'); - - $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - - $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->nameLower); - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->nameLower)) { - $paths[] = $path.'/modules/'.$this->nameLower; - } - } - - return $paths; - } -} diff --git a/tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt deleted file mode 100644 index 6ddffc7b..00000000 --- a/tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt +++ /dev/null @@ -1,11 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt deleted file mode 100644 index 43a25d37..00000000 --- a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt deleted file mode 100644 index 43a25d37..00000000 --- a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt deleted file mode 100644 index 9b80aa3d..00000000 --- a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/SuperRoutes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt deleted file mode 100644 index fe4cb9a8..00000000 --- a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/SuperRoutes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/SuperRoutes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt deleted file mode 100644 index 650b2838..00000000 --- a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt +++ /dev/null @@ -1,50 +0,0 @@ -mapApiRoutes(); - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - */ - protected function mapWebRoutes(): void - { - Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - */ - protected function mapApiRoutes(): void - { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); - } -} diff --git a/tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt deleted file mode 100644 index 23757e05..00000000 --- a/tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt +++ /dev/null @@ -1,17 +0,0 @@ -get('/'); - - $response->assertStatus(200); - } -} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt deleted file mode 100644 index 3986e14b..00000000 --- a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt +++ /dev/null @@ -1,18 +0,0 @@ -get('/'); - - $response->assertStatus(200); - } -} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt deleted file mode 100644 index ae35f4fe..00000000 --- a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt +++ /dev/null @@ -1,16 +0,0 @@ -assertTrue(true); - } -} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt deleted file mode 100644 index d6cc1988..00000000 --- a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt +++ /dev/null @@ -1,16 +0,0 @@ -assertTrue(true); - } -} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt deleted file mode 100644 index f5907115..00000000 --- a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt +++ /dev/null @@ -1,18 +0,0 @@ -get('/'); - - $response->assertStatus(200); - } -} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt deleted file mode 100644 index d6cc1988..00000000 --- a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt +++ /dev/null @@ -1,16 +0,0 @@ -assertTrue(true); - } -} diff --git a/tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt deleted file mode 100644 index 81f87fd9..00000000 --- a/tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt +++ /dev/null @@ -1,8 +0,0 @@ - Date: Sat, 16 Nov 2024 21:09:36 +0000 Subject: [PATCH 3/3] updated snapshots --- ...mespace_with_correct_generated_file__1.txt | 11 ++ ...generated_correct_file_with_content__1.txt | 11 ++ ...mespace_with_correct_generated_file__1.txt | 29 ++++ ...generated_correct_file_with_content__1.txt | 29 ++++ ...it_can_change_the_default_namespace__1.txt | 24 ++++ ...ange_the_default_namespace_specific__1.txt | 24 ++++ ...generated_correct_file_with_content__1.txt | 24 ++++ ...mespace_with_correct_generated_file__1.txt | 11 ++ ...generated_correct_file_with_content__1.txt | 11 ++ ...it_can_change_the_default_namespace__1.txt | 56 ++++++++ ...ange_the_default_namespace_specific__1.txt | 56 ++++++++ ...generated_correct_file_with_content__1.txt | 56 ++++++++ ...t_it_uses_set_command_name_in_class__1.txt | 56 ++++++++ ...it_can_change_the_default_namespace__1.txt | 25 ++++ ...generated_correct_file_with_content__1.txt | 25 ++++ ...roller_to_class_name_if_not_present__1.txt | 65 +++++++++ ...it_can_change_the_default_namespace__1.txt | 65 +++++++++ ...ange_the_default_namespace_specific__1.txt | 65 +++++++++ ...mespace_with_correct_generated_file__1.txt | 65 +++++++++ ...generated_correct_file_with_content__1.txt | 65 +++++++++ ...est_it_generates_a_plain_controller__1.txt | 9 ++ ...test_it_generates_an_api_controller__1.txt | 59 ++++++++ ...t_generates_an_invokable_controller__1.txt | 17 +++ ...mespace_with_correct_generated_file__1.txt | 8 ++ ...generated_correct_file_with_content__1.txt | 8 ++ ...it_can_change_the_default_namespace__1.txt | 34 +++++ ...ange_the_default_namespace_specific__1.txt | 34 +++++ ...generated_correct_file_with_content__1.txt | 34 +++++ ...generated_correct_file_with_content__1.txt | 30 ++++ ...mespace_with_correct_generated_file__1.txt | 10 ++ ...generated_correct_file_with_content__1.txt | 10 ++ ...eCommandTest__test_it_makes_factory__1.txt | 22 +++ ...mespace_with_correct_generated_file__1.txt | 11 ++ ...generated_correct_file_with_content__1.txt | 11 ++ ...mespace_with_correct_generated_file__1.txt | 8 ++ ...generated_correct_file_with_content__1.txt | 8 ++ ...it_can_change_the_default_namespace__1.txt | 30 ++++ ...ange_the_default_namespace_specific__1.txt | 30 ++++ ...generated_correct_file_with_content__1.txt | 30 ++++ ..._correct_sync_job_file_with_content__1.txt | 27 ++++ ...it_can_change_the_default_namespace__1.txt | 25 ++++ ...ange_the_default_namespace_specific__1.txt | 25 ++++ ...rect_queued_duck_event_with_content__1.txt | 27 ++++ ...vent_in_a_subdirectory_with_content__1.txt | 28 ++++ ...d_correct_queued_event_with_content__1.txt | 28 ++++ ...orrect_sync_duck_event_with_content__1.txt | 25 ++++ ...vent_in_a_subdirectory_with_content__1.txt | 26 ++++ ...ted_correct_sync_event_with_content__1.txt | 26 ++++ ...it_can_change_the_default_namespace__1.txt | 29 ++++ ...ange_the_default_namespace_specific__1.txt | 29 ++++ ...generated_correct_file_with_content__1.txt | 29 ++++ ...it_can_change_the_default_namespace__1.txt | 17 +++ ...ange_the_default_namespace_specific__1.txt | 17 +++ ...generated_correct_file_with_content__1.txt | 17 +++ ..._correct_add_migration_file_content__1.txt | 28 ++++ ...rrect_create_migration_file_content__1.txt | 28 ++++ ...rect_default_migration_file_content__1.txt | 24 ++++ ...rrect_delete_migration_file_content__1.txt | 28 ++++ ...correct_drop_migration_file_content__1.txt | 28 ++++ ...t_generates_foreign_key_constraints__1.txt | 30 ++++ ...it_can_change_the_default_namespace__1.txt | 22 +++ ...ange_the_default_namespace_specific__1.txt | 22 +++ ...generated_correct_file_with_content__1.txt | 22 +++ ...gration_when_both_flags_are_present__1.txt | 65 +++++++++ ...gration_when_both_flags_are_present__2.txt | 28 ++++ ...enerates_controller_file_with_model__1.txt | 65 +++++++++ ...le_with_model_using_shortcut_option__1.txt | 65 +++++++++ ...t_generates_correct_fillable_fields__1.txt | 22 +++ ...file_name_with_multiple_words_model__1.txt | 28 ++++ ...generates_migration_file_with_model__1.txt | 28 ++++ ...le_with_model_using_shortcut_option__1.txt | 28 ++++ ...nable_and_route_provider_is_disable__1.txt | 135 ++++++++++++++++++ ...enable_and_route_provider_is_enable__1.txt | 135 ++++++++++++++++++ ...enable_and_route_provider_is_enable__2.txt | 50 +++++++ ...generates_api_module_with_resources__1.txt | 135 ++++++++++++++++++ ...generates_api_module_with_resources__2.txt | 59 ++++++++ ...generates_api_module_with_resources__3.txt | 16 +++ ...generates_api_module_with_resources__4.txt | 50 +++++++ ...t__test_it_generates_api_route_file__1.txt | 19 +++ ...ith_multi_segment_default_namespace__1.txt | 19 +++ ...generates_correct_composerjson_file__1.txt | 30 ++++ ...est__test_it_generates_module_files__1.txt | 11 ++ ..._module_namespace_using_studly_case__1.txt | 135 ++++++++++++++++++ ..._test_it_generates_module_resources__1.txt | 135 ++++++++++++++++++ ..._test_it_generates_module_resources__2.txt | 30 ++++ ..._test_it_generates_module_resources__3.txt | 50 +++++++ ..._test_it_generates_module_resources__4.txt | 65 +++++++++ ..._test_it_generates_module_resources__5.txt | 16 +++ ...ndTest__test_it_generates_vite_file__1.txt | 57 ++++++++ ...generates_web_module_with_resources__1.txt | 135 ++++++++++++++++++ ...generates_web_module_with_resources__2.txt | 65 +++++++++ ...generates_web_module_with_resources__3.txt | 16 +++ ...generates_web_module_with_resources__4.txt | 50 +++++++ ...es_when_adding_more_than_one_option__1.txt | 135 ++++++++++++++++++ ...es_when_adding_more_than_one_option__2.txt | 65 +++++++++ ...es_when_adding_more_than_one_option__3.txt | 16 +++ ...es_when_adding_more_than_one_option__4.txt | 50 +++++++ ...t__test_it_generates_web_route_file__1.txt | 19 +++ ...ith_multi_segment_default_namespace__1.txt | 19 +++ ...s_module_with_new_provider_location__1.txt | 11 ++ ...s_module_with_new_provider_location__2.txt | 30 ++++ ...it_can_change_the_default_namespace__1.txt | 48 +++++++ ...ange_the_default_namespace_specific__1.txt | 48 +++++++ ...generated_correct_file_with_content__1.txt | 48 +++++++ ...CommandTest__test_it_makes_observer__1.txt | 48 +++++++ ...it_can_change_the_default_namespace__1.txt | 18 +++ ...ange_the_default_namespace_specific__1.txt | 18 +++ ...keCommandTest__test_it_makes_policy__1.txt | 18 +++ ...it_can_change_the_default_namespace__1.txt | 135 ++++++++++++++++++ ...ange_the_default_namespace_specific__1.txt | 135 ++++++++++++++++++ ..._migration_resources_location_paths__1.txt | 135 ++++++++++++++++++ ...generated_correct_file_with_content__1.txt | 24 ++++ ...vice_provider_with_resource_loading__1.txt | 135 ++++++++++++++++++ ...mespace_with_correct_generated_file__1.txt | 11 ++ ...generated_correct_file_with_content__1.txt | 11 ++ ...it_can_change_the_default_namespace__1.txt | 26 ++++ ...ange_the_default_namespace_specific__1.txt | 26 ++++ ...generated_correct_file_with_content__1.txt | 26 ++++ ...it_can_change_the_default_namespace__1.txt | 17 +++ ...ange_the_default_namespace_specific__1.txt | 17 +++ ...enerate_a_collection_resource_class__1.txt | 17 +++ ...generated_correct_file_with_content__1.txt | 17 +++ ...nge_the_custom_controller_namespace__1.txt | 50 +++++++ ...it_can_change_the_default_namespace__1.txt | 50 +++++++ ...ange_the_default_namespace_specific__1.txt | 50 +++++++ ...andTest__test_it_can_overwrite_file__1.txt | 50 +++++++ ...t_it_can_overwrite_route_file_names__1.txt | 50 +++++++ ...generated_correct_file_with_content__1.txt | 50 +++++++ ...it_can_change_the_default_namespace__1.txt | 17 +++ ...ange_the_default_namespace_specific__1.txt | 17 +++ ...ndTest__test_it_makes_implicit_rule__1.txt | 22 +++ ...MakeCommandTest__test_it_makes_rule__1.txt | 17 +++ ...mespace_with_correct_generated_file__1.txt | 18 +++ ...generated_correct_file_with_content__1.txt | 18 +++ ...mespace_with_correct_generated_file__1.txt | 11 ++ ...generated_correct_file_with_content__1.txt | 11 ++ ...hange_the_default_feature_namespace__1.txt | 18 +++ ..._default_feature_namespace_specific__1.txt | 18 +++ ...n_change_the_default_unit_namespace__1.txt | 16 +++ ...the_default_unit_namespace_specific__1.txt | 16 +++ ...d_correct_feature_file_with_content__1.txt | 18 +++ ...ated_correct_unit_file_with_content__1.txt | 16 +++ ...mespace_with_correct_generated_file__1.txt | 8 ++ ...generated_correct_file_with_content__1.txt | 8 ++ 144 files changed, 5397 insertions(+) create mode 100644 tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_can_generate_a_cast_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ClassMakeCommandTest__test_it_can_generate_a_class_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ClassMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/CommandMakeCommandTest__test_it_uses_set_command_name_in_class__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ComponentClassMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ComponentClassMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_appends_controller_to_class_name_if_not_present__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_can_generate_a_controller_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_a_plain_controller__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_api_controller__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt create mode 100644 tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/EventMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/EventMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/EventMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/EventProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/FactoryMakeCommandTest__test_it_makes_factory__1.txt create mode 100644 tests/Commands/Make/__snapshots__/HelperMakeCommandTest__test_it_can_generate_a_helper_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/HelperMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/InterfaceMakeCommandTest__test_it_can_generate_a_interface_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/InterfaceMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/JobMakeCommandTest__test_it_generated_correct_sync_job_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_queued_duck_event_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_queued_event_in_a_subdirectory_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_queued_event_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_sync_duck_event_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_sync_event_in_a_subdirectory_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ListenerMakeCommandTest__test_it_generated_correct_sync_event_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_add_migration_file_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_create_migration_file_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_delete_migration_file_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_drop_migration_file_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_and_migration_when_both_flags_are_present__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_and_migration_when_both_flags_are_present__2.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model_using_shortcut_option__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_correct_fillable_fields__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_correct_migration_file_name_with_multiple_words_model__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__5.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__3.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__3.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt create mode 100644 tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt create mode 100644 tests/Commands/Make/__snapshots__/PolicyMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/PolicyMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/PolicyMakeCommandTest__test_it_makes_policy__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generates_a_master_service_provider_with_resource_loading__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RequestMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RequestMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RequestMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_can_generate_a_collection_resource_class__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ResourceMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_custom_controller_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_makes_implicit_rule__1.txt create mode 100644 tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_makes_rule__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ScopeMakeCommandTest__test_it_can_generate_a_scope_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ScopeMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ServiceMakeCommandTest__test_it_can_generate_a_service_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/ServiceMakeCommandTest__test_it_generated_correct_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt create mode 100644 tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_generated_correct_file_with_content__1.txt diff --git a/tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt new file mode 100644 index 00000000..b21fb56e --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ActionMakeCommandTest__test_it_can_generate_a_action_in_sub_namespace_with_correct_generated_file__1.txt @@ -0,0 +1,11 @@ + $attributes + */ + public function get(Model $model, string $key, mixed $value, array $attributes): mixed + { + return $value; + } + + /** + * Prepare the given value for storage. + * + * @param array $attributes + */ + public function set(Model $model, string $key, mixed $value, array $attributes): mixed + { + return $value; + } +} diff --git a/tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt new file mode 100644 index 00000000..05d8e3e3 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/CastMakeCommandTest__test_it_generated_correct_file_with_content__1.txt @@ -0,0 +1,29 @@ + $attributes + */ + public function get(Model $model, string $key, mixed $value, array $attributes): mixed + { + return $value; + } + + /** + * Prepare the given value for storage. + * + * @param array $attributes + */ + public function set(Model $model, string $key, mixed $value, array $attributes): mixed + { + return $value; + } +} diff --git a/tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt new file mode 100644 index 00000000..55d364bf --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ChannelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt @@ -0,0 +1,24 @@ +json([]); + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request) + { + // + + return response()->json([]); + } + + /** + * Show the specified resource. + */ + public function show($id) + { + // + + return response()->json([]); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id) + { + // + + return response()->json([]); + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + // + + return response()->json([]); + } +} diff --git a/tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt b/tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt new file mode 100644 index 00000000..41a1b8ce --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ControllerMakeCommandTest__test_it_generates_an_invokable_controller__1.txt @@ -0,0 +1,17 @@ +json([]); + } +} diff --git a/tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt new file mode 100644 index 00000000..c9edb0b1 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/EnumMakeCommandTest__test_it_can_generate_a_enum_in_sub_namespace_with_correct_generated_file__1.txt @@ -0,0 +1,8 @@ +> + */ + protected $listen = []; + + /** + * Indicates if events should be discovered. + * + * @var bool + */ + protected static $shouldDiscoverEvents = true; + + /** + * Configure the proper event listeners for email verification. + */ + protected function configureEmailVerification(): void + { + // + } +} diff --git a/tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt new file mode 100644 index 00000000..4e24c9dc --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ExceptionMakeCommandTest__test_it_can_generate_a_exception_in_sub_namespace_with_correct_generated_file__1.txt @@ -0,0 +1,10 @@ +view('view.name'); + } +} diff --git a/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt new file mode 100644 index 00000000..45f802ff --- /dev/null +++ b/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt @@ -0,0 +1,29 @@ +view('view.name'); + } +} diff --git a/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt new file mode 100644 index 00000000..5bee369e --- /dev/null +++ b/tests/Commands/Make/__snapshots__/MailMakeCommandTest__test_it_generated_correct_file_with_content__1.txt @@ -0,0 +1,29 @@ +view('view.name'); + } +} diff --git a/tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt new file mode 100644 index 00000000..e8b58675 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/MiddlewareMakeCommandTest__test_it_can_change_the_default_namespace__1.txt @@ -0,0 +1,17 @@ +id(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('posts'); + } +}; diff --git a/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt b/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt new file mode 100644 index 00000000..88fa2f36 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_correct_default_migration_file_content__1.txt @@ -0,0 +1,24 @@ +id(); + + $table->timestamps(); + }); + } +}; diff --git a/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt b/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt new file mode 100644 index 00000000..6546dae4 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/MigrationMakeCommandTest__test_it_generates_foreign_key_constraints__1.txt @@ -0,0 +1,30 @@ +id(); + $table->integer('user_id')->unsigned(); + $table->foreign('user_id')->references('id')->on('users'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('posts'); + } +}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt new file mode 100644 index 00000000..7355e76a --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_can_change_the_default_namespace__1.txt @@ -0,0 +1,22 @@ +id(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('posts'); + } +}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt new file mode 100644 index 00000000..3a09e23c --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_controller_file_with_model__1.txt @@ -0,0 +1,65 @@ +id(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('product_details'); + } +}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt new file mode 100644 index 00000000..36dc20e8 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model__1.txt @@ -0,0 +1,28 @@ +id(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('posts'); + } +}; diff --git a/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt new file mode 100644 index 00000000..36dc20e8 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModelMakeCommandTest__test_it_generates_migration_file_with_model_using_shortcut_option__1.txt @@ -0,0 +1,28 @@ +id(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('posts'); + } +}; diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt new file mode 100644 index 00000000..7ad790eb --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + // $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt new file mode 100644 index 00000000..1823f4c3 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt new file mode 100644 index 00000000..650b2838 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__2.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt new file mode 100644 index 00000000..1823f4c3 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt new file mode 100644 index 00000000..bc3afb92 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__2.txt @@ -0,0 +1,59 @@ +json([]); + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request) + { + // + + return response()->json([]); + } + + /** + * Show the specified resource. + */ + public function show($id) + { + // + + return response()->json([]); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id) + { + // + + return response()->json([]); + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + // + + return response()->json([]); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt new file mode 100644 index 00000000..97e7e2a4 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__3.txt @@ -0,0 +1,16 @@ +call([]); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt new file mode 100644 index 00000000..650b2838 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__4.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt new file mode 100644 index 00000000..cbdf7602 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file__1.txt @@ -0,0 +1,19 @@ +prefix('v1')->group(function () { + Route::apiResource('blog', BlogController::class)->names('blog'); +}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt new file mode 100644 index 00000000..f063f6cb --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_route_file_with_multi_segment_default_namespace__1.txt @@ -0,0 +1,19 @@ +prefix('v1')->group(function () { + Route::apiResource('blog', BlogController::class)->names('blog'); +}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt new file mode 100644 index 00000000..746cae73 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_correct_composerjson_file__1.txt @@ -0,0 +1,30 @@ +{ + "name": "nwidart/blog", + "description": "", + "authors": [ + { + "name": "Nicolas Widart", + "email": "n.widart@gmail.com" + } + ], + "extra": { + "laravel": { + "providers": [], + "aliases": { + + } + } + }, + "autoload": { + "psr-4": { + "Modules\\Blog\\": "app/", + "Modules\\Blog\\Database\\Factories\\": "database/factories/", + "Modules\\Blog\\Database\\Seeders\\": "database/seeders/" + } + }, + "autoload-dev": { + "psr-4": { + "Modules\\Blog\\Tests\\": "tests/" + } + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt new file mode 100644 index 00000000..92e3b450 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_files__1.txt @@ -0,0 +1,11 @@ +{ + "name": "Blog", + "alias": "blog", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\Blog\\Providers\\BlogServiceProvider" + ], + "files": [] +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt new file mode 100644 index 00000000..d0f0fa75 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt new file mode 100644 index 00000000..1823f4c3 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt new file mode 100644 index 00000000..5f466848 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__2.txt @@ -0,0 +1,30 @@ +> + */ + protected $listen = []; + + /** + * Indicates if events should be discovered. + * + * @var bool + */ + protected static $shouldDiscoverEvents = true; + + /** + * Configure the proper event listeners for email verification. + */ + protected function configureEmailVerification(): void + { + // + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt new file mode 100644 index 00000000..650b2838 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__3.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt new file mode 100644 index 00000000..21acf68c --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__4.txt @@ -0,0 +1,65 @@ +call([]); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt new file mode 100644 index 00000000..0dd60664 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_vite_file__1.txt @@ -0,0 +1,57 @@ +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; +import { readdirSync, statSync } from 'fs'; +import { join,relative,dirname } from 'path'; +import { fileURLToPath } from 'url'; + +export default defineConfig({ + build: { + outDir: '../../public/build-blog', + emptyOutDir: true, + manifest: true, + }, + plugins: [ + laravel({ + publicDirectory: '../../public', + buildDirectory: 'build-blog', + input: [ + __dirname + '/resources/assets/sass/app.scss', + __dirname + '/resources/assets/js/app.js' + ], + refresh: true, + }), + ], +}); +// Scen all resources for assets file. Return array +//function getFilePaths(dir) { +// const filePaths = []; +// +// function walkDirectory(currentPath) { +// const files = readdirSync(currentPath); +// for (const file of files) { +// const filePath = join(currentPath, file); +// const stats = statSync(filePath); +// if (stats.isFile() && !file.startsWith('.')) { +// const relativePath = 'Modules/Blog/'+relative(__dirname, filePath); +// filePaths.push(relativePath); +// } else if (stats.isDirectory()) { +// walkDirectory(filePath); +// } +// } +// } +// +// walkDirectory(dir); +// return filePaths; +//} + +//const __filename = fileURLToPath(import.meta.url); +//const __dirname = dirname(__filename); + +//const assetsDir = join(__dirname, 'resources/assets'); +//export const paths = getFilePaths(assetsDir); + + +//export const paths = [ +// 'Modules/Blog/resources/assets/sass/app.scss', +// 'Modules/Blog/resources/assets/js/app.js', +//]; diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt new file mode 100644 index 00000000..1823f4c3 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt new file mode 100644 index 00000000..21acf68c --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__2.txt @@ -0,0 +1,65 @@ +call([]); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt new file mode 100644 index 00000000..650b2838 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__4.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt new file mode 100644 index 00000000..1823f4c3 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt new file mode 100644 index 00000000..21acf68c --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__2.txt @@ -0,0 +1,65 @@ +call([]); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt new file mode 100644 index 00000000..650b2838 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__4.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt new file mode 100644 index 00000000..082efd6d --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file__1.txt @@ -0,0 +1,19 @@ +names('blog'); +}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt new file mode 100644 index 00000000..ee8df69c --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_route_file_with_multi_segment_default_namespace__1.txt @@ -0,0 +1,19 @@ +names('blog'); +}); diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt new file mode 100644 index 00000000..c59f2695 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__1.txt @@ -0,0 +1,11 @@ +{ + "name": "Blog", + "alias": "blog", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\Blog\\Base\\Providers\\BlogServiceProvider" + ], + "files": [] +} diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt new file mode 100644 index 00000000..746cae73 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generes_module_with_new_provider_location__2.txt @@ -0,0 +1,30 @@ +{ + "name": "nwidart/blog", + "description": "", + "authors": [ + { + "name": "Nicolas Widart", + "email": "n.widart@gmail.com" + } + ], + "extra": { + "laravel": { + "providers": [], + "aliases": { + + } + } + }, + "autoload": { + "psr-4": { + "Modules\\Blog\\": "app/", + "Modules\\Blog\\Database\\Factories\\": "database/factories/", + "Modules\\Blog\\Database\\Seeders\\": "database/seeders/" + } + }, + "autoload-dev": { + "psr-4": { + "Modules\\Blog\\Tests\\": "tests/" + } + } +} diff --git a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt new file mode 100644 index 00000000..4fb9ff31 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace__1.txt @@ -0,0 +1,48 @@ +line('The introduction to the notification.') + ->action('Notification Action', 'https://laravel.com') + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + */ + public function toArray($notifiable): array + { + return []; + } +} diff --git a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt new file mode 100644 index 00000000..4fb9ff31 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt @@ -0,0 +1,48 @@ +line('The introduction to the notification.') + ->action('Notification Action', 'https://laravel.com') + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + */ + public function toArray($notifiable): array + { + return []; + } +} diff --git a/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt new file mode 100644 index 00000000..53e7ab76 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/NotificationMakeCommandTest__test_it_generated_correct_file_with_content__1.txt @@ -0,0 +1,48 @@ +line('The introduction to the notification.') + ->action('Notification Action', 'https://laravel.com') + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + */ + public function toArray($notifiable): array + { + return []; + } +} diff --git a/tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt b/tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt new file mode 100644 index 00000000..f2b38c90 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ObserverMakeCommandTest__test_it_makes_observer__1.txt @@ -0,0 +1,48 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt new file mode 100644 index 00000000..7a1ebd09 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt new file mode 100644 index 00000000..ed70db0e --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt @@ -0,0 +1,135 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt new file mode 100644 index 00000000..922456f3 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt @@ -0,0 +1,24 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/'.$this->nameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->nameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], 'config'); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); + + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; + } + } + + return $paths; + } +} diff --git a/tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt new file mode 100644 index 00000000..6ddffc7b --- /dev/null +++ b/tests/Commands/Make/__snapshots__/RepositoryMakeCommandTest__test_it_can_generate_a_repository_in_sub_namespace_with_correct_generated_file__1.txt @@ -0,0 +1,11 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt new file mode 100644 index 00000000..43a25d37 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt new file mode 100644 index 00000000..43a25d37 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt new file mode 100644 index 00000000..9b80aa3d --- /dev/null +++ b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_file__1.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/SuperRoutes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt new file mode 100644 index 00000000..fe4cb9a8 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_can_overwrite_route_file_names__1.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/SuperRoutes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/SuperRoutes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt new file mode 100644 index 00000000..650b2838 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/RouteProviderMakeCommandTest__test_it_generated_correct_file_with_content__1.txt @@ -0,0 +1,50 @@ +mapApiRoutes(); + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path($this->name, '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php')); + } +} diff --git a/tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt new file mode 100644 index 00000000..23757e05 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/RuleMakeCommandTest__test_it_can_change_the_default_namespace__1.txt @@ -0,0 +1,17 @@ +get('/'); + + $response->assertStatus(200); + } +} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt new file mode 100644 index 00000000..3986e14b --- /dev/null +++ b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_feature_namespace_specific__1.txt @@ -0,0 +1,18 @@ +get('/'); + + $response->assertStatus(200); + } +} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt new file mode 100644 index 00000000..ae35f4fe --- /dev/null +++ b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace__1.txt @@ -0,0 +1,16 @@ +assertTrue(true); + } +} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt new file mode 100644 index 00000000..d6cc1988 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_can_change_the_default_unit_namespace_specific__1.txt @@ -0,0 +1,16 @@ +assertTrue(true); + } +} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt new file mode 100644 index 00000000..f5907115 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_feature_file_with_content__1.txt @@ -0,0 +1,18 @@ +get('/'); + + $response->assertStatus(200); + } +} diff --git a/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt new file mode 100644 index 00000000..d6cc1988 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/TestMakeCommandTest__test_it_generated_correct_unit_file_with_content__1.txt @@ -0,0 +1,16 @@ +assertTrue(true); + } +} diff --git a/tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt b/tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt new file mode 100644 index 00000000..81f87fd9 --- /dev/null +++ b/tests/Commands/Make/__snapshots__/TraitMakeCommandTest__test_it_can_generate_a_trait_in_sub_namespace_with_correct_generated_file__1.txt @@ -0,0 +1,8 @@ +