@@ -35,7 +35,7 @@ public function endpoint_timeout_is_15_minutes() {
3535 }
3636
3737 #[Test]
38- public function return_function () {
38+ public function return_lambda_function () {
3939 $ invokeable = (new RuntimeApi ('localhost:9000 ' ))->invokeable (function ($ event , $ context ) {
4040 return 'Test ' ;
4141 });
@@ -52,19 +52,24 @@ public function process($event, $context) { return 'Test'; }
5252 Assert::equals ('Test ' , ($ invokeable ->callable )(null , new Context ($ this ->headers , [])));
5353 }
5454
55+ #[Test]
56+ public function return_streaming_function () {
57+ $ invokeable = (new RuntimeApi ('localhost:9000 ' ))->invokeable (function ($ event , $ stream , $ context ) {
58+ $ stream ->write ('Test ' );
59+ });
60+
61+ $ stream = new TestStream ();
62+ ($ invokeable ->callable )(null , $ stream , new Context ($ this ->headers , []));
63+ Assert::equals ('Test ' , $ stream ->written );
64+ }
65+
5566 #[Test]
5667 public function return_streaming () {
5768 $ invokeable = (new RuntimeApi ('localhost:9000 ' ))->invokeable (new class () implements Streaming {
5869 public function handle ($ event , $ stream , $ context ) { $ stream ->write ('Test ' ); }
5970 });
60- $ stream = new class () implements Stream {
61- public $ written = '' ;
62- public function transmit ($ source , $ mime = null ) { /* NOOP */ }
63- public function use ($ mime ) { /** NOOP */ }
64- public function write ($ bytes ) { $ this ->written .= $ bytes ; }
65- public function end () { /** NOOP */ }
66- };
6771
72+ $ stream = new TestStream ();
6873 ($ invokeable ->callable )(null , $ stream , new Context ($ this ->headers , []));
6974 Assert::equals ('Test ' , $ stream ->written );
7075 }
0 commit comments