File tree Expand file tree Collapse file tree 2 files changed +30
-7
lines changed Expand file tree Collapse file tree 2 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,6 @@ protected function getOriginByString($origin)
4949 return $ this ->globalSet ()->in ($ origin );
5050 }
5151
52- public function save ()
53- {
54- $ this ->toModel ()->save ();
55-
56- return $ this ;
57- }
58-
5952 public function model ($ model = null )
6053 {
6154 if (func_num_args () === 0 ) {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Globals ;
4+
5+ use Illuminate \Support \Facades \Event ;
6+ use PHPUnit \Framework \Attributes \Test ;
7+ use Statamic \Events \GlobalSetSaved ;
8+ use Statamic \Events \GlobalVariablesSaved ;
9+ use Statamic \Facades ;
10+ use Tests \TestCase ;
11+
12+ class GlobalsetTest extends TestCase
13+ {
14+ #[Test]
15+ public function fires_events_when_globalset_saved ()
16+ {
17+ Event::fake ();
18+
19+ $ global = Facades \Globalset::make ('test ' );
20+
21+ $ global ->addLocalization (
22+ $ global ->makeLocalization ('en ' )->data (['foo ' => 'bar ' , 'baz ' => 'qux ' ])
23+ );
24+
25+ $ global ->save ();
26+
27+ Event::assertDispatched (GlobalSetSaved::class);
28+ Event::assertDispatched (GlobalVariablesSaved::class);
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments