d945374603ace0303110de4497f60b823c9c8362
[WP-Plugins/glm-member-db.git] /
1 <?php\r
2 \r
3 use PayPal\Common\PPUserAgent;\r
4 \r
5 class UserAgentTest extends PHPUnit_Framework_TestCase {\r
6         \r
7         public function testGetValue() {\r
8                 $ua = PPUserAgent::getValue("name", "version");\r
9                 list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%s)");\r
10                 \r
11                 // Check that we pass the useragent in the expected format\r
12                 $this->assertNotNull($id);\r
13                 $this->assertNotNull($version);\r
14                 $this->assertNotNull($features);\r
15                 \r
16                 $this->assertEquals("name", $id);\r
17                 $this->assertEquals("version", $version);\r
18                 \r
19                 // Check that we pass in these mininal features\r
20                 $this->assertThat($features, $this->stringContains("OS="));\r
21                 $this->assertThat($features, $this->stringContains("Bit="));\r
22                 $this->assertThat($features, $this->stringContains("Lang="));\r
23                 $this->assertThat($features, $this->stringContains("V="));\r
24                 $this->assertGreaterThan(5, count(explode(';', $features)));\r
25         }\r
26 }