Skip to content

Commit

Permalink
Promote steps
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos committed Mar 22, 2024
1 parent 76550bd commit 2a890b1
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
class FeatureContext extends NextcloudApiContext implements OpenedEmailStorageAwareContext {
private array $signer = [];
private array $file = [];
private array $fields = [];
private OpenedEmailStorage $openedEmailStorage;

/**
Expand Down Expand Up @@ -125,25 +124,6 @@ protected function beforeRequest(string $fullUrl, array $options): array {
return [$fullUrl, $options];
}

protected function parseFormParams(array $options): array {
if (!empty($options['form_params'])) {
$this->parseTextRcursive($options['form_params']);
}
return $options;
}

private function parseTextRcursive(&$array): array {
array_walk_recursive($array, function (&$value) {
if (is_string($value)) {
$value = $this->parseText($value);
} elseif ($value instanceof \stdClass) {
$value = (array) $value;
$value = json_decode(json_encode($this->parseTextRcursive($value)));
}
});
return $array;
}

protected function parseText(string $text): string {
$patterns = [
'/<SIGN_UUID>/',
Expand All @@ -160,6 +140,7 @@ protected function parseText(string $text): string {
$replacements[] = $value;
}
$text = preg_replace($patterns, $replacements, $text);
$text = parent::parseText($text);
return $text;
}

Expand Down Expand Up @@ -287,21 +268,6 @@ public function deleteSignerFromFileOfPreviousListing(int $signerSequence, int $
$this->sendOCSRequest('delete', '/apps/libresign/api/v1/sign/file_id/' . $fileId . '/'. $signRequestId);
}

/**
* @When fetch field :path from prevous JSON response
*/
public function fetchFieldFromPreviousJsonResponse(string $path): void {
$this->response->getBody()->seek(0);
$responseArray = json_decode($this->response->getBody()->getContents(), true);
$keys = explode('.', $path);
$value = $responseArray;
foreach ($keys as $key) {
Assert::assertArrayHasKey($key, $value, 'Key [' . $key . '] of path [' . $path . '] not found.');
$value = $value[$key];
}
$this->fields[$path] = $value;
}

/**
* @When /^wait for ([0-9]+) (second|seconds)$/
*/
Expand Down

0 comments on commit 2a890b1

Please sign in to comment.