@@ -95,20 +95,23 @@ public function testHttpClientSet()
9595 $ this ->assertTrue (array_key_exists ("app " , (array )$ response ));
9696 }
9797
98- public function testStreamResponse ()
99- {
100- $ response = $ this ->client ->getAppSettings ();
101- $ rateLimits = $ response ->getRateLimits ();
102-
103- $ this ->assertEquals (200 , $ response ->getStatusCode ());
104- $ this ->assertGreaterThan (0 , $ rateLimits ->getLimit ());
105- $ this ->assertGreaterThan (0 , $ rateLimits ->getRemaining ());
106- $ this ->assertNotNull ($ rateLimits ->getReset ());
107-
108- $ serialized = json_encode ($ response );
109- $ this ->assertFalse (str_contains ($ serialized , "rate " ));
110- $ this ->assertTrue (str_starts_with ($ serialized , '{"app" ' ));
111- }
98+ // Disabling following test sincewe don't add rate limits from backend anymore
99+ // for non-limited api calls
100+ //
101+ // public function testStreamResponse()
102+ // {
103+ // $response = $this->client->getAppSettings();
104+ // $rateLimits = $response->getRateLimits();
105+
106+ // $this->assertEquals(200, $response->getStatusCode());
107+ // $this->assertGreaterThan(0, $rateLimits->getLimit());
108+ // $this->assertGreaterThan(0, $rateLimits->getRemaining());
109+ // $this->assertNotNull($rateLimits->getReset());
110+
111+ // $serialized = json_encode($response);
112+ // $this->assertFalse(str_contains($serialized, "rate"));
113+ // $this->assertTrue(str_starts_with($serialized, '{"app"'));
114+ // }
112115
113116 public function testAuth ()
114117 {
@@ -524,6 +527,22 @@ public function testUpdateMessage()
524527 $ this ->client ->updateMessage ($ msg );
525528 }
526529
530+ public function testPendingMessage ()
531+ {
532+ $ msgId = $ this ->generateGuid ();
533+ $ msg = ["id " => $ msgId , "text " => "hello world " ];
534+ $ response1 = $ this ->channel ->sendMessage ($ msg , $ this ->user1 ["id " ], null , ["pending " => true ]);
535+ $ this ->assertSame ($ msgId , $ response1 ["message " ]["id " ]);
536+
537+ $ response = $ this ->client ->queryChannels (["id " => $ this ->channel ->id ], null , ['user_id ' => $ this ->user1 ["id " ]]);
538+ // check if length of $response["channels"][0]['pending_messages']) is 1
539+ $ this ->assertSame (1 , sizeof ($ response ["channels " ][0 ]['pending_messages ' ]));
540+
541+
542+ $ response2 = $ this ->client ->commitMessage ($ msgId );
543+ $ this ->assertSame ($ msgId , $ response2 ["message " ]["id " ]);
544+ }
545+
527546 public function testDeleteMessage ()
528547 {
529548 $ msgId = $ this ->generateGuid ();
0 commit comments