public function testMixedValidInvalidToArray() { $client = new HttpClient(new ConnectionConfig(getenv('OPILO_URL')), new Account(getenv('OPILO_USERNAME'), getenv('OPILO_PASSWORD'))); $response = $client->sendSMS(getenv('PANEL_LINE'), 'junk,' . getenv('DESTINATION'), 'text'); $this->assertCount(2, $response); $this->assertInstanceOf(SendError::class, $response[0]); $this->assertEquals(SendError::ERROR_INVALID_DESTINATION, $response[0]->getError()); $this->assertInstanceOf(SMSId::class, $response[1]); }
public function testSendMultipleSMS() { $initCredit = $this->client->getCredit()->getSmsPageCount(); $to = []; $text = 'legacy::testSendMultipleSMS()'; for ($i = 0; $i < 10; $i++) { $to[] = getenv('DESTINATION'); } $response = $this->client->sendSMS(getenv('PANEL_LINE'), $to, $text); $this->assertCount(10, $response); $ids = []; foreach ($response as $id) { $this->assertInstanceOf(SMSId::class, $id); $ids[] = $id->getId(); } $status = $this->client->checkStatus($ids); $this->assertCount(10, $status); foreach ($status as $stat) { $this->assertInstanceOf(Status::class, $stat); } $finalCredit = $this->client->getCredit()->getSmsPageCount(); $this->assertLessThanOrEqual(10, $initCredit - $finalCredit); }