Skip to content
Open
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 src/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public function register()
->setRepository('collection', \Statamic\Contracts\Entries\CollectionRepository::class)
->setRepository('taxonomy', \Statamic\Contracts\Taxonomies\TaxonomyRepository::class)
->setRepository('global', \Statamic\Contracts\Globals\GlobalRepository::class)
->setRepository('globals', \Statamic\Contracts\Globals\GlobalVariablesRepository::class)
->setRepository('asset', \Statamic\Contracts\Assets\AssetRepository::class)
->setRepository('user', \Statamic\Contracts\Auth\UserRepository::class);
});
Expand Down
14 changes: 14 additions & 0 deletions tests/Data/Globals/VariablesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PHPUnit\Framework\Attributes\Test;
use Statamic\Facades;
use Statamic\Facades\Blueprint;
use Statamic\Facades\Data;
use Statamic\Facades\GlobalSet;
use Statamic\Fields\Fieldtype;
use Statamic\Fields\Value;
Expand Down Expand Up @@ -407,4 +408,17 @@ public function it_clones_internal_collections()
$this->assertEquals('A', $variables->getSupplement('bar'));
$this->assertEquals('B', $clone->getSupplement('bar'));
}

#[Test]
public function it_can_be_found_via_the_data_repository_using_its_reference()
{
$global = tap(GlobalSet::make('test'))->save();
$variables = tap($global->inDefaultSite()->data(['foo' => 'bar']))->save();

$found = Data::find($variables->reference());

$this->assertInstanceOf(Variables::class, $found);
$this->assertEquals($variables->id(), $found->id());
$this->assertEquals('bar', $found->get('foo'));
}
}
Loading