public function testBuildGETArray()
 {
     $a = array('a' => true, 'B' => 10, 'c' => 'test');
     $this->assertEquals(array(), PU_BuildGETArray(array()));
     $this->assertEquals($a, PU_BuildGETArray($a));
     $this->assertEquals(array('a' => true, 'B' => 10, 'c' => 'test', 'D' => 'testing'), PU_BuildGETArray($a, array('D' => 'testing')));
     $this->assertEquals(array('a' => true, 'c' => 'test'), PU_BuildGETArray($a, null, array('B')));
     $this->assertEquals(array('a' => true, 'c' => 'test', 'D' => 'testing'), PU_BuildGETArray($a, array('D' => 'testing'), array('B')));
     $this->setExpectedException('PHPUnit_Framework_Error');
     PU_BuildGETArray('test');
 }
/**
 * Build a url with GET parameters
 *
 * @param string|array $target (optional) string: the target script url (current script if missing)
 * @param array $includeInGet	(optional) array of pairs: parameters to add as GET in the url
 * @param array $excludeFromGet (optional) array of strings: parameters to remove from GET in the url
 * @return string the built url
 *
 * @version 1.1
 * @author greg
 *
 * @date 20100930 (v1.1) (greg) $target parameter can now be an array resulting from php's parse_url function
 */
function PU_BuildURL($target = null, $includeInGet = null, $excludeFromGet = null, $glue = '&')
{
    if (is_null($target)) {
        $target = $_SERVER["REQUEST_URI"];
    }
    if (!is_array($target)) {
        $target = parse_url($target);
    }
    if (empty($target['query'])) {
        $tarGET = $_GET;
    } else {
        parse_str($target['query'], $tarGET);
        $tarGET = array_merge($_GET, $tarGET);
    }
    $myGET = PU_BuildGETArray($tarGET, $includeInGet, $excludeFromGet);
    $target['query'] = PU_BuildGETString($myGET, $glue);
    $target = PU_buildParsedURL($target);
    return $target;
}