Commit ce56733e6d48fcd9992e856aac0ad68c34bab1c2

Authored by nbm
1 parent 371525c4

Tests for KTUtil::addQueryString


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4530 c91229c3-7414-0410-bfa2-8a42b809f60b
tests/util/ktutil/testAddQueryString.php 0 → 100644
  1 +<?php
  2 +
  3 +require_once("../../../config/dmsDefaults.php");
  4 +require_once(KT_LIB_DIR . "/util/ktutil.inc");
  5 +
  6 +$aTestVals = array(
  7 + "http://foo.bar/foo.php?foo=bar" => array("http://foo.bar/foo.php", "foo=bar"),
  8 + "http://foo.bar/foo.php?foo=bar&bar=baz" => array("http://foo.bar/foo.php?foo=bar", "bar=baz"),
  9 + "http://foo.bar/foo.php?foo=bar&bar=baz&baz=quux" => array("http://foo.bar/foo.php?foo=bar", "bar=baz&baz=quux"),
  10 + "http://foo.bar/foo.php" => array("http://foo.bar/foo.php", ""),
  11 +);
  12 +
  13 +foreach ($aTestVals as $sExpected => $aArgs) {
  14 + $sResult = KTUtil::addQueryString($aArgs[0], $aArgs[1]);
  15 + if ($sResult !== $sExpected) {
  16 + print "FAIL!\n";
  17 + print "Expected: $sExpected\n";
  18 + print "Received: $sResult\n";
  19 + }
  20 +}
  21 +
... ...