Updating User Agent for Internal Purposes

This commit is contained in:
Jay Patel
2015-10-28 14:19:02 -05:00
parent 403d01e90e
commit 3bf4bbe8b6
2 changed files with 7 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ class UserAgentTest extends PHPUnit_Framework_TestCase
public function testGetValue()
{
$ua = PayPalUserAgent::getValue("name", "version");
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%s)");
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%[^[]])");
// Check that we pass the useragent in the expected format
$this->assertNotNull($id);
@@ -19,10 +19,9 @@ class UserAgentTest extends PHPUnit_Framework_TestCase
$this->assertEquals("version", $version);
// Check that we pass in these mininal features
$this->assertThat($features, $this->stringContains("OS="));
$this->assertThat($features, $this->stringContains("Bit="));
$this->assertThat($features, $this->stringContains("Lang="));
$this->assertThat($features, $this->stringContains("V="));
$this->assertThat($features, $this->stringContains("os="));
$this->assertThat($features, $this->stringContains("bit="));
$this->assertThat($features, $this->stringContains("platform-ver="));
$this->assertGreaterThan(5, count(explode(';', $features)));
}
}