예제 #1
0
 /**
  * Tests setQuery().
  */
 public function testSetQuery()
 {
     $url = new Net_URL2('http://www.example.com/');
     $url->setQuery('flapdoodle&dilly%20all%20day');
     $this->assertEquals($url->getURL(), 'http://www.example.com/?flapdoodle&dilly%20all%20day');
 }
예제 #2
0
 /**
  * Test parsing of query variables
  *
  * @param string $query    string
  * @param mixed  $expected null to test against parse_str() behavior
  * @param array  $options  Net_URL2 options
  *
  * @dataProvider provideQueryStrings
  * @covers       Net_URL2::getQueryVariables
  * @covers       Net_URL2::_queryArrayByKey
  * @covers       Net_URL2::_queryArrayByBrackets
  * @covers       Net_URL2::_queryKeyBracketOffset
  * @return void
  */
 public function testGetQueryVariables($query, $expected = null, array $options = array())
 {
     $options = $this->_translateOptionData($options);
     $url = new Net_URL2('', $options);
     if ($expected === null) {
         // parse_str() is in PHP before copy on write, therefore
         // it uses pass-by-reference for $expected to return
         // the array
         parse_str($query, $expected);
     }
     // Xdebug: If breakpoints are ignored, see Xdebug Issue 0000924
     $url->setQuery($query);
     $actual = $url->getQueryVariables();
     // Do two assertions, because the first one shows a more nice diff in case
     // it fails and the second one is actually strict which is what has to be
     // tested.
     $this->assertEquals($expected, $actual);
     $this->assertSame($expected, $actual);
 }