Example #1
0
 /**
  * Test building a URI containing template variables, by supplying an
  * associative array of values.
  *
  * @return void
  */
 public function testBuildWithAssocArray()
 {
     $request = $this->buildMockRequest('/test/example', array('host' => 'example.com'));
     $config = $this->buildMockConfiguration();
     $builder = new UriBuilder($config, $request);
     $args = array('arg1' => 'one', 'arg2' => 'two');
     $uri = $builder->path('/{arg1}/abc/{arg2}/def/')->buildFromMap($args);
     $this->assertEquals('http://example.com/test/example/one/abc/two/def', $uri);
 }
Example #2
0
 /**
  * Get the base URI of the application in the form of a UriBuilder.
  *
  * @return \Sonno\Uri\UriBuilder
  */
 public function getBaseUriBuilder()
 {
     $builder = new UriBuilder($this->_config, $this->_request);
     return $builder->replacePath($this->getBaseUri());
 }