Updating model classes to use dynamic config - Moving common classes to sdk-core-php

This commit is contained in:
aydiv
2013-04-24 17:13:47 +05:30
parent 3e56fe5143
commit e8e7ad807e
37 changed files with 676 additions and 733 deletions

View File

@@ -1,23 +1,26 @@
<?php
use PayPal\Common\UserAgent;
class UserAgentTest extends PHPUnit_Framework_TestCase {
public function testGetValue() {
$ua = UserAgent::getValue();
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%s)");
// Check that we pass the useragent in the expected format
$this->assertNotNull($id);
$this->assertNotNull($version);
$this->assertNotNull($features);
// 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->assertGreaterThan(5, count(explode(';', $features)));
}
<?php
use PayPal\Common\UserAgent;
class UserAgentTest extends PHPUnit_Framework_TestCase {
public function testGetValue() {
$ua = PPUserAgent::getValue("name", "version");
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%s)");
// Check that we pass the useragent in the expected format
$this->assertNotNull($id);
$this->assertNotNull($version);
$this->assertNotNull($features);
$this->assertEquals("name", $id);
$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->assertGreaterThan(5, count(explode(';', $features)));
}
}