Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support array result include sequence action #120

Conversation

ningyougang
Copy link
Contributor

@ningyougang ningyougang commented Jul 25, 2022

Depend on below prs:

@ningyougang
Copy link
Contributor Author

The steps of test Support array result for sequence action in php

  • Write split.php and sort.php
[root@nccddev130026 workspace]# cat ~/split.php 
<?php
function main(array $args) : array
{
    $payload = $args["payload"] ?? "aaaa\nbbbbb\ncccccc";
    $separator = $args["separator"] ?? "\n";
    $result = explode($separator,$payload);
    return $result;
}

[root@nccddev130026 workspace]# cat ~/sort.php 
<?php
function main(array $args) : array
{
    $result = array_reverse($args);
    return $result;
}
  • Create sequence action and invoke it (I tested php:7.4/8.0, worked well both)
wsk -i action create /whisk.system/utils/split-php --kind php:7.4 ~/split.php
wsk -i action create /whisk.system/utils/sort-php --kind php:7.4 ~/sort.php
wsk -i action create mySequence-php --sequence /whisk.system/utils/split-php,/whisk.system/utils/sort-php
wsk -i action invoke --result mySequence-php --param payload "dddd\nbbbb\ncccc\nfffffff\nggggggggg" -r -v

@ningyougang ningyougang force-pushed the support-array-result-include-sequence-action branch from d58c0b6 to 96ba90a Compare August 8, 2022 03:21

val (runCode, runRes) = c.run(runPayload(JsObject()))
runCode should be(200)
runRes shouldBe Some(JsObject("0" -> JsString("a"), "1" -> JsString("b")))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems php is special, it will return JsObject with index(0, 1, 2....N+1) when php codes return array.

Copy link
Member

@dgrove-oss dgrove-oss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dgrove-oss dgrove-oss merged commit c587ae4 into apache:master Aug 15, 2022
msciabarra pushed a commit to nuvolaris/openwhisk-runtime-php that referenced this pull request Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants