本文整理汇总了PHP中StringUtil::resolveHashForQueryStringArray方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::resolveHashForQueryStringArray方法的具体用法?PHP StringUtil::resolveHashForQueryStringArray怎么用?PHP StringUtil::resolveHashForQueryStringArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::resolveHashForQueryStringArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CampaignItemActivity
/**
* @depends testResolveQueryStringFromUrlAndCreateOrUpdateActivityThrowsExceptionForInvalidPersonIdForUrlClickTracking
* @expectedException NotSupportedException
*/
public function testResolveQueryStringFromUrlAndCreateOrUpdateActivityThrowsExceptionForDuplicateActivityForUrlClickTracking()
{
// setup pre-req data
$campaignItemActivities = CampaignItemActivity::getByType(CampaignItemActivity::TYPE_CLICK);
$this->assertNotEmpty($campaignItemActivities);
$campaignActivity = new CampaignItemActivity();
$campaignActivity->quantity = $campaignItemActivities[0]->quantity;
$campaignActivity->type = $campaignItemActivities[0]->type;
$campaignActivity->campaignItem = $campaignItemActivities[0]->campaignItem;
$campaignActivity->person = $campaignItemActivities[0]->person;
$campaignActivity->emailMessageUrl = $campaignItemActivities[0]->emailMessageUrl;
$this->assertTrue($campaignActivity->save());
$modelId = $campaignItemActivities[0]->campaignItem->id;
$modelType = get_class($campaignItemActivities[0]->campaignItem);
$personId = $campaignItemActivities[0]->person->id;
// get the modelClassName to use for activity object tests
$className = 'CampaignItemActivityUtil';
$resolveModelClassNameByModelTypeFunction = static::getProtectedMethod($className, 'resolveModelClassNameByModelType');
$modelClassName = $resolveModelClassNameByModelTypeFunction->invokeArgs(null, array($modelType));
$type = $modelClassName::TYPE_CLICK;
$existingActivities = $modelClassName::getByType($type);
$this->assertCount(2, $existingActivities);
// get base query string
$resolveBaseQueryStringArrayFunction = static::getProtectedMethod('ContentTrackingUtil', 'resolveBaseQueryStringArray');
$queryStringArray = $resolveBaseQueryStringArrayFunction->invokeArgs(null, array($modelId, $modelType, $personId));
$this->assertNotEmpty($queryStringArray);
$this->assertCount(3, $queryStringArray);
$this->assertArrayHasKey('modelId', $queryStringArray);
$this->assertArrayHasKey('modelType', $queryStringArray);
$this->assertArrayHasKey('personId', $queryStringArray);
$queryStringArray['url'] = 'http://www.zurmo.com';
// get hash for query string and ensure its what we expect it to be.
$queryStringArrayHash = StringUtil::resolveHashForQueryStringArray($queryStringArray);
$queryStringArrayDecoded = $className::resolveQueryStringArrayForHash($queryStringArrayHash);
$this->assertNotEmpty($queryStringArrayDecoded);
$this->assertCount(5, $queryStringArrayDecoded);
$this->assertArrayHasKey('modelId', $queryStringArrayDecoded);
$this->assertArrayHasKey('modelType', $queryStringArrayDecoded);
$this->assertArrayHasKey('personId', $queryStringArrayDecoded);
$this->assertArrayHasKey('url', $queryStringArrayDecoded);
$this->assertArrayHasKey('type', $queryStringArrayDecoded);
$this->assertEquals($queryStringArray['modelId'], $queryStringArrayDecoded['modelId']);
$this->assertEquals($queryStringArray['modelType'], $queryStringArrayDecoded['modelType']);
$this->assertEquals($queryStringArray['personId'], $queryStringArrayDecoded['personId']);
$this->assertEquals($queryStringArray['url'], $queryStringArrayDecoded['url']);
$this->assertNull($queryStringArrayDecoded['type']);
// do the magic, confirm magic worked by checking return value.
$_GET['id'] = $queryStringArrayHash;
$result = $className::resolveQueryStringFromUrlAndCreateOrUpdateActivity();
}
示例2: resolveHashByArray
public static function resolveHashByArray(array $queryStringArray)
{
if (!static::isValidQueryStringArray($queryStringArray)) {
throw new NotSupportedException();
}
unset($queryStringArray['preview']);
unset($queryStringArray['isHtmlContent']);
ArrayUtil::setToDefaultValueIfMissing($queryStringArray, 'createNewActivity', false);
return StringUtil::resolveHashForQueryStringArray($queryStringArray);
}
示例3: testTrackActionThrowsRedirectExceptionForUrlParameterForCampaignItem
/**
* @depends testTrackActionDoesNotComplainForMissingUrlParameterForCampaignItem
*/
public function testTrackActionThrowsRedirectExceptionForUrlParameterForCampaignItem()
{
$queryStringArray = array('modelId' => static::$campaignItemId, 'modelType' => 'CampaignItem', 'personId' => static::$personId, 'url' => 'http://www.zurmo.com');
$hash = StringUtil::resolveHashForQueryStringArray($queryStringArray);
$this->setGetArray(array('id' => $hash));
$url = $this->runControllerWithRedirectExceptionAndGetUrl(static::TRACK_ROUTE);
$this->assertEquals($queryStringArray['url'], $url);
$campaignItemActivity = CampaignItemActivity::getByTypeAndModelIdAndPersonIdAndUrl(CampaignItemActivity::TYPE_CLICK, static::$campaignItemId, static::$personId, $queryStringArray['url']);
$this->assertNotEmpty($campaignItemActivity);
$this->assertCount(1, $campaignItemActivity);
$this->assertEquals(1, $campaignItemActivity[0]->quantity);
}
示例4: resolveTrackingUrlForLink
protected static function resolveTrackingUrlForLink($link)
{
if (!static::isMarketingExternalUrl($link)) {
$queryStringArray = static::$baseQueryStringArray;
$queryStringArray['url'] = StringUtil::addSchemeIfMissing($link);
$hash = StringUtil::resolveHashForQueryStringArray($queryStringArray);
$link = static::resolveAbsoluteTrackingUrlByHash($hash);
}
return $link;
}
示例5: testResolveQueryStringArrayForHashWithAndWithoutUrlInQueryString
public function testResolveQueryStringArrayForHashWithAndWithoutUrlInQueryString()
{
// test without url
$modelId = 1;
$modelType = 'AutoresponderItem';
$personId = 10;
$className = 'EmailMessageActivityUtil';
$resolveBaseQueryStringArrayFunction = static::getProtectedMethod('ContentTrackingUtil', 'resolveBaseQueryStringArray');
$withoutUrlQueryStringArray = $resolveBaseQueryStringArrayFunction->invokeArgs(null, array($modelId, $modelType, $personId));
$this->assertNotEmpty($withoutUrlQueryStringArray);
$this->assertCount(3, $withoutUrlQueryStringArray);
$this->assertArrayHasKey('modelId', $withoutUrlQueryStringArray);
$this->assertArrayHasKey('modelType', $withoutUrlQueryStringArray);
$this->assertArrayHasKey('personId', $withoutUrlQueryStringArray);
$withoutUrlQueryStringArrayHash = StringUtil::resolveHashForQueryStringArray($withoutUrlQueryStringArray);
$withoutUrlQueryStringArrayDecoded = $className::resolveQueryStringArrayForHash($withoutUrlQueryStringArrayHash);
$this->assertTrue(is_array($withoutUrlQueryStringArrayDecoded));
$this->assertCount(5, $withoutUrlQueryStringArrayDecoded);
$this->assertArrayHasKey('modelId', $withoutUrlQueryStringArrayDecoded);
$this->assertArrayHasKey('modelType', $withoutUrlQueryStringArrayDecoded);
$this->assertArrayHasKey('personId', $withoutUrlQueryStringArrayDecoded);
$this->assertArrayHasKey('url', $withoutUrlQueryStringArrayDecoded);
$this->assertArrayHasKey('type', $withoutUrlQueryStringArrayDecoded);
$this->assertEquals($withoutUrlQueryStringArray['modelId'], $withoutUrlQueryStringArrayDecoded['modelId']);
$this->assertEquals($withoutUrlQueryStringArray['modelType'], $withoutUrlQueryStringArrayDecoded['modelType']);
$this->assertEquals($withoutUrlQueryStringArray['personId'], $withoutUrlQueryStringArrayDecoded['personId']);
$this->assertNull($withoutUrlQueryStringArrayDecoded['url']);
$this->assertNull($withoutUrlQueryStringArrayDecoded['type']);
// try same thing with url in the query string array.
$withUrlQueryStringArray = CMap::mergeArray($withoutUrlQueryStringArray, array('url' => 'http://www.zurmo.com', 'type' => null));
$withUrlQueryStringArrayHash = StringUtil::resolveHashForQueryStringArray($withUrlQueryStringArray);
$withUrlQueryStringArrayDecoded = $className::resolveQueryStringArrayForHash($withUrlQueryStringArrayHash);
$this->assertEquals($withUrlQueryStringArray, $withUrlQueryStringArrayDecoded);
}
示例6: array
/**
* @depends testOptOutActionThrowNotSupportedExceptionForDecipherableHexadecimalHashWithMissingParameters
* @expectedException NotSupportedException
*/
public function testManageSubscriptionsActionThrowNotSupportedExceptionForDecipherableHexadecimalHashWithMissingParameters()
{
$queryStringArray = array('keyOne' => 'valueOne', 'keyTwo' => 'valueTwo', 'keyThree' => 'ValueThree');
$hash = StringUtil::resolveHashForQueryStringArray($queryStringArray);
$this->setGetArray(array('hash' => $hash));
$this->runControllerWithNoExceptionsAndGetContent($this->manageSubscriptionsUrl);
}
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info,代码行数:11,代码来源:MarketingListsExternalControllerWalkthroughTest.php