/** * Test sending a request with bad credentials and SSL verification off. */ public function testSendResponseWithSslOptionFalse() { $sendgrid = new \SendGrid\Client('token123456789', ['switch_off_ssl_verification' => TRUE]); $email = new \SendGrid\Email(); $email->setFrom('*****@*****.**')->setSubject('foobar subject')->setText('foobar text')->addTo('*****@*****.**')->addAttachment('./tests/text'); try { $response = $sendgrid->send($email); } catch (\GuzzleHttp\Exception\ClientException $e) { $response = $e->getResponse(); $responseBodyAsString = $response->getBody()->getContents(); } $this->assertContains('The provided authorization grant is invalid, expired, or revoked', $responseBodyAsString); }