summaryrefslogtreecommitdiff
path: root/plugins/jobs/oooold/tests/Jobs/Local
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jobs/oooold/tests/Jobs/Local')
-rw-r--r--plugins/jobs/oooold/tests/Jobs/Local/BrokerTest.php20
-rw-r--r--plugins/jobs/oooold/tests/Jobs/Local/ErrorJob.php22
-rw-r--r--plugins/jobs/oooold/tests/Jobs/Local/Job.php26
3 files changed, 68 insertions, 0 deletions
diff --git a/plugins/jobs/oooold/tests/Jobs/Local/BrokerTest.php b/plugins/jobs/oooold/tests/Jobs/Local/BrokerTest.php
new file mode 100644
index 00000000..9ba83de6
--- /dev/null
+++ b/plugins/jobs/oooold/tests/Jobs/Local/BrokerTest.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Spiral Framework.
+ *
+ * @license MIT
+ * @author Anton Titov (Wolfy-J)
+ */
+
+declare(strict_types=1);
+
+namespace Spiral\Jobs\Tests\Local;
+
+use Spiral\Jobs\Tests\BaseTest;
+
+class BrokerTest extends BaseTest
+{
+ public const JOB = Job::class;
+ public const ERROR_JOB = ErrorJob::class;
+}
diff --git a/plugins/jobs/oooold/tests/Jobs/Local/ErrorJob.php b/plugins/jobs/oooold/tests/Jobs/Local/ErrorJob.php
new file mode 100644
index 00000000..70b1365b
--- /dev/null
+++ b/plugins/jobs/oooold/tests/Jobs/Local/ErrorJob.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * Spiral Framework.
+ *
+ * @license MIT
+ * @author Anton Titov (Wolfy-J)
+ */
+
+declare(strict_types=1);
+
+namespace Spiral\Jobs\Tests\Local;
+
+use Spiral\Jobs\JobHandler;
+
+class ErrorJob extends JobHandler
+{
+ public function invoke(string $id): void
+ {
+ throw new \Error('something is wrong');
+ }
+}
diff --git a/plugins/jobs/oooold/tests/Jobs/Local/Job.php b/plugins/jobs/oooold/tests/Jobs/Local/Job.php
new file mode 100644
index 00000000..2f5803c8
--- /dev/null
+++ b/plugins/jobs/oooold/tests/Jobs/Local/Job.php
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * Spiral Framework.
+ *
+ * @license MIT
+ * @author Anton Titov (Wolfy-J)
+ */
+
+declare(strict_types=1);
+
+namespace Spiral\Jobs\Tests\Local;
+
+use Spiral\Jobs\JobHandler;
+
+class Job extends JobHandler
+{
+ public const JOB_FILE = __DIR__ . '/../../local.job';
+
+ public function invoke(string $id, array $payload): void
+ {
+ file_put_contents(self::JOB_FILE, json_encode(
+ $payload + compact('id')
+ ));
+ }
+}