Skip to content

Commit f4139b5

Browse files
committed
[Tests] Update test case for force deleted event
1 parent e4d1eec commit f4139b5

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tests/lib/Acceptance/SoftDeleteTest.php renamed to tests/lib/Acceptance/Test.php

+10-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use App\Models\Post;
2323
use App\Schemas\PostSchema;
2424

25-
class SoftDeleteTest extends TestCase
25+
class Test extends TestCase
2626
{
2727

2828
/**
@@ -124,19 +124,18 @@ public function testQueryOne($deleted): void
124124
*/
125125
public function testItForceDeletesModel($deleted): void
126126
{
127-
// Unlike Eloquent's SoftDeletes trait, there is no `forceDeleted` event on SoftDeletesBoolean
128-
// $forceDeleted = false;
129-
//
130-
// Post::forceDeleted(function () use (&$forceDeleted) {
131-
// $forceDeleted = true;
132-
// });
127+
$forceDeleted = false;
128+
129+
Post::forceDeleted(function () use (&$forceDeleted) {
130+
$forceDeleted = true;
131+
});
133132

134133
$post = Post::factory()->create(['is_deleted' => $deleted]);
135134

136135
$this->schema->repository()->delete((string) $post->getRouteKey());
137136

138137
$this->assertDeleted($post);
139-
// $this->assertTrue($forceDeleted);
138+
$this->assertTrue($forceDeleted);
140139
}
141140

142141
public function testItDoesNotRestoreOnCreate(): void
@@ -506,9 +505,9 @@ private function willNotRestore(): self
506505
*/
507506
private function willNotForceDelete(): self
508507
{
509-
// Post::forceDeleted(function () {
510-
// throw new \LogicException('Not expecting a restore event.');
511-
// });
508+
Post::forceDeleted(function () {
509+
throw new \LogicException('Not expecting a restore event.');
510+
});
512511

513512
return $this;
514513
}

0 commit comments

Comments
 (0)