ningyougang commented on code in PR #120:
URL: 
https://github.com/apache/openwhisk-runtime-php/pull/120#discussion_r939796164


##########
tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala:
##########
@@ -486,4 +481,45 @@ 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")))

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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to