@@ -39,17 +39,28 @@ class DeployTest extends TestCase
3939 public function testFunction (): void
4040 {
4141 // Send a request to the function.
42- $ resp = $ this ->client ->post ('' , [
42+ $ firstResp = $ this ->client ->post ('' , [
4343 // Uncomment and CURLOPT_VERBOSE debug content will be sent to stdout.
4444 // 'debug' => true
4545 ]);
46+ $ secondResp = $ this ->client ->post ('' , [
47+ // Uncomment and CURLOPT_VERBOSE debug content will be sent to stdout.
48+ // 'debug' => true
49+ ]);
50+
51+ // Assert status codes.
52+ $ this ->assertEquals ('200 ' , $ firstResp ->getStatusCode ());
53+ $ this ->assertEquals ('200 ' , $ secondResp ->getStatusCode ());
54+
55+ $ firstOutput = trim ((string ) $ firstResp ->getBody ());
56+ $ secondOutput = trim ((string ) $ secondResp ->getBody ());
4657
47- // Assert status code.
48- $ this ->assertEquals ('200 ' , $ resp ->getStatusCode ());
58+ // Assert generic function output.
59+ $ this ->assertContains ('Per instance: 120 ' , $ firstOutput );
60+ $ this ->assertContains ('Per function: 15 ' , $ firstOutput );
4961
50- // Assert function output.
51- $ output = trim ((string ) $ resp ->getBody ());
52- $ this ->assertContains ('Per instance: 120 ' , $ output );
53- $ this ->assertContains ('Per function: 15 ' , $ output );
62+ // Assert caching behavior.
63+ $ this ->assertContains ('Cache empty ' , $ firstOutput );
64+ $ this ->assertContains ('Reading cached value ' , $ secondOutput );
5465 }
5566}
0 commit comments