FIx missing event data; improve test

This commit is contained in:
Matej Bačo
2025-09-17 18:26:19 +02:00
parent ad795b4fd1
commit 1ac35054fe
2 changed files with 10 additions and 2 deletions
@@ -78,6 +78,8 @@ class Update extends Action
throw new Exception(Exception::RULE_NOT_FOUND);
}
$queueForEvents->setParam('ruleId', $rule->getId());
if ($rule->getAttribute('status', '') !== RULE_STATUS_VERIFICATION_FAILED) {
return $response->dynamic($rule, Response::MODEL_PROXY_RULE);
}
@@ -106,8 +108,6 @@ class Update extends Action
]))
->trigger();
$queueForEvents->setParam('ruleId', $rule->getId());
// Fill response model
$certificate = $dbForPlatform->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$rule->setAttribute('logs', $certificate->getAttribute('logs', ''));
@@ -582,6 +582,14 @@ class ProxyCustomServerTest extends Scope
$this->assertEquals(201, $rule['headers']['status-code']);
$this->assertEquals(RULE_STATUS_GENERATING_CERTIFICATE, $rule['body']['status']);
$this->assertEmpty($rule['body']['verificationLogs']);
$this->assertNotEmpty($rule['body']['$id']);
$ruleId = $rule['body']['$id'];
$rule = $this->updateRuleVerification($ruleId);
$this->assertEquals(200, $rule['headers']['status-code']);
$this->assertEquals($ruleId, $rule['body']['$id']);
$this->assertEquals(RULE_STATUS_GENERATING_CERTIFICATE, $rule['body']['status']);
$this->assertEmpty($rule['body']['verificationLogs']);
$this->cleanupRule($rule['body']['$id']);
$this->cleanupSite($siteId);