本文整理汇总了PHP中AdWordsUser::GetClientLibraryNameAndVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP AdWordsUser::GetClientLibraryNameAndVersion方法的具体用法?PHP AdWordsUser::GetClientLibraryNameAndVersion怎么用?PHP AdWordsUser::GetClientLibraryNameAndVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdWordsUser
的用法示例。
在下文中一共展示了AdWordsUser::GetClientLibraryNameAndVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIntegrationCheckUserAgent
/**
* Tests that the user agent header is properly set for this client library.
*/
public function testIntegrationCheckUserAgent()
{
// Get the response xml
$xmlResponse = $this->assetHelper->getAsset(sprintf(self::RESPONSE_NAME, self::SERVICE));
// Create a regular AdWordsUser
$user = new AdWordsUser($this->assetHelper->getAssetPath('auth.ini'));
$campaignService = $user->getService(self::SERVICE);
// Build a mocked SoapClient
$headerPortion = implode('/', $user->GetClientLibraryNameAndVersion());
// Setup the test.
$soapClientMock = $this->getMockBuilder('SoapClient')->setMethods(array('__doRequest'))->disableOriginalConstructor()->getMock();
$soapClientMock->expects($this->any())->method('__doRequest')->with($this->stringContains($headerPortion, false))->will($this->returnValue($xmlResponse));
// Set the transport layer on the soap client to be the mocked soap client.
$campaignService->__SetTransportLayer($soapClientMock);
// Create selector.
$selector = new Selector();
// Specify the fields to retrieve.
$selector->fields = array('Login', 'CustomerId', 'Name');
// Make the get request.
$graph = $campaignService->get($selector);
$this->assertEquals($graph->entries[0]->id, self::CAMPAIGN_ID);
}