Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Adyen Magento2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared Libs
Adyen Magento2
Commits
d89b1b68
Commit
d89b1b68
authored
Mar 26, 2018
by
Jeroen
Committed by
GitHub
Mar 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compatibility with PHPUnit 6
parent
d5e8f49d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
Test/Unit/Helper/DataTest.php
Test/Unit/Helper/DataTest.php
+24
-24
No files found.
Test/Unit/Helper/DataTest.php
View file @
d89b1b68
...
...
@@ -23,10 +23,11 @@
namespace
Adyen\Payment\Tests\Helper
;
use
Adyen\Payment\Helper\Data
;
class
DataTest
extends
\PHPUnit_Framework_TestCase
class
DataTest
extends
\PHPUnit\Framework\TestCase
{
/**
* @var \Adyen\Payment\Helper\Data
*/
private
$dataHelper
;
private
function
getSimpleMock
(
$originalClassName
)
...
...
@@ -38,36 +39,35 @@ class DataTest extends \PHPUnit_Framework_TestCase
public
function
setUp
()
{
$context
=
$this
->
getSimpleMock
(
'\Magento\Framework\App\Helper\Context'
);
$encryptor
=
$this
->
getSimpleMock
(
'\Magento\Framework\Encryption\EncryptorInterface'
);
$dataStorage
=
$this
->
getSimpleMock
(
'\Magento\Framework\Config\DataInterface'
);
$country
=
$this
->
getSimpleMock
(
'\Magento\Directory\Model\Config\Source\Country'
);
$moduleList
=
$this
->
getSimpleMock
(
'\Magento\Framework\Module\ModuleListInterface'
);
$billingAgreementCollectionFactory
=
$this
->
getSimpleMock
(
'\Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory'
);
$assetRepo
=
$this
->
getSimpleMock
(
'\Magento\Framework\View\Asset\Repository'
);
$assetSource
=
$this
->
getSimpleMock
(
'\Magento\Framework\View\Asset\Source'
);
$notificationFactory
=
$this
->
getSimpleMock
(
'\Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory'
);
$context
=
$this
->
getSimpleMock
(
\Magento\Framework\App\Helper\Context
::
class
);
$encryptor
=
$this
->
getSimpleMock
(
\Magento\Framework\Encryption\EncryptorInterface
::
class
);
$dataStorage
=
$this
->
getSimpleMock
(
\Magento\Framework\Config\DataInterface
::
class
);
$country
=
$this
->
getSimpleMock
(
\Magento\Directory\Model\Config\Source\Country
::
class
);
$moduleList
=
$this
->
getSimpleMock
(
\Magento\Framework\Module\ModuleListInterface
::
class
);
$billingAgreementCollectionFactory
=
$this
->
getSimpleMock
(
\Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory
::
class
);
$assetRepo
=
$this
->
getSimpleMock
(
\Magento\Framework\View\Asset\Repository
::
class
);
$assetSource
=
$this
->
getSimpleMock
(
\Magento\Framework\View\Asset\Source
::
class
);
$notificationFactory
=
$this
->
getSimpleMock
(
\Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory
::
class
);
$this
->
dataHelper
=
new
Data
(
$context
,
$encryptor
,
$dataStorage
,
$country
,
$moduleList
,
$this
->
dataHelper
=
new
\Adyen\Payment\Helper\
Data
(
$context
,
$encryptor
,
$dataStorage
,
$country
,
$moduleList
,
$billingAgreementCollectionFactory
,
$assetRepo
,
$assetSource
,
$notificationFactory
);
}
public
function
testFormatAmount
()
{
$this
->
assertEquals
(
"1234"
,
$this
->
dataHelper
->
formatAmount
(
"12.34"
,
"EUR"
));
$this
->
assertEquals
(
"1200"
,
$this
->
dataHelper
->
formatAmount
(
"12.00"
,
"USD"
));
$this
->
assertEquals
(
"12"
,
$this
->
dataHelper
->
formatAmount
(
"12.00"
,
"JPY"
));
$this
->
assertEquals
(
'1234'
,
$this
->
dataHelper
->
formatAmount
(
'12.34'
,
'EUR'
));
$this
->
assertEquals
(
'1200'
,
$this
->
dataHelper
->
formatAmount
(
'12.00'
,
'USD'
));
$this
->
assertEquals
(
'12'
,
$this
->
dataHelper
->
formatAmount
(
'12.00'
,
'JPY'
));
}
public
function
testisPaymentMethodOpenInvoiceMethod
()
{
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
"klarna"
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
"klarna_account"
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
"afterpay"
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
"afterpay_default"
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
"ratepay"
));
$this
->
assertEquals
(
false
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
"ideal"
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
"test_klarna"
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
'klarna'
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
'klarna_account'
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
'afterpay'
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
'afterpay_default'
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
'ratepay'
));
$this
->
assertEquals
(
false
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
'ideal'
));
$this
->
assertEquals
(
true
,
$this
->
dataHelper
->
isPaymentMethodOpenInvoiceMethod
(
'test_klarna'
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment