Skip to content

Commit

Permalink
Merge branch 'testing-affordances' of github.com:hirethunk/verbs into…
Browse files Browse the repository at this point in the history
… testing-affordances
  • Loading branch information
DanielCoulbourne committed Dec 12, 2023
2 parents 476fe93 + a00887e commit d25a894
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/verbs.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
'allow_commit_immediately_outside_tests' => false
'allow_commit_immediately_outside_tests' => false,
];
5 changes: 3 additions & 2 deletions src/Lifecycle/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class Broker
{
public bool $is_replaying = false;

public bool $commit_immediately = false;

public function __construct(
Expand Down Expand Up @@ -118,8 +119,8 @@ public function toId(Bits|UuidInterface|AbstractUid|int|string|null $id): int|st
public function commitImmediately(): void
{
if (
!app()->runningUnitTests()
&& !config('verbs.allow_commit_immediately_outside_tests', false)
! app()->runningUnitTests()
&& ! config('verbs.allow_commit_immediately_outside_tests', false)
) {
throw new \RuntimeException('Committing immediately is only allowed in tests. Use `Verbs::commit()` instead. If you are really, really sure, you can set `allow_commit_immediately_outside_tests` to `true` in your config/verbs.php file.');
}
Expand Down

0 comments on commit d25a894

Please sign in to comment.