FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support array result include sequence action by ningyougang · Pull Request #120 · apache/openwhisk-runtime-php · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .scala  (1) No extension  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions core/php7.4Action/Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \

# or build it from a release
FROM golang:1.18 AS builder_release
ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
RUN curl -sL \
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
| tar xzf -\
&& cd openwhisk-runtime-go-*/main\
&& GO111MODULE=on go build -o /bin/proxy
&& GO111MODULE=on GO111MODULE=on go build -o /bin/proxy

FROM php:7.4-cli-buster

Expand Down
4 changes: 2 additions & 2 deletions core/php8.0Action/Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \

# or build it from a release
FROM golang:1.18 AS builder_release
ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
RUN curl -sL \
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
| tar xzf -\
&& cd openwhisk-runtime-go-*/main\
&& GO111MODULE=on go build -o /bin/proxy
&& GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy

FROM php:8.0-cli-buster

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,49 @@ abstract class Php7ActionContainerTests extends BasicActionRunnerTests with WskA
runRes.get.fields.get("result") shouldBe Some(JsString("it works"))
}
}

it should "support return array result" in {
val srcs = Seq(
Seq("index.php") ->
"""
| <?php
| function main(array $args) : array
| {
| $result=array("a","b");
| return $result;
| }
""".stripMargin)

val code = ZipBuilder.mkBase64Zip(srcs)

withPhp7Container { c =>
c.init(initPayload(code))._1 should be(200)

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

}
}

it should "support array as input param" in {
val srcs = Seq(
Seq("index.php") ->
"""
| <?php
| function main(array $args) : array
| {
| return $args;
| }
""".stripMargin)

val code = ZipBuilder.mkBase64Zip(srcs)

withPhp7Container { c =>
c.init(initPayload(code))._1 should be(200)

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

Back | FazBrowse Home | New Git URL