Skip to content

Commit 7e5a336

Browse files
committed
Code cleanup
1 parent a144ceb commit 7e5a336

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

src/FakeAsyncTask.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
namespace Vectorial1024\LaravelProcessAsync;
66

77
use Closure;
8-
use Illuminate\Process\InvokedProcess;
9-
use Illuminate\Support\Facades\Process;
10-
use Illuminate\Support\Str;
11-
use InvalidArgumentException;
12-
use LogicException;
13-
use loophp\phposinfo\OsInfo;
14-
use RuntimeException;
15-
16-
use function Opis\Closure\{serialize, unserialize};
178

189
/**
1910
* The fake AsyncTask class for testing.

src/FakeAsyncTaskStatus.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
namespace Vectorial1024\LaravelProcessAsync;
66

7-
use InvalidArgumentException;
8-
use loophp\phposinfo\OsInfo;
9-
use RuntimeException;
10-
117
/**
128
* The fake AsyncTaskStatus class for testing. Fake async tasks are presumed to be running by default.
139
*/
@@ -32,5 +28,14 @@ public function isRunning(): bool
3228
return $this->fakeIsRunning;
3329
}
3430

35-
31+
/**
32+
* Force the fake task to become stopped.
33+
*
34+
* Note: once stopped, the fake async task cannot be made running again. Use a new status object if the fake task needs to be restarted.
35+
* @return void
36+
*/
37+
public function fakeStopRunning(): void
38+
{
39+
$this->fakeIsRunning = false;
40+
}
3641
}

tests/FakeAsyncTaskTest.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22

33
namespace Vectorial1024\LaravelProcessAsync\Tests;
44

5-
use InvalidArgumentException;
6-
use LogicException;
7-
use RuntimeException;
85
use Vectorial1024\LaravelProcessAsync\AsyncTask;
96
use Vectorial1024\LaravelProcessAsync\AsyncTaskStatus;
10-
use Vectorial1024\LaravelProcessAsync\FakeAsyncTaskStatus;
117
use Vectorial1024\LaravelProcessAsync\Tests\Tasks\DummyAsyncTask;
12-
use Vectorial1024\LaravelProcessAsync\Tests\Tasks\SleepingAsyncTask;
13-
use Vectorial1024\LaravelProcessAsync\Tests\Tasks\TestTimeoutENoticeTask;
14-
use Vectorial1024\LaravelProcessAsync\Tests\Tasks\TestTimeoutErrorTask;
15-
use Vectorial1024\LaravelProcessAsync\Tests\Tasks\TestTimeoutNoOpTask;
16-
use Vectorial1024\LaravelProcessAsync\Tests\Tasks\TestTimeoutNormalTask;
8+
use Vectorial1024\LaravelProcessAsync\FakeAsyncTaskStatus;
179

1810
// a series of tests that ensure the fake tasks are indeed fake while still look like the same
1911
class FakeAsyncTaskTest extends BaseTestCase

0 commit comments

Comments
 (0)