Skip to content
Snippets Groups Projects
Commit 9e0d3507 authored by Viktor Tymchynskyi's avatar Viktor Tymchynskyi
Browse files

Merge remote-tracking branch 'origin/MAGETWO-51014' into MPI-BUGFIXES

parents c966ecb2 32891e4e
Branches
No related merge requests found
...@@ -5,19 +5,16 @@ ...@@ -5,19 +5,16 @@
*/ */
namespace Magento\Paypal\Test\Unit\Model\Api; namespace Magento\Paypal\Test\Unit\Model\Api;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Paypal\Model\Api\ProcessableException;
class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase
{ {
/** const UNKNOWN_CODE = 10411;
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
*/
protected $objectManager;
/** /**
* @var \Magento\Paypal\Model\Api\ProcessableException * @var ProcessableException
*/ */
protected $model; private $model;
/** /**
* @param int $code * @param int $code
...@@ -27,8 +24,7 @@ class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase ...@@ -27,8 +24,7 @@ class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase
*/ */
public function testGetUserMessage($code, $msg) public function testGetUserMessage($code, $msg)
{ {
$this->objectManager = new ObjectManager($this); $this->model = new ProcessableException(__($msg), null, $code);
$this->model = new \Magento\Paypal\Model\Api\ProcessableException(__($msg), null, $code);
$this->assertEquals($msg, $this->model->getUserMessage()); $this->assertEquals($msg, $this->model->getUserMessage());
} }
...@@ -39,28 +35,35 @@ class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase ...@@ -39,28 +35,35 @@ class ProcessableExceptionTest extends \PHPUnit_Framework_TestCase
{ {
return [ return [
[ [
10001, ProcessableException::API_INTERNAL_ERROR,
"I'm sorry - but we were not able to process your payment. " "I'm sorry - but we were not able to process your payment. "
. "Please try another payment method or contact us so we can assist you.", . "Please try another payment method or contact us so we can assist you.",
], ],
[ [
10417, ProcessableException::API_UNABLE_PROCESS_PAYMENT_ERROR_CODE,
"I'm sorry - but we were not able to process your payment. " "I'm sorry - but we were not able to process your payment. "
. "Please try another payment method or contact us so we can assist you." . "Please try another payment method or contact us so we can assist you."
], ],
[ [
10537, ProcessableException::API_COUNTRY_FILTER_DECLINE,
"I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you." "I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you."
], ],
[ [
10538, ProcessableException::API_MAXIMUM_AMOUNT_FILTER_DECLINE,
"I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you." "I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you."
], ],
[ [
10539, ProcessableException::API_OTHER_FILTER_DECLINE,
"I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you." "I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you."
], ],
[10411, "something went wrong"] [
ProcessableException::API_ADDRESS_MATCH_FAIL,
'A match of the Shipping Address City, State, and Postal Code failed.'
],
[
self::UNKNOWN_CODE,
"We can't place the order."
]
]; ];
} }
} }
...@@ -22,6 +22,7 @@ class ExpressTest extends \PHPUnit_Framework_TestCase ...@@ -22,6 +22,7 @@ class ExpressTest extends \PHPUnit_Framework_TestCase
ApiProcessableException::API_COUNTRY_FILTER_DECLINE, ApiProcessableException::API_COUNTRY_FILTER_DECLINE,
ApiProcessableException::API_MAXIMUM_AMOUNT_FILTER_DECLINE, ApiProcessableException::API_MAXIMUM_AMOUNT_FILTER_DECLINE,
ApiProcessableException::API_OTHER_FILTER_DECLINE, ApiProcessableException::API_OTHER_FILTER_DECLINE,
ApiProcessableException::API_ADDRESS_MATCH_FAIL
]; ];
/** /**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment