/** * @covers AdsUser::GetClientLibraryUserAgent */ public function testGetClientLibraryAppNameReturnsCorrectlyFormattedAppName() { $APPLICATION_NAME = 'DfpApiPhpClient-test'; $LIB_NAME = 'DfpApi-PHP'; $COMMON_NAME = 'Common-PHP'; $VERSION_REGEX = '\\d{1,2}\\.\\d{1,2}\\.\\d{1,2}'; $user = new DfpUser($this->authIniFilePath, $APPLICATION_NAME, 'networkCode', null, $this->mockOAuth2Credential); // Example: "DfpApiPhpClient-test (DfpApi-PHP/4.1.1, Common-PHP/5.0.0, // PHP/5.4.8)" $search = sprintf('/^%s \\(%s\\/%s, %s\\/%s, PHP\\/%s\\)$/', preg_quote($user->GetApplicationName()), preg_quote($LIB_NAME), $VERSION_REGEX, preg_quote($COMMON_NAME), $VERSION_REGEX, preg_quote(PHP_VERSION)); $this->assertRegExp($search, $user->GetClientLibraryUserAgent()); }