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
7 changes: 0 additions & 7 deletions src/Globals/Variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ protected function getOriginByString($origin)
return $this->globalSet()->in($origin);
}

public function save()
{
$this->toModel()->save();

return $this;
}

public function model($model = null)
{
if (func_num_args() === 0) {
Expand Down
30 changes: 30 additions & 0 deletions tests/Globals/GlobalsetTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Globals;

use Illuminate\Support\Facades\Event;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Events\GlobalSetSaved;
use Statamic\Events\GlobalVariablesSaved;
use Statamic\Facades;
use Tests\TestCase;

class GlobalsetTest extends TestCase
{
#[Test]
public function fires_events_when_globalset_saved()
{
Event::fake();

$global = Facades\Globalset::make('test');

$global->addLocalization(
$global->makeLocalization('en')->data(['foo' => 'bar', 'baz' => 'qux'])
);

$global->save();

Event::assertDispatched(GlobalSetSaved::class);
Event::assertDispatched(GlobalVariablesSaved::class);
}
}