public function testWrongId() { $client = new NextCallerClient(null, null, true); try { $client->getByProfileId(self::PROFILE_ID_WRONG); } catch (BadResponseException $expected) { $this->assertEquals(400, $expected->getResponse()->getStatusCode()); $this->assertEquals(558, $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; $client = new NextCallerClient($user, $password, $sandbox); try { $profile = $client->getByProfileId($id); /* array( 'id' => 'c7c17736128033c92771b7f33fead7', 'first_name' => 'James', 'middle_name' => '', 'last_name' => 'Johnson', 'name' => 'James Johnson', 'language' => 'English', 'phone' => array( array( 'number' => '2125558345', 'resource_uri' => '/v2/records/2125558345/', ) ), 'carrier' => 'Allied Wireless Communication Llc Dba Alltel - Sc', 'address' => array( array( 'city' => 'Orangeburg', 'extended_zip' => '5320', 'country' => 'USA',
public function testGetByProfileId() { $client = new NextCallerClient(null, null, true); $profile = $client->getByProfileId(self::PROFILE_ID); $this->assertEquals($profile, json_decode(self::JSON_RESPONSE, true)); }