From d97e1674aacc8ea4423e798e833b21c06e953555 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 14 Apr 2021 15:07:26 +0200 Subject: [PATCH] tests: fix --- app/workers/functions.php | 7 +++---- tests/e2e/Services/Account/AccountCustomClientTest.php | 2 +- tests/unit/General/CollectionsTest.php | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/workers/functions.php b/app/workers/functions.php index 8f6afb6e2f..ed960d202e 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -14,8 +14,10 @@ use Utopia\Config\Config; require_once __DIR__.'/../init.php'; -Console::title('Functions V1 Worker'); +Runtime::setHookFlags(SWOOLE_HOOK_ALL); +Runtime::enableCoroutine(SWOOLE_HOOK_ALL); +Console::title('Functions V1 Worker'); Console::success(APP_NAME.' functions worker v1 has started'); $environments = Config::getParam('environments'); @@ -25,10 +27,7 @@ $environments = Config::getParam('environments'); */ $warmupStart = \microtime(true); -Runtime::setHookFlags(SWOOLE_HOOK_ALL); - Co\run(function() use ($environments) { // Warmup: make sure images are ready to run fast 🚀 - Runtime::enableCoroutine(SWOOLE_HOOK_ALL); $dockerUser = App::getEnv('DOCKERHUB_PULL_USERNAME', null); $dockerPass = App::getEnv('DOCKERHUB_PULL_PASSWORD', null); diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index e1dedd6be9..b247347dd6 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -301,7 +301,7 @@ class AccountCustomClientTest extends Scope 'password' => '', ]); - $this->assertEquals($response['headers']['status-code'], 401); + $this->assertEquals(401, $response['headers']['status-code']); return []; } diff --git a/tests/unit/General/CollectionsTest.php b/tests/unit/General/CollectionsTest.php index bf7aea7c0c..8f84b35a12 100644 --- a/tests/unit/General/CollectionsTest.php +++ b/tests/unit/General/CollectionsTest.php @@ -20,7 +20,7 @@ class CollectionsTest extends TestCase public function testDuplicateRules() { foreach ($this->collections as $collection) { - if ($collection['rules']) { + if (in_array('rules', $collection)) { foreach ($collection['rules'] as $check) { $occurences = 0; foreach ($collection['rules'] as $rule) {