public function testUpdateByProfileId() { $client = new NextCallerClient(null, null, true); $data = json_decode(self::JSON_DATA, true); $response = $client->updateByProfileId(self::PROFILE_ID, $data); $this->assertEquals($response, null); }
public function testNotValid() { $client = new NextCallerClient(null, null, true); try { $client->updateByProfileId(self::PROFILE_ID, array('email' => 'XXXXXXXXXXXX')); } catch (BadResponseException $expected) { $this->assertEquals(400, $expected->getResponse()->getStatusCode()); $this->assertEquals(422, $expected->getCode()); return; } $this->fail('An expected exception has not been raised.'); }
<?php require __DIR__ . '/vendor/autoload.php'; use NextCaller\NextCallerClient; $user = ""; $password = ""; $id = "c7c17736128033c92771b7f33fead7"; $sandbox = true; $data = array("email" => 'xxx'); $client = new NextCallerClient($user, $password, $sandbox); try { $client->updateByProfileId($id, $data); } catch (\NextCaller\Exception\RateLimitException $e) { var_dump($e->getRateLimit()); var_dump($e->getResetTime()); } catch (\NextCaller\Exception\BadResponseException $e) { // Example // 422 var_dump($e->getCode()); // Validation Error var_dump($e->getMessage()); /* array( 'message' => 'Validation Error', 'code' => '422', 'type' => 'Unprocessable Entity', 'description' => array( 'email' => array('Invalid email address') ) ); */