public static function setUpBeforeClass() { self::$client = new Client(); $verifiedAddressStream = Stream::factory(JsonLoader::getVerifiedAddressesJson()); $accountInfoStream = Stream::factory(JsonLoader::getAccountInfoJson()); $mock = new Mock([new Response(200, array(), $verifiedAddressStream), new Response(200, array(), $accountInfoStream)]); self::$client->getEmitter()->attach($mock); }
public function testGetAccountInfo() { $curlResponse = CurlResponse::create(JsonLoader::getAccountInfoJson(), array('http_code' => 200)); $this->restClient->expects($this->once())->method('get')->with()->will($this->returnValue($curlResponse)); $response = $this->accountService->getAccountInfo("accessToken"); $this->assertInstanceOf('Ctct\\Components\\Account\\AccountInfo', $response); $this->assertEquals("http://www.example.com", $response->website); $this->assertEquals("My Company", $response->organization_name); $this->assertEquals("http://www.example.com", $response->website); $this->assertEquals("My Company", $response->organization_name); $this->assertEquals("US/Eastern", $response->time_zone); $this->assertEquals("Mary Jane", $response->first_name); $this->assertEquals("Doe", $response->last_name); $this->assertEquals("*****@*****.**", $response->email); $this->assertEquals("5555555555", $response->phone); $this->assertEquals("https://ih.constantcontact.com/fs137/1100371573368/img/90.jpg", $response->company_logo); $this->assertEquals("US", $response->country_code); $this->assertEquals("MA", $response->state_code); }