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 testGetClicks() { $curlResponse = CurlResponse::create(JsonLoader::getClicks(), array('http_code' => 200)); $this->restClient->expects($this->once())->method('get')->with()->will($this->returnValue($curlResponse)); $resultSet = $this->campaignTrackingService->getClicks('access_token', "1100394165290", array('limit' => 2)); $this->assertInstanceOf('Ctct\\Components\\ResultSet', $resultSet); $this->assertInstanceOf('Ctct\\Components\\Tracking\\ClickActivity', $resultSet->results[0]); $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_CLICK", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("69", $resultSet->results[0]->contact_id); $this->assertEquals("*****@*****.**", $resultSet->results[0]->email_address); $this->assertEquals(0, $resultSet->results[0]->link_id); $this->assertEquals("2012-12-06T13:07:01.701Z", $resultSet->results[0]->click_date); }