From 95a170c2c436be66f7457570d1bc008dd9caab75 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 10 Apr 2024 13:27:44 +0100 Subject: [PATCH 1/4] Split migration tags --- src/ServiceProvider.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index b62d0cbd..88bd9277 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -106,19 +106,28 @@ private function publishMigrations(): void { $this->publishes($taxonomyMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_taxonomies_table.php' => database_path('migrations/2024_03_07_100000_create_taxonomies_table.php'), - __DIR__.'/../database/migrations/2024_03_07_100000_create_terms_table.php' => database_path('migrations/2024_03_07_100000_create_terms_table.php'), ], 'statamic-eloquent-taxonomy-migrations'); + $this->publishes($termMigrations = [ + __DIR__.'/../database/migrations/2024_03_07_100000_create_terms_table.php' => database_path('migrations/2024_03_07_100000_create_terms_table.php'), + ], 'statamic-eloquent-term-migrations'); + $this->publishes($globalMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_globals_table.php' => database_path('migrations/2024_03_07_100000_create_globals_table.php'), - __DIR__.'/../database/migrations/2024_03_07_100000_create_global_variables_table.php' => database_path('migrations/2024_03_07_100000_create_global_variables_table.php'), ], 'statamic-eloquent-global-migrations'); + $this->publishes($globalVariablesMigrations = [ + __DIR__.'/../database/migrations/2024_03_07_100000_create_global_variables_table.php' => database_path('migrations/2024_03_07_100000_create_global_variables_table.php'), + ], 'statamic-eloquent-global-variables-migrations'); + $this->publishes($navigationMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_navigations_table.php' => database_path('migrations/2024_03_07_100000_create_navigations_table.php'), - __DIR__.'/../database/migrations/2024_03_07_100000_create_navigation_trees_table.php' => database_path('migrations/2024_03_07_100000_create_navigation_trees_table.php'), ], 'statamic-eloquent-navigation-migrations'); + $this->publishMigrations($navigationTreeMigrations = [ + __DIR__.'/../database/migrations/2024_03_07_100000_create_navigation_trees_table.php' => database_path('migrations/2024_03_07_100000_create_navigation_trees_table.php'), + ], 'statamic-eloquent-navigation-tree-migrations'); + $this->publishes($collectionMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_collections_table.php' => database_path('migrations/2024_03_07_100000_create_collections_table.php'), ], 'statamic-eloquent-collection-migrations'); @@ -130,11 +139,17 @@ private function publishMigrations(): void $this->publishes($formMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_forms_table.php' => database_path('migrations/2024_03_07_100000_create_forms_table.php'), - __DIR__.'/../database/migrations/2024_03_07_100000_create_form_submissions_table.php' => database_path('migrations/2024_03_07_100000_create_form_submissions_table.php'), ], 'statamic-eloquent-form-migrations'); - $this->publishes($assetMigrations = [ + $this->publishes($formSubmissionMigrations = [ + __DIR__.'/../database/migrations/2024_03_07_100000_create_form_submissions_table.php' => database_path('migrations/2024_03_07_100000_create_form_submissions_table.php'), + ], 'statamic-eloquent-form-submission-migrations'); + + $this->publishes($assetContainerMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_asset_containers_table.php' => database_path('migrations/2024_03_07_100000_create_asset_containers_table.php'), + ], 'statamic-eloquent-asset-container-migrations'); + + $this->publishes($assetMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_asset_table.php' => database_path('migrations/2024_03_07_100000_create_asset_table.php'), ], 'statamic-eloquent-asset-migrations'); @@ -145,11 +160,16 @@ private function publishMigrations(): void $this->publishes( array_merge( $taxonomyMigrations, + $termMigrations, $globalMigrations, + $globalVariablesMigrations, $navigationMigrations, + $navigationTreeMigrations, $collectionMigrations, $blueprintMigrations, $formMigrations, + $formSubmissionMigrations, + $assetContainerMigrations, $assetMigrations, $revisionMigrations ), From e425c188347018266f836168d1f12fd38e0b61f6 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 10 Apr 2024 13:51:27 +0100 Subject: [PATCH 2/4] fix everything --- src/ServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 88bd9277..abae0056 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -124,7 +124,7 @@ private function publishMigrations(): void __DIR__.'/../database/migrations/2024_03_07_100000_create_navigations_table.php' => database_path('migrations/2024_03_07_100000_create_navigations_table.php'), ], 'statamic-eloquent-navigation-migrations'); - $this->publishMigrations($navigationTreeMigrations = [ + $this->publishes($navigationTreeMigrations = [ __DIR__.'/../database/migrations/2024_03_07_100000_create_navigation_trees_table.php' => database_path('migrations/2024_03_07_100000_create_navigation_trees_table.php'), ], 'statamic-eloquent-navigation-tree-migrations'); From a44bba00c7fd62c241025624cd2824cc8511f170 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Wed, 10 Apr 2024 14:22:43 +0100 Subject: [PATCH 3/4] Merge branch '5.x-support' into split-migration-tags --- .phpunit.cache/test-results | 1 + tests/Data/Entries/EntryQueryBuilderTest.php | 4 +-- tests/Data/Globals/GlobalSetTest.php | 22 +++++++--------- .../Data/Taxonomies/TermQueryBuilderTest.php | 4 +-- tests/Entries/EntryTest.php | 26 +++++++------------ tests/TestCase.php | 9 +++---- 6 files changed, 29 insertions(+), 37 deletions(-) create mode 100644 .phpunit.cache/test-results diff --git a/.phpunit.cache/test-results b/.phpunit.cache/test-results new file mode 100644 index 00000000..58ec9ab6 --- /dev/null +++ b/.phpunit.cache/test-results @@ -0,0 +1 @@ +{"version":1,"defects":{"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_contains":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_doesnt_contain":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_contains":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_doesnt_contain":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_length":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_contains":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_doesnt_contain":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_contains":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_doesnt_contain":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_length":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_contains":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_doesnt_contain":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_contains":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_doesnt_contain":1},"times":{"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets":0.003,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_in":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_not_in":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_date":0.01,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_month":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_day":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_year":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_time":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_not_null":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_null":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_not_null":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_nested_where":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_nested_where_in":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_not_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_not_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_contains":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_doesnt_contain":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_contains":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_doesnt_contain":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_length":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_array_of_wheres":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::results_are_found_using_where_with_json_value":0.009,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_column":0.009,"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets_using_when":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets_using_unless":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets_using_tap":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entry_is_found_within_all_created_entries_using_entry_facade_with_find_method":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entry_is_found_within_all_created_entries_and_select_query_columns_are_set_using_entry_facade_with_find_method_with_columns_param":0.005,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_in":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_not_in":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_date":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_month":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_day":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_year":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_time":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_not_null":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_null":0.01,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_not_null":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_column":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_nested_where":0.009,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_nested_where_in":0.012,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_not_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_not_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_contains":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_doesnt_contain":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_contains":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_doesnt_contain":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_length":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_array_of_wheres":0.009,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_with_json_value":0.01,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_when":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_unless":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_tap":0.005,"Tests\\Data\\Entries\\EntryQueryBuilderTest::it_substitutes_entries_by_id":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::it_substitutes_entries_by_uri":0.007,"Tests\\Data\\Entries\\EntryQueryBuilderTest::it_substitutes_entries_by_uri_and_site":0.012,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_offset":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_offset_but_no_limit":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_retrieved_on_join_table_conditions":0.01,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_ordered_by_an_integer_json_field":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_ordered_by_an_float_json_field":0.005,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_ordered_by_an_date_json_field":0.006,"Tests\\Data\\Fields\\BlueprintTest::it_saves_and_removes_hidden_on_model":0.002,"Tests\\Data\\Fields\\BlueprintTest::it_deletes_the_model_when_the_blueprint_is_deleted":0.001,"Tests\\Data\\Globals\\GlobalSetTest::it_gets_file_contents_for_saving_with_a_single_site":0.003,"Tests\\Data\\Globals\\GlobalSetTest::it_gets_file_contents_for_saving_with_multiple_sites":0.001,"Tests\\Data\\Globals\\VariablesTest::it_gets_file_contents_for_saving":0,"Tests\\Data\\Globals\\VariablesTest::it_gets_file_contents_for_saving_a_localized_set":0.001,"Tests\\Data\\Globals\\VariablesTest::if_the_value_is_explicitly_set_to_null_then_it_should_not_fall_back":0.001,"Tests\\Data\\Globals\\VariablesTest::it_sets_data_values_using_magic_properties":0,"Tests\\Data\\Globals\\VariablesTest::it_gets_evaluated_augmented_value_using_magic_property":0.001,"Tests\\Data\\Globals\\VariablesTest::it_has_magic_property_and_methods_for_fields_that_augment_to_query_builders#statamic":0.001,"Tests\\Data\\Globals\\VariablesTest::it_has_magic_property_and_methods_for_fields_that_augment_to_query_builders#database":0.001,"Tests\\Data\\Globals\\VariablesTest::it_has_magic_property_and_methods_for_fields_that_augment_to_query_builders#eloquent":0.001,"Tests\\Data\\Globals\\VariablesTest::calling_unknown_method_throws_exception":0.001,"Tests\\Data\\Globals\\VariablesTest::it_converts_to_an_array":0.001,"Tests\\Data\\Globals\\VariablesTest::only_requested_relationship_fields_are_included_in_to_array":0.001,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_gets_terms":0.008,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_wheres":0.006,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_or_wheres":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_or_where_ins":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_or_where_not_ins":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_nested_wheres":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_nested_where_ins":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_nested_where_not_ins":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_by_taxonomy":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_sorts":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_column":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_usage_in_collections":0.033,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_substitutes_terms_by_id":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_substitutes_terms_by_uri":0.007,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_substitutes_terms_by_uri_and_site":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_date":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_month":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_day":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_year":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_time":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_contains":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_doesnt_contain":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_contains":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_doesnt_contain":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_length":0.009,"Tests\\Entries\\EntryModelTest::it_gets_attributes_from_json_column":0,"Tests\\Entries\\EntryTest::it_loads_from_entry_model":0.001,"Tests\\Entries\\EntryTest::it_saves_to_entry_model":0.002,"Tests\\Entries\\EntryTest::it_stores_computed_values":0.003,"Tests\\Entries\\EntryTest::it_defers_to_the_live_computed_value_instead_of_the_stored_value":0.004,"Tests\\Entries\\EntryTest::it_propagates_entry_if_configured":0.006,"Tests\\Entries\\EntryTest::it_propagates_updating_origin_data_to_descendent_models":0.009,"Tests\\Entries\\EntryTest::it_propagates_origin_date_to_descendent_models":0.01,"Tests\\Forms\\FormSubmissionTest::it_should_have_timestamps":0.001,"Tests\\Forms\\FormSubmissionTest::it_should_save_to_the_database":0.001,"Tests\\Forms\\FormSubmissionTest::it_should_not_overwrite_submissions":0.001,"Tests\\Repositories\\AssetContainerRepositoryTest::it_gets_all_asset_containers":0.001,"Tests\\Repositories\\AssetContainerRepositoryTest::it_gets_an_asset_container_by_handle":0.001,"Tests\\Repositories\\AssetContainerRepositoryTest::it_saves_a_container_to_the_database":0.001,"Tests\\Repositories\\CollectionRepositoryTest::it_gets_all_collections":0.001,"Tests\\Repositories\\CollectionRepositoryTest::it_gets_a_collection_by_handle":0.001,"Tests\\Repositories\\CollectionRepositoryTest::it_saves_a_collection_to_the_database":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_gets_all_global_sets":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_gets_a_global_set_by_id":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_gets_a_global_set_by_handle":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_saves_a_global_to_the_database":0.001,"Tests\\Repositories\\NavigationRepositoryTest::it_gets_all_navs":0,"Tests\\Repositories\\NavigationRepositoryTest::it_gets_a_nav_by_handle":0.001,"Tests\\Repositories\\NavigationRepositoryTest::it_saves_a_nav_to_the_database":0.001,"Tests\\Stache\\Repositories\\TaxonomyRepositoryTest::it_gets_a_taxonomy_by_uri":0.001,"Tests\\Stache\\Repositories\\TaxonomyRepositoryTest::it_gets_a_taxonomy_by_uri_with_collection":0.001}} \ No newline at end of file diff --git a/tests/Data/Entries/EntryQueryBuilderTest.php b/tests/Data/Entries/EntryQueryBuilderTest.php index e7221289..65b5de45 100644 --- a/tests/Data/Entries/EntryQueryBuilderTest.php +++ b/tests/Data/Entries/EntryQueryBuilderTest.php @@ -626,10 +626,10 @@ public function it_substitutes_entries_by_uri() /** @test */ public function it_substitutes_entries_by_uri_and_site() { - Site::setConfig(['sites' => [ + Site::setSites([ 'en' => ['url' => 'http://localhost/', 'locale' => 'en'], 'fr' => ['url' => 'http://localhost/fr/', 'locale' => 'fr'], - ]]); + ]); Collection::make('posts')->routes('/posts/{slug}')->sites(['en', 'fr'])->save(); EntryFactory::id('1')->slug('post-1')->collection('posts')->data(['title' => 'Post 1'])->locale('en')->create(); diff --git a/tests/Data/Globals/GlobalSetTest.php b/tests/Data/Globals/GlobalSetTest.php index 84033b66..29963a0c 100644 --- a/tests/Data/Globals/GlobalSetTest.php +++ b/tests/Data/Globals/GlobalSetTest.php @@ -11,11 +11,10 @@ class GlobalSetTest extends TestCase /** @test */ public function it_gets_file_contents_for_saving_with_a_single_site() { - Site::setConfig([ - 'default' => 'en', - 'sites' => [ - 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], - ], + config()->set('statamic.system.multisite', false); + + Site::setSites([ + 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], ]); $set = (new GlobalSet())->title('The title'); @@ -42,13 +41,12 @@ public function it_gets_file_contents_for_saving_with_a_single_site() /** @test */ public function it_gets_file_contents_for_saving_with_multiple_sites() { - Site::setConfig([ - 'default' => 'en', - 'sites' => [ - 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], - 'fr' => ['name' => 'French', 'locale' => 'fr_FR', 'url' => 'http://fr.test.com/'], - 'de' => ['name' => 'German', 'locale' => 'de_DE', 'url' => 'http://test.com/de/'], - ], + config()->set('statamic.system.multisite', true); + + Site::setSites([ + 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], + 'fr' => ['name' => 'French', 'locale' => 'fr_FR', 'url' => 'http://fr.test.com/'], + 'de' => ['name' => 'German', 'locale' => 'de_DE', 'url' => 'http://test.com/de/'], ]); $set = (new GlobalSet())->title('The title'); diff --git a/tests/Data/Taxonomies/TermQueryBuilderTest.php b/tests/Data/Taxonomies/TermQueryBuilderTest.php index 67907f86..61475ac7 100644 --- a/tests/Data/Taxonomies/TermQueryBuilderTest.php +++ b/tests/Data/Taxonomies/TermQueryBuilderTest.php @@ -326,10 +326,10 @@ public function it_substitutes_terms_by_uri() /** @test */ public function it_substitutes_terms_by_uri_and_site() { - Site::setConfig(['sites' => [ + Site::setSites([ 'en' => ['url' => 'http://localhost/', 'locale' => 'en'], 'fr' => ['url' => 'http://localhost/fr/', 'locale' => 'fr'], - ]]); + ]); Taxonomy::make('tags')->sites(['en', 'fr'])->save(); Term::make('tag-1')->slug('tag-1')->taxonomy('tags') diff --git a/tests/Entries/EntryTest.php b/tests/Entries/EntryTest.php index fa6f1621..cdf3c91c 100644 --- a/tests/Entries/EntryTest.php +++ b/tests/Entries/EntryTest.php @@ -162,14 +162,11 @@ public function it_propagates_entry_if_configured() /** @test */ public function it_propagates_updating_origin_data_to_descendent_models() { - Facades\Site::setConfig([ - 'default' => 'en', - 'sites' => [ - 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], - 'fr' => ['name' => 'French', 'locale' => 'fr_FR', 'url' => 'http://fr.test.com/'], - 'es' => ['name' => 'Spanish', 'locale' => 'es_ES', 'url' => 'http://test.com/es/'], - 'de' => ['name' => 'German', 'locale' => 'de_DE', 'url' => 'http://test.com/de/'], - ], + Facades\Site::setSites([ + 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], + 'fr' => ['name' => 'French', 'locale' => 'fr_FR', 'url' => 'http://fr.test.com/'], + 'es' => ['name' => 'Spanish', 'locale' => 'es_ES', 'url' => 'http://test.com/es/'], + 'de' => ['name' => 'German', 'locale' => 'de_DE', 'url' => 'http://test.com/de/'], ]); $blueprint = Facades\Blueprint::makeFromFields(['foo' => ['type' => 'test', 'localizable' => true]])->setHandle('test'); @@ -210,14 +207,11 @@ public function it_propagates_updating_origin_data_to_descendent_models() /** @test */ public function it_propagates_origin_date_to_descendent_models() { - Facades\Site::setConfig([ - 'default' => 'en', - 'sites' => [ - 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], - 'fr' => ['name' => 'French', 'locale' => 'fr_FR', 'url' => 'http://fr.test.com/'], - 'es' => ['name' => 'Spanish', 'locale' => 'es_ES', 'url' => 'http://test.com/es/'], - 'de' => ['name' => 'German', 'locale' => 'de_DE', 'url' => 'http://test.com/de/'], - ], + Facades\Site::setSites([ + 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://test.com/'], + 'fr' => ['name' => 'French', 'locale' => 'fr_FR', 'url' => 'http://fr.test.com/'], + 'es' => ['name' => 'Spanish', 'locale' => 'es_ES', 'url' => 'http://test.com/es/'], + 'de' => ['name' => 'German', 'locale' => 'de_DE', 'url' => 'http://test.com/de/'], ]); $blueprint = Facades\Blueprint::makeFromFields(['foo' => ['type' => 'test', 'localizable' => true]])->setHandle('test'); diff --git a/tests/TestCase.php b/tests/TestCase.php index e26eebd0..3bf34637 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -63,12 +63,10 @@ protected function resolveApplicationConfiguration($app) protected function getEnvironmentSetUp($app) { // We changed the default sites setup but the tests assume defaults like the following. - $app['config']->set('statamic.sites', [ - 'default' => 'en', - 'sites' => [ - 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://localhost/'], - ], + \Statamic\Facades\Site::setSites([ + 'en' => ['name' => 'English', 'locale' => 'en_US', 'url' => 'http://localhost/'], ]); + $app['config']->set('auth.providers.users.driver', 'statamic'); $app['config']->set('statamic.stache.watcher', false); $app['config']->set('statamic.users.repository', 'file'); @@ -78,6 +76,7 @@ protected function getEnvironmentSetUp($app) ]); $app['config']->set('statamic.editions.pro', true); + $app['config']->set('statamic.system.multisite', true); $app['config']->set('cache.stores.outpost', [ 'driver' => 'file', From 7dbf0c9b589253b5387b13bab526fa292f3b7c60 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 10 Apr 2024 15:25:00 +0100 Subject: [PATCH 4/4] Ignore `.phpunit.cache` --- .gitignore | 1 + .phpunit.cache/test-results | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .phpunit.cache/test-results diff --git a/.gitignore b/.gitignore index c337a744..bd3fea95 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ vendor .phpunit.result.cache .php_cs.cache .nova/* +.phpunit.cache diff --git a/.phpunit.cache/test-results b/.phpunit.cache/test-results deleted file mode 100644 index 58ec9ab6..00000000 --- a/.phpunit.cache/test-results +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"defects":{"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_contains":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_doesnt_contain":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_contains":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_doesnt_contain":1,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_length":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_contains":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_doesnt_contain":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_contains":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_doesnt_contain":1,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_length":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_contains":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_doesnt_contain":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_contains":1,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_doesnt_contain":1},"times":{"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets":0.003,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_in":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_not_in":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_date":0.01,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_month":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_day":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_year":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_time":0.007,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_not_null":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_null":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_not_null":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_nested_where":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_nested_where_in":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_not_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_not_between":0.008,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_contains":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_doesnt_contain":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_contains":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_or_where_json_doesnt_contain":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_json_length":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_array_of_wheres":0,"Tests\\Data\\Assets\\AssetQueryBuilderTest::results_are_found_using_where_with_json_value":0.009,"Tests\\Data\\Assets\\AssetQueryBuilderTest::assets_are_found_using_where_column":0.009,"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets_using_when":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets_using_unless":0.001,"Tests\\Data\\Assets\\AssetQueryBuilderTest::it_can_get_assets_using_tap":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entry_is_found_within_all_created_entries_using_entry_facade_with_find_method":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entry_is_found_within_all_created_entries_and_select_query_columns_are_set_using_entry_facade_with_find_method_with_columns_param":0.005,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_in":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_not_in":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_date":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_month":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_day":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_year":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_time":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_not_null":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_null":0.01,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_not_null":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_column":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_nested_where":0.009,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_nested_where_in":0.012,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_not_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_not_between":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_contains":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_doesnt_contain":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_contains":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_or_where_json_doesnt_contain":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_json_length":0,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_array_of_wheres":0.009,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_where_with_json_value":0.01,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_when":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_unless":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_tap":0.005,"Tests\\Data\\Entries\\EntryQueryBuilderTest::it_substitutes_entries_by_id":0.008,"Tests\\Data\\Entries\\EntryQueryBuilderTest::it_substitutes_entries_by_uri":0.007,"Tests\\Data\\Entries\\EntryQueryBuilderTest::it_substitutes_entries_by_uri_and_site":0.012,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_offset":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_are_found_using_offset_but_no_limit":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_retrieved_on_join_table_conditions":0.01,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_ordered_by_an_integer_json_field":0.006,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_ordered_by_an_float_json_field":0.005,"Tests\\Data\\Entries\\EntryQueryBuilderTest::entries_can_be_ordered_by_an_date_json_field":0.006,"Tests\\Data\\Fields\\BlueprintTest::it_saves_and_removes_hidden_on_model":0.002,"Tests\\Data\\Fields\\BlueprintTest::it_deletes_the_model_when_the_blueprint_is_deleted":0.001,"Tests\\Data\\Globals\\GlobalSetTest::it_gets_file_contents_for_saving_with_a_single_site":0.003,"Tests\\Data\\Globals\\GlobalSetTest::it_gets_file_contents_for_saving_with_multiple_sites":0.001,"Tests\\Data\\Globals\\VariablesTest::it_gets_file_contents_for_saving":0,"Tests\\Data\\Globals\\VariablesTest::it_gets_file_contents_for_saving_a_localized_set":0.001,"Tests\\Data\\Globals\\VariablesTest::if_the_value_is_explicitly_set_to_null_then_it_should_not_fall_back":0.001,"Tests\\Data\\Globals\\VariablesTest::it_sets_data_values_using_magic_properties":0,"Tests\\Data\\Globals\\VariablesTest::it_gets_evaluated_augmented_value_using_magic_property":0.001,"Tests\\Data\\Globals\\VariablesTest::it_has_magic_property_and_methods_for_fields_that_augment_to_query_builders#statamic":0.001,"Tests\\Data\\Globals\\VariablesTest::it_has_magic_property_and_methods_for_fields_that_augment_to_query_builders#database":0.001,"Tests\\Data\\Globals\\VariablesTest::it_has_magic_property_and_methods_for_fields_that_augment_to_query_builders#eloquent":0.001,"Tests\\Data\\Globals\\VariablesTest::calling_unknown_method_throws_exception":0.001,"Tests\\Data\\Globals\\VariablesTest::it_converts_to_an_array":0.001,"Tests\\Data\\Globals\\VariablesTest::only_requested_relationship_fields_are_included_in_to_array":0.001,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_gets_terms":0.008,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_wheres":0.006,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_or_wheres":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_or_where_ins":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_or_where_not_ins":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_nested_wheres":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_nested_where_ins":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_using_nested_where_not_ins":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_by_taxonomy":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_sorts":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_column":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_filters_usage_in_collections":0.033,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_substitutes_terms_by_id":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_substitutes_terms_by_uri":0.007,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::it_substitutes_terms_by_uri_and_site":0.009,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_date":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_month":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_day":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_year":0.011,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::entries_are_found_using_where_time":0.01,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_contains":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_doesnt_contain":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_contains":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_or_where_json_doesnt_contain":0,"Tests\\Data\\Taxonomies\\TermQueryBuilderTest::terms_are_found_using_where_json_length":0.009,"Tests\\Entries\\EntryModelTest::it_gets_attributes_from_json_column":0,"Tests\\Entries\\EntryTest::it_loads_from_entry_model":0.001,"Tests\\Entries\\EntryTest::it_saves_to_entry_model":0.002,"Tests\\Entries\\EntryTest::it_stores_computed_values":0.003,"Tests\\Entries\\EntryTest::it_defers_to_the_live_computed_value_instead_of_the_stored_value":0.004,"Tests\\Entries\\EntryTest::it_propagates_entry_if_configured":0.006,"Tests\\Entries\\EntryTest::it_propagates_updating_origin_data_to_descendent_models":0.009,"Tests\\Entries\\EntryTest::it_propagates_origin_date_to_descendent_models":0.01,"Tests\\Forms\\FormSubmissionTest::it_should_have_timestamps":0.001,"Tests\\Forms\\FormSubmissionTest::it_should_save_to_the_database":0.001,"Tests\\Forms\\FormSubmissionTest::it_should_not_overwrite_submissions":0.001,"Tests\\Repositories\\AssetContainerRepositoryTest::it_gets_all_asset_containers":0.001,"Tests\\Repositories\\AssetContainerRepositoryTest::it_gets_an_asset_container_by_handle":0.001,"Tests\\Repositories\\AssetContainerRepositoryTest::it_saves_a_container_to_the_database":0.001,"Tests\\Repositories\\CollectionRepositoryTest::it_gets_all_collections":0.001,"Tests\\Repositories\\CollectionRepositoryTest::it_gets_a_collection_by_handle":0.001,"Tests\\Repositories\\CollectionRepositoryTest::it_saves_a_collection_to_the_database":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_gets_all_global_sets":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_gets_a_global_set_by_id":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_gets_a_global_set_by_handle":0.001,"Tests\\Repositories\\GlobalRepositoryTest::it_saves_a_global_to_the_database":0.001,"Tests\\Repositories\\NavigationRepositoryTest::it_gets_all_navs":0,"Tests\\Repositories\\NavigationRepositoryTest::it_gets_a_nav_by_handle":0.001,"Tests\\Repositories\\NavigationRepositoryTest::it_saves_a_nav_to_the_database":0.001,"Tests\\Stache\\Repositories\\TaxonomyRepositoryTest::it_gets_a_taxonomy_by_uri":0.001,"Tests\\Stache\\Repositories\\TaxonomyRepositoryTest::it_gets_a_taxonomy_by_uri_with_collection":0.001}} \ No newline at end of file