We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 50f1627a authored by Rik ter Beek's avatar Rik ter Beek Committed by GitHub

Merge pull request #263 from JeroenVanLeusden/patch-1

Compatibility with PHPUnit 6
parents d5e8f49d d89b1b68
...@@ -23,10 +23,11 @@ ...@@ -23,10 +23,11 @@
namespace Adyen\Payment\Tests\Helper; 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 $dataHelper;
private function getSimpleMock($originalClassName) private function getSimpleMock($originalClassName)
...@@ -38,36 +39,35 @@ class DataTest extends \PHPUnit_Framework_TestCase ...@@ -38,36 +39,35 @@ class DataTest extends \PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
$context = $this->getSimpleMock('\Magento\Framework\App\Helper\Context'); $context = $this->getSimpleMock(\Magento\Framework\App\Helper\Context::class);
$encryptor = $this->getSimpleMock('\Magento\Framework\Encryption\EncryptorInterface'); $encryptor = $this->getSimpleMock(\Magento\Framework\Encryption\EncryptorInterface::class);
$dataStorage = $this->getSimpleMock('\Magento\Framework\Config\DataInterface'); $dataStorage = $this->getSimpleMock(\Magento\Framework\Config\DataInterface::class);
$country = $this->getSimpleMock('\Magento\Directory\Model\Config\Source\Country'); $country = $this->getSimpleMock(\Magento\Directory\Model\Config\Source\Country::class);
$moduleList = $this->getSimpleMock('\Magento\Framework\Module\ModuleListInterface'); $moduleList = $this->getSimpleMock(\Magento\Framework\Module\ModuleListInterface::class);
$billingAgreementCollectionFactory = $this->getSimpleMock('\Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory'); $billingAgreementCollectionFactory = $this->getSimpleMock(\Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory::class);
$assetRepo = $this->getSimpleMock('\Magento\Framework\View\Asset\Repository'); $assetRepo = $this->getSimpleMock(\Magento\Framework\View\Asset\Repository::class);
$assetSource = $this->getSimpleMock('\Magento\Framework\View\Asset\Source'); $assetSource = $this->getSimpleMock(\Magento\Framework\View\Asset\Source::class);
$notificationFactory = $this->getSimpleMock('\Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory'); $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); $billingAgreementCollectionFactory, $assetRepo, $assetSource, $notificationFactory);
} }
public function testFormatAmount() public function testFormatAmount()
{ {
$this->assertEquals("1234", $this->dataHelper->formatAmount("12.34", "EUR")); $this->assertEquals('1234', $this->dataHelper->formatAmount('12.34', 'EUR'));
$this->assertEquals("1200", $this->dataHelper->formatAmount("12.00", "USD")); $this->assertEquals('1200', $this->dataHelper->formatAmount('12.00', 'USD'));
$this->assertEquals("12", $this->dataHelper->formatAmount("12.00", "JPY")); $this->assertEquals('12', $this->dataHelper->formatAmount('12.00', 'JPY'));
} }
public function testisPaymentMethodOpenInvoiceMethod() public function testisPaymentMethodOpenInvoiceMethod()
{ {
$this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod("klarna")); $this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod('klarna'));
$this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod("klarna_account")); $this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod('klarna_account'));
$this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod("afterpay")); $this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod('afterpay'));
$this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod("afterpay_default")); $this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod('afterpay_default'));
$this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod("ratepay")); $this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod('ratepay'));
$this->assertEquals(false, $this->dataHelper->isPaymentMethodOpenInvoiceMethod("ideal")); $this->assertEquals(false, $this->dataHelper->isPaymentMethodOpenInvoiceMethod('ideal'));
$this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod("test_klarna")); $this->assertEquals(true, $this->dataHelper->isPaymentMethodOpenInvoiceMethod('test_klarna'));
} }
} }
Markdown is supported
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