Example #1
0
 /**
  * Test the getQuery method.
  *
  * @return  void
  *
  * @since   1.0
  * @covers  Joomla\Uri\Uri::getQuery
  */
 public function testGetQuery()
 {
     $this->assertThat($this->object->getQuery(), $this->equalTo('var=value'));
     $this->assertThat($this->object->getQuery(true), $this->equalTo(array('var' => 'value')));
     // Set a new query
     $this->object->setQuery('somevar=somevalue');
     // Test if query is null, to build query in getQuery call.
     $this->assertThat($this->object->getQuery(), $this->equalTo('somevar=somevalue'));
 }
 /**
  * Build route by resource setting.
  *
  * @param string $name       The route name.
  * @param array  $queries    The queries.
  * @param bool   $rootSlash  Add root slash or not.
  *
  * @return  array|string  Segments, can be string or array.
  */
 public function build($name, $queries = array(), $rootSlash = false)
 {
     $segments = parent::build($name, $queries, $rootSlash);
     $uri = new Uri($segments);
     $segments = $uri->getPath();
     $this->queries = $uri->getQuery(true);
     return explode('/', $segments);
 }
Example #3
0
 /**
  * Test the getQuery method.
  *
  * @return  void
  *
  * @since   1.0
  * @covers  Joomla\Uri\Uri::getQuery
  */
 public function testGetQuery()
 {
     $this->assertThat($this->object->getQuery(), $this->equalTo('var=value'));
     $this->assertThat($this->object->getQuery(true), $this->equalTo(array('var' => 'value')));
 }