当前位置: 首页>>代码示例>>PHP>>正文


PHP StringUtil::resolveHashForQueryStringArray方法代码示例

本文整理汇总了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();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:54,代码来源:CampaignItemActivityUtilTest.php

示例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);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:GlobalMarketingFooterUtil.php

示例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);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:15,代码来源:TrackingDefaultControllerWalkthroughTest.php

示例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;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:10,代码来源:ContentTrackingUtil.php

示例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);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:34,代码来源:EmailMessageActivityUtilTest.php

示例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


注:本文中的StringUtil::resolveHashForQueryStringArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。