Skip to content

Commit f34fda9

Browse files
committed
Add config manipulation helpers as trait
1 parent e7c70a4 commit f34fda9

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

tests/TestCase.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace MarcoRieser\Livewire\Tests;
44

5-
use Illuminate\Support\Arr;
65
use Livewire\LivewireServiceProvider;
76
use MarcoRieser\Livewire\ServiceProvider;
87
use Spatie\LaravelRay\RayServiceProvider;
@@ -25,15 +24,6 @@ protected function getPackageProviders($app): array
2524
);
2625
}
2726

28-
protected function setConfigValue(string $key, $value): void
29-
{
30-
$config = config()->array('statamic-livewire', require __DIR__.'/../config/statamic-livewire.php');
31-
32-
Arr::set($config, $key, $value);
33-
34-
config()->set('statamic-livewire', $config);
35-
}
36-
3727
protected function setUp(): void
3828
{
3929
parent::setUp();
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace MarcoRieser\Livewire\Tests\Traits;
4+
5+
use Illuminate\Support\Arr;
6+
7+
trait ManipulateAddonConfig
8+
{
9+
protected function enableSynthesizers(): void
10+
{
11+
$this->setConfigValue('synthesizers.enabled', true);
12+
}
13+
14+
protected function disableSynthesizers(): void
15+
{
16+
$this->setConfigValue('synthesizers.enabled', false);
17+
}
18+
19+
protected function disableSynthesizerTransform(): void
20+
{
21+
$this->setConfigValue('synthesizers.transform', false);
22+
}
23+
24+
protected function enableSynthesizerTransform(): void
25+
{
26+
$this->setConfigValue('synthesizers.transform', true);
27+
}
28+
29+
protected function setConfigValue(string $key, $value): void
30+
{
31+
$config = config()->array('statamic-livewire', require __DIR__.'/../../config/statamic-livewire.php');
32+
33+
Arr::set($config, $key, $value);
34+
35+
config()->set('statamic-livewire', $config);
36+
}
37+
}

0 commit comments

Comments
 (0)