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 testGetSummary() { $curlResponse = CurlResponse::create(JsonLoader::getSummary(), array('http_code' => 200)); $this->restClient->expects($this->once())->method('get')->with()->will($this->returnValue($curlResponse)); $summary = $this->campaignTrackingService->getSummary('access_token', 1100394165290); $this->assertInstanceOf('Ctct\\Components\\Tracking\\TrackingSummary', $summary); $this->assertEquals(15, $summary->sends); $this->assertEquals(10, $summary->opens); $this->assertEquals(10, $summary->clicks); $this->assertEquals(3, $summary->forwards); $this->assertEquals(2, $summary->unsubscribes); $this->assertEquals(18, $summary->bounces); }