public function testRenderQueue() { $method = $this->getMock('Helthe\\Component\\Segmentio\\Method\\MethodInterface'); $queue = $this->getMock('Helthe\\Component\\Segmentio\\Queue'); $renderer = new Renderer(); $method->expects($this->once())->method('supports')->with($this->equalTo('browser'))->will($this->returnValue(true)); $method->expects($this->once())->method('getName')->will($this->returnValue('foo')); $method->expects($this->once())->method('getArguments')->will($this->returnValue(array('bar', null, array(), array('foo' => 'bar')))); $queue->expects($this->at(0))->method('dequeue')->with($this->equalTo('browser'))->will($this->returnValue($method)); $queue->expects($this->at(1))->method('dequeue')->with($this->equalTo('browser'))->will($this->returnValue(null)); $this->assertEquals('window.analytics.foo("bar",null,[],{"foo":"bar"});', $renderer->renderQueue($queue)); }
/** * Renders the method queue stored in the client. * * @return string */ public function queue() { return $this->renderer->renderQueue($this->client->getQueue()); }