public function testStaticOneMessage() { if ($this->skip) { return; } Campfire\Facade::init($this->config); Campfire\Facade::msg('PHPUnit: Testing static - testStaticOneMessage'); }
public function testStaticSingleMessageSuccess() { $response = m::mock('Guzzle\\Http\\Message\\Response'); $response->shouldReceive('getStatusCode')->andReturn(201); $request = m::mock('Guzzle\\Http\\Message\\Request'); $request->shouldReceive('send')->andReturn($response); $http = new Http('https://' . $this->config['subdomain'] . '.campfirenow.com/room/' . $this->config['room']); $http = m::mock($http); $self = $this; $checked = FALSE; $http->shouldReceive('post')->withAnyArgs()->andReturnUsing(function ($path, $headers, $json) use(&$self, &$checked, $request) { $self->assertEquals($path, 'speak.json'); $self->assertEquals($headers['Accept'], 'application/json'); $self->assertEquals($headers['Content-type'], 'application/json'); $self->assertEquals($headers['User-Agent'], 'rcrowe/Campfire'); $self->assertEquals($json, '{"message":{"type":"TextMessage","body":"This is an example message that I might send"}}'); $checked = TRUE; return $request; }); Facade::destroy(); Facade::init($this->config, $http); Facade::msg('This is an example message that I might send'); if (!$checked) { $this->assertFalse(true); } }