forked from LiveCarta/PayPal-PHP-SDK
Updated stubs to support namespace
This commit is contained in:
@@ -4,12 +4,13 @@
|
||||
|
||||
use PayPal\Auth\OAuthTokenCredential;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
use PayPal\Core\PPConfigManager;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testGetAccessToken() {
|
||||
$cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET);
|
||||
$config = \PPConfigManager::getInstance()->getConfigHashmap();
|
||||
$config = PPConfigManager::getInstance()->getConfigHashmap();
|
||||
|
||||
$token = $cred->getAccessToken($config);
|
||||
$this->assertNotNull($token);
|
||||
@@ -27,8 +28,8 @@ class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
public function testInvalidCredentials() {
|
||||
$this->setExpectedException('\PPConnectionException');
|
||||
$this->setExpectedException('PayPal\Exception\PPConnectionException');
|
||||
$cred = new OAuthTokenCredential('dummy', 'secret');
|
||||
$this->assertNull($cred->getAccessToken(\PPConfigManager::getInstance()->getConfigHashmap()));
|
||||
$this->assertNull($cred->getAccessToken(PPConfigManager::getInstance()->getConfigHashmap()));
|
||||
}
|
||||
}
|
||||
29
tests/PayPal/Test/Common/ArrayClass.php
Normal file
29
tests/PayPal/Test/Common/ArrayClass.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
class ArrayClass extends PPModel {
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setDescription($desc) {
|
||||
$this->desc = $desc;
|
||||
}
|
||||
public function getDescription() {
|
||||
return $this->desc;
|
||||
}
|
||||
|
||||
public function setTags($tags) {
|
||||
if(!is_array($tags)) {
|
||||
$tags = array($tags);
|
||||
}
|
||||
$this->tags = $tags;
|
||||
}
|
||||
public function getTags() {
|
||||
return $this->tags;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
// namespace PayPal\Test\Common;
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPArrayUtil;
|
||||
|
||||
|
||||
class ArrayUtilTest extends PHPUnit_Framework_TestCase {
|
||||
class ArrayUtilTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testIsAssocArray() {
|
||||
|
||||
|
||||
6
tests/PayPal/Test/Common/ChildClass.php
Normal file
6
tests/PayPal/Test/Common/ChildClass.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
class ChildClass extends SimpleClass {
|
||||
|
||||
}
|
||||
@@ -1,82 +1,10 @@
|
||||
<?php
|
||||
|
||||
// namespace PayPal\Test\Common;
|
||||
|
||||
|
||||
class SimpleClass extends \PPModel {
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setDescription($desc) {
|
||||
$this->desc = $desc;
|
||||
}
|
||||
public function getDescription() {
|
||||
return $this->desc;
|
||||
}
|
||||
}
|
||||
|
||||
class ArrayClass extends \PPModel {
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setDescription($desc) {
|
||||
$this->desc = $desc;
|
||||
}
|
||||
public function getDescription() {
|
||||
return $this->desc;
|
||||
}
|
||||
|
||||
public function setTags($tags) {
|
||||
if(!is_array($tags)) {
|
||||
$tags = array($tags);
|
||||
}
|
||||
$this->tags = $tags;
|
||||
}
|
||||
public function getTags() {
|
||||
return $this->tags;
|
||||
}
|
||||
}
|
||||
|
||||
class NestedClass extends \PPModel {
|
||||
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ArrayClass $info
|
||||
*/
|
||||
public function setInfo($info) {
|
||||
$this->info = $info;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return ArrayClass
|
||||
*/
|
||||
public function getInfo() {
|
||||
return $this->info;
|
||||
}
|
||||
}
|
||||
|
||||
class ChildClass extends SimpleClass {
|
||||
|
||||
}
|
||||
|
||||
class ModelTest extends PHPUnit_Framework_TestCase {
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Test\Common\ArrayClass;
|
||||
use PayPal\Test\Common\SimpleClass;
|
||||
use PayPal\Test\Common\NestedClass;
|
||||
class ModelTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testSimpleClassConversion() {
|
||||
$o = new SimpleClass();
|
||||
|
||||
27
tests/PayPal/Test/Common/NestedClass.php
Normal file
27
tests/PayPal/Test/Common/NestedClass.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
class NestedClass extends PPModel {
|
||||
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param PayPal\Test\Common\ArrayClass $info
|
||||
*/
|
||||
public function setInfo($info) {
|
||||
$this->info = $info;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return PayPal\Test\Common\ArrayClass
|
||||
*/
|
||||
public function getInfo() {
|
||||
return $this->info;
|
||||
}
|
||||
}
|
||||
19
tests/PayPal/Test/Common/SimpleClass.php
Normal file
19
tests/PayPal/Test/Common/SimpleClass.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
class SimpleClass extends PPModel {
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setDescription($desc) {
|
||||
$this->desc = $desc;
|
||||
}
|
||||
public function getDescription() {
|
||||
return $this->desc;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use PayPal\Common\UserAgent;
|
||||
use PayPal\Common\PPUserAgent;
|
||||
|
||||
class UserAgentTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user