Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vendor
.phpunit.result.cache
.php_cs.cache
.nova/*
.phpunit.cache
30 changes: 25 additions & 5 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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->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');

$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');
Expand All @@ -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');

Expand All @@ -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
),
Expand Down
4 changes: 2 additions & 2 deletions tests/Data/Entries/EntryQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
22 changes: 10 additions & 12 deletions tests/Data/Globals/GlobalSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions tests/Data/Taxonomies/TermQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
26 changes: 10 additions & 16 deletions tests/Entries/EntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
9 changes: 4 additions & 5 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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',
Expand Down