File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
functions/slack_slash_command Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 3232function isValidSlackWebhook (ServerRequestInterface $ request ): bool
3333{
3434 /**
35- * PHP Functions Framework does not support "global"/instance-scoped
36- * constants, so we fetch these values within PHP functtions themselves.
35+ * Unlike most other Cloud Functions languages, PHP does not preserve
36+ * global values between requests. Since we don't use this value elsewhere
37+ * in the sample, it's easiest to declare it within this method itself.
3738 */
3839 $ SLACK_SECRET = getenv ('SLACK_SECRET ' );
3940
@@ -111,8 +112,9 @@ function formatSlackMessage($kgResponse, $query): string
111112function searchKnowledgeGraph ($ query ): Google_Service_Kgsearch_SearchResponse
112113{
113114 /**
114- * PHP Functions Framework does not support "global"/instance-scoped
115- * constants, so we fetch these values within PHP functions themselves.
115+ * Unlike most other Cloud Functions languages, PHP does not preserve
116+ * global values between requests. Since we don't use this value elsewhere
117+ * in the sample, it's easiest to declare it within this method itself.
116118 */
117119 $ API_KEY = getenv ("KG_API_KEY " );
118120
Original file line number Diff line number Diff line change @@ -51,7 +51,10 @@ public function testFunction(
5151 ['headers ' => $ headers , 'body ' => $ body ]
5252 );
5353 $ this ->assertEquals (
54- $ statusCode , $ response ->getStatusCode (), $ label . ": status code " );
54+ $ statusCode ,
55+ $ response ->getStatusCode (),
56+ $ label . ": status code "
57+ );
5558
5659 if ($ expected !== null ) {
5760 $ output = (string ) $ response ->getBody ();
You can’t perform that action at this time.
0 commit comments