public static function setUpBeforeClass() { self::$client = new Client(); $schedulesStream = Stream::factory(JsonLoader::getCampaignSchedulesJson()); $scheduleStream = Stream::factory(JsonLoader::getCampaignScheduleJson()); $testSendStream = Stream::factory(JsonLoader::getTestSendJson()); $mock = new Mock([new Response(200, array(), $schedulesStream), new Response(200, array(), $scheduleStream), new Response(201, array(), $scheduleStream), new Response(200, array(), $scheduleStream), new Response(204, array()), new Response(400, array()), new Response(200, array(), $testSendStream)]); self::$client->getEmitter()->attach($mock); }
public function testSendTest() { $curlResponse = CurlResponse::create(JsonLoader::getTestSendJson(), array('http_code' => 201)); $this->restClient->expects($this->once())->method('post')->with()->will($this->returnValue($curlResponse)); $testSend = $this->campaignScheduleService->sendTest('access_token', "9100367935463", new TestSend()); $this->assertInstanceOf('Ctct\\Components\\EmailMarketing\\TestSend', $testSend); $this->assertEquals("HTML", $testSend->format); $this->assertEquals("oh hai there", $testSend->personal_message); $this->assertEquals("*****@*****.**", $testSend->email_addresses[0]); }