AdWordsUserTest::testUpdateClientLibraryUserAgent_default PHP Method

testUpdateClientLibraryUserAgent_default() public method

Tests if the user agent includes the usage of ads utilities by default.
    public function testUpdateClientLibraryUserAgent_default()
    {
        $USER_AGENT = 'AdWordsApiPhpClient-test';
        $LIB_NAME = 'AwApi-PHP';
        $COMMON_NAME = 'Common-PHP';
        $VERSION_REGEX = '\\d{1,2}\\.\\d{1,2}\\.\\d{1,2}';
        $user = new AdWordsUser($this->authIniFilePath, 'devToken', $USER_AGENT, null, null, $this->mockOAuth2Credential);
        AdsUtilityRegistry::getInstance()->addUtility('ReportDownloader/file');
        AdsUtilityRegistry::getInstance()->addUtility('BatchJobHelper');
        $user->updateClientLibraryUserAgent($user->GetUserAgent());
        // Example: "AdWordsApiPhpClient-test (AwApi-PHP/9.0.0, Common-PHP/9.0.0,
        // PHP/5.4.8, BatchJobHelper, ReportDownloader/file)"
        $expectedUserAgents = sprintf('/^%s \\(%s\\/%s, %s\\/%s, PHP\\/%s, %s\\)$/', preg_quote($user->GetUserAgent()), preg_quote($LIB_NAME), $VERSION_REGEX, preg_quote($COMMON_NAME), $VERSION_REGEX, preg_quote(PHP_VERSION), preg_quote('BatchJobHelper, ReportDownloader/file', '/'));
        $this->assertRegExp($expectedUserAgents, $user->GetClientLibraryUserAgent());
    }