5
5
*/
6
6
namespace Magento \Paypal \Test \Unit \Model \Api ;
7
7
8
- use Magento \Framework \ TestFramework \ Unit \ Helper \ ObjectManager ;
8
+ use Magento \Paypal \ Model \ Api \ ProcessableException ;
9
9
10
10
class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase
11
11
{
12
- /**
13
- * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
14
- */
15
- protected $ objectManager ;
12
+ const UNKNOWN_CODE = 10411 ;
16
13
17
14
/**
18
- * @var \Magento\Paypal\Model\Api\ ProcessableException
15
+ * @var ProcessableException
19
16
*/
20
- protected $ model ;
17
+ private $ model ;
21
18
22
19
/**
23
20
* @param int $code
@@ -27,8 +24,7 @@ class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase
27
24
*/
28
25
public function testGetUserMessage ($ code , $ msg )
29
26
{
30
- $ this ->objectManager = new ObjectManager ($ this );
31
- $ this ->model = new \Magento \Paypal \Model \Api \ProcessableException (__ ($ msg ), null , $ code );
27
+ $ this ->model = new ProcessableException (__ ($ msg ), null , $ code );
32
28
$ this ->assertEquals ($ msg , $ this ->model ->getUserMessage ());
33
29
}
34
30
@@ -39,28 +35,35 @@ public function getUserMessageDataProvider()
39
35
{
40
36
return [
41
37
[
42
- 10001 ,
38
+ ProcessableException:: API_INTERNAL_ERROR ,
43
39
"I'm sorry - but we were not able to process your payment. "
44
40
. "Please try another payment method or contact us so we can assist you. " ,
45
41
],
46
42
[
47
- 10417 ,
43
+ ProcessableException:: API_UNABLE_PROCESS_PAYMENT_ERROR_CODE ,
48
44
"I'm sorry - but we were not able to process your payment. "
49
45
. "Please try another payment method or contact us so we can assist you. "
50
46
],
51
47
[
52
- 10537 ,
48
+ ProcessableException:: API_COUNTRY_FILTER_DECLINE ,
53
49
"I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you. "
54
50
],
55
51
[
56
- 10538 ,
52
+ ProcessableException:: API_MAXIMUM_AMOUNT_FILTER_DECLINE ,
57
53
"I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you. "
58
54
],
59
55
[
60
- 10539 ,
56
+ ProcessableException:: API_OTHER_FILTER_DECLINE ,
61
57
"I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you. "
62
58
],
63
- [10411 , "something went wrong " ]
59
+ [
60
+ ProcessableException::API_ADDRESS_MATCH_FAIL ,
61
+ 'A match of the Shipping Address City, State, and Postal Code failed. '
62
+ ],
63
+ [
64
+ self ::UNKNOWN_CODE ,
65
+ "We can't place the order. "
66
+ ]
64
67
];
65
68
}
66
69
}
0 commit comments