summaryrefslogtreecommitdiff
path: root/tests/worker.php
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-02 19:30:00 +0300
committerGitHub <[email protected]>2021-02-02 19:30:00 +0300
commit20a1a5d2eb26090e0eef0e6772330ee2a52526fa (patch)
treec282e18c20029f60a798576cb4fe47d2762ffba0 /tests/worker.php
parent36f01dc035f42115fcfd3b77dc5df3098382cd9f (diff)
parent2bdf7fafa73cabf7cf63657a6b58f2a423ae0fcd (diff)
Merge pull request #522 from spiral/fix/named_loggerv2.0.0-beta.22
bug(logger): Incorrect parsing of nested log levels
Diffstat (limited to 'tests/worker.php')
-rw-r--r--tests/worker.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/worker.php b/tests/worker.php
new file mode 100644
index 00000000..5c9c80e6
--- /dev/null
+++ b/tests/worker.php
@@ -0,0 +1,34 @@
+<?php
+
+declare(strict_types=1);
+
+require __DIR__ . '/vendor/autoload.php';
+
+/**
+ * @param string $dir
+ * @return array<string>
+ */
+$getClasses = static function (string $dir): iterable {
+ $files = glob($dir . '/*.php');
+
+ foreach ($files as $file) {
+ yield substr(basename($file), 0, -4);
+ }
+};
+
+$factory = \Temporal\WorkerFactory::create();
+
+$worker = $factory->newWorker('default');
+
+// register all workflows
+foreach ($getClasses(__DIR__ . '/src/Workflow') as $name) {
+ $worker->registerWorkflowTypes('Temporal\\Tests\\Workflow\\' . $name);
+}
+
+// register all activity
+foreach ($getClasses(__DIR__ . '/src/Activity') as $name) {
+ $class = 'Temporal\\Tests\\Activity\\' . $name;
+ $worker->registerActivityImplementations(new $class);
+}
+
+$factory->run();