Skip to content

Commit 2d480d7

Browse files
committed
wip
1 parent dea83b2 commit 2d480d7

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"ci": [
6565
"./vendor/bin/pint --test",
6666
"./vendor/bin/phpstan analyse --memory-limit=2G",
67-
"./vendor/bin/pest --parallel --coverage --min=90"
67+
"./vendor/bin/pest --parallel --coverage --min=85"
6868
]
6969
},
7070
"minimum-stability": "stable",

src/FractionBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ final class FractionBuilder implements Arrayable
4242

4343
public function __construct(
4444
public Application $application,
45-
public string $action,
45+
public string|UnitEnum $action,
4646
public Closure $closure
4747
) {
48-
// ...
48+
$this->action = $this->action instanceof UnitEnum
49+
? $this->action->name
50+
: $this->action;
4951
}
5052

5153
/**

tests/Feature/Execution/AsDefaultTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
[1, 2, 3],
3333
]);
3434

35+
test('can execute using enum', function () {
36+
execute(Actions::Testing, function () {
37+
return 1;
38+
});
39+
40+
$test = run(Actions::Testing);
41+
42+
expect($test)->toBe(1);
43+
});
44+
3545
test('resolve laravel dependencies', function () {
3646
execute('testing', function (Request $request) {
3747
return $request->method();
@@ -209,3 +219,8 @@
209219

210220
run('testing');
211221
})->throws(PreventDeferQueueSameTime::class, 'The action [testing] cannot use defer and queue at the same time.');
222+
223+
enum Actions
224+
{
225+
case Testing;
226+
}

0 commit comments

Comments
 (0)