3 use PayPal\Common\PPUserAgent;
\r
5 class UserAgentTest extends PHPUnit_Framework_TestCase {
\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
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
16 $this->assertEquals("name", $id);
\r
17 $this->assertEquals("version", $version);
\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