public static function setUpBeforeClass()
 {
     self::$client = new Client();
     $getBouncesStream = Stream::factory(JsonLoader::getBounces());
     $getClicksStream = Stream::factory(JsonLoader::getClicks());
     $getForwardsStream = Stream::factory(JsonLoader::getForwards());
     $getUnsubscribesStream = Stream::factory(JsonLoader::getOptOuts());
     $getSendsStream = Stream::factory(JsonLoader::getSends());
     $getOpensStream = Stream::factory(JsonLoader::getOpens());
     $getSummaryStream = Stream::factory(JsonLoader::getSummary());
     $mock = new Mock([new Response(200, array(), $getBouncesStream), new Response(200, array(), $getClicksStream), new Response(200, array(), $getForwardsStream), new Response(200, array(), $getUnsubscribesStream), new Response(200, array(), $getSendsStream), new Response(200, array(), $getOpensStream), new Response(200, array(), $getSummaryStream)]);
     self::$client->getEmitter()->attach($mock);
 }
 public function testGetUnsubscribes()
 {
     $curlResponse = CurlResponse::create(JsonLoader::getOptOuts(), array('http_code' => 200));
     $this->restClient->expects($this->once())->method('get')->with()->will($this->returnValue($curlResponse));
     $resultSet = $this->campaignTrackingService->getUnsubscribes('access_token', "1100394165290", array('limit' => 2));
     $this->assertInstanceOf('Ctct\\Components\\ResultSet', $resultSet);
     $this->assertInstanceOf('Ctct\\Components\\Tracking\\UnsubscribeActivity', $resultSet->results[0]);
     $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next);
     $this->assertEquals("EMAIL_UNSUBSCRIBE", $resultSet->results[0]->activity_type);
     $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id);
     $this->assertEquals("58", $resultSet->results[0]->contact_id);
     $this->assertEquals("*****@*****.**", $resultSet->results[0]->email_address);
     $this->assertEquals("2012-12-06T13:06:53.440Z", $resultSet->results[0]->unsubscribe_date);
     $this->assertEquals("ACTION_BY_CUSTOMER", $resultSet->results[0]->unsubscribe_source);
     $this->assertEquals("", $resultSet->results[0]->unsubscribe_reason);
 }