public function testGetUrlProperlyFormatsUrl() { $p = new Paginator($env = m::mock('DeSmart\\Pagination\\Factory'), array('foo', 'bar', 'baz'), 3, 2); $env->shouldReceive('getCurrentUrl')->twice()->andReturn('http://foo.com'); $env->shouldReceive('getPageName')->atLeast(2)->andReturn('page'); $this->assertEquals('http://foo.com?page=1', $p->getUrl(1)); $p->addQuery('foo', 'bar'); $this->assertEquals('http://foo.com?foo=bar&page=1', $p->getUrl(1)); }