/**
* Test setting/getting the first party cookie via the PHP Tracking Client
* @param $t
*/
private function testFirstPartyCookies(PiwikTracker $t)
{
$domainHash = $this->getFirstPartyCookieDomainHash();
$idCookieName = '_pk_id_1_' . $domainHash;
$refCookieName = '_pk_ref_1_' . $domainHash;
$customVarCookieName = '_pk_cvar_1_' . $domainHash;
$viewts = '1302307497';
$uuid = 'ca0afe7b6b692ff5';
$_COOKIE[$idCookieName] = $uuid . '.1302307497.1.' . $viewts . '.1302307497';
$_COOKIE[$refCookieName] = '["YEAH","RIGHT!",1302307497,"http://referrer.example.org/page/sub?query=test&test2=test3"]';
$_COOKIE[$customVarCookieName] = '{"1":["VAR 1 set, var 2 not set","yes"],"3":["var 3 set","yes!!!!"]}';
// test loading 'id' cookie
self::assertContains("_viewts=" . $viewts, $t->getUrlTrackPageView());
self::assertEquals($uuid, $t->getVisitorId());
self::assertEquals($t->getAttributionInfo(), $_COOKIE[$refCookieName]);
self::assertEquals(array("VAR 1 set, var 2 not set", "yes"), $t->getCustomVariable(1));
self::assertFalse($t->getCustomVariable(2));
self::assertEquals(array("var 3 set", "yes!!!!"), $t->getCustomVariable(3));
self::assertFalse($t->getCustomVariable(4));
self::assertFalse($t->getCustomVariable(5));
self::assertFalse($t->getCustomVariable(6));
self::assertFalse($t->getCustomVariable(-1));
unset($_COOKIE[$idCookieName]);
unset($_COOKIE[$refCookieName]);
unset($_COOKIE[$customVarCookieName]);
}