PayPalPaymentECPaymentMethodControllerTest.test in PayPal for Payment 7
File
paypal_payment_ec/tests/PayPalPaymentECPaymentMethodControllerTest.test
View source
<?php
class PayPalPaymentECPaymentMethodControllerTest extends PaymentWebTestCase {
public static function getInfo() {
return array(
'description' => '',
'name' => 'PayPalPaymentECPaymentMethodController',
'group' => 'PayPal Express Checkout',
'dependencies' => array(
'paypal_payment_ec',
),
);
}
public function setUp(array $modules = array()) {
parent::setUp(array_merge($modules, array(
'paypal_payment_ec',
)));
}
public function testsaveAuthentication() {
$controller = payment_method_controller_load('PayPalPaymentECPaymentMethodController');
$token = new PayPalPaymentECAuthentication('foo', time(), 1);
$controller
->saveAuthentication($token);
$token_loaded = $controller
->loadAuthentication($token->pid);
$this
->assertEqual((array) $token_loaded, (array) $token);
}
public function testloadAuthentication() {
$controller = payment_method_controller_load('PayPalPaymentECPaymentMethodController');
$token = new PayPalPaymentECAuthentication('foo', time(), 1);
$controller
->saveAuthentication($token);
$token_loaded = $controller
->loadAuthentication($token->pid);
$this
->assertTrue($token_loaded instanceof PayPalPaymentECAuthentication);
$this
->assertEqual((array) $token_loaded, (array) $token);
}
public function testdeleteAuthentication() {
$controller = payment_method_controller_load('PayPalPaymentECPaymentMethodController');
$token = new PayPalPaymentECAuthentication('foo', time(), 1);
$controller
->saveAuthentication($token);
$controller
->deleteAuthentication($token->pid);
$this
->assertEqual($controller
->loadAuthentication($token->pid), FALSE);
}
}