public function testStaticQueuedMessages() { if ($this->skip) { return; } Campfire\Facade::queue('PHPUnit: Testing static - testStaticQueuedMessages 1'); Campfire\Facade::queue('PHPUnit: Testing static - testStaticQueuedMessages 2'); Campfire\Facade::queue('PHPUnit: Testing static - testStaticQueuedMessages 3'); Campfire\Facade::send(); }
public function testStaticEmptyQueueAfterSend() { $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); $http->shouldReceive('post')->withAnyArgs()->andReturn($request); Facade::destroy(); Facade::init($this->config, $http); Facade::queue('Test 1'); Facade::queue('Test 2'); Facade::queue('Test 3'); Facade::send(); // Make sure that the queue is now empty $campfire = Facade::instance(); $refObj = new \ReflectionObject($campfire); $refProp = $refObj->getProperty('queue'); $refProp->setAccessible(true); $queue = $refProp->getValue($campfire); $this->assertEquals(count($queue), 0); // Make sure we now get the empty queue exception try { Facade::send(); $this->assertFalse(true); } catch (Campfire\Exceptions\TransportException $ex) { $this->assertTrue(true); } catch (\Exception $ex) { $this->assertFalse(true); } }