Example #1
0
 /**
  * Tests the function to explode a given URL to different forms
  */
 function testPrefixes()
 {
     $a = GSB_UrlUtil::makePrefixes('www.google.com', '/foo/bar', 'a=b&c=d', false);
     $expected = array('www.google.com/foo/bar?a=b&c=d', 'www.google.com/foo/bar', 'www.google.com/', 'www.google.com/foo/', 'google.com/foo/bar?a=b&c=d', 'google.com/foo/bar', 'google.com/', 'google.com/foo/');
     $this->assertEquals($expected, $a);
     $expected = array('a.b.c/1/2.html?param=1', 'a.b.c/1/2.html', 'a.b.c/', 'a.b.c/1/', 'b.c/1/2.html?param=1', 'b.c/1/2.html', 'b.c/', 'b.c/1/');
     $a = GSB_UrlUtil::makePrefixes('a.b.c', '/1/2.html', 'param=1', false);
     $this->assertEquals($expected, $a);
     $expected = array('a.b.c.d.e.f.g/1.html', 'a.b.c.d.e.f.g/', 'c.d.e.f.g/1.html', 'c.d.e.f.g/', 'd.e.f.g/1.html', 'd.e.f.g/', 'e.f.g/1.html', 'e.f.g/', 'f.g/1.html', 'f.g/');
     $a = GSB_UrlUtil::makePrefixes('a.b.c.d.e.f.g', '/1.html', NULL, false);
     $this->assertEquals($expected, $a);
     $expected = array('1.2.3.4/1/', '1.2.3.4/');
     $a = GSB_UrlUtil::makePrefixes('1.2.3.4', '/1/', NULL, true);
     $this->assertEquals($expected, $a);
 }