ConfigTest.php 1.63 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

declare(strict_types=1);

namespace Magento\AuthorizenetAcceptjs\Gateway;

use Magento\Framework\Config\Data;
use Magento\Payment\Model\Method\Adapter;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\ObjectManager;
use PHPUnit\Framework\TestCase;

class ConfigTest extends TestCase
{
    /**
     * @var ObjectManager
     */
    private $objectManager;

    protected function setUp()
    {
        $this->objectManager = Bootstrap::getObjectManager();
    }

    public function testVerifyConfiguration()
    {
        /** @var Adapter $paymentAdapter */
        $paymentAdapter = $this->objectManager->get('AuthorizenetAcceptjsFacade');

        $this->assertEquals('authorizenet_acceptjs', $paymentAdapter->getCode());
        $this->assertTrue($paymentAdapter->canAuthorize());
        $this->assertTrue($paymentAdapter->canCapture());
        $this->assertFalse($paymentAdapter->canCapturePartial());
        $this->assertTrue($paymentAdapter->canRefund());
        $this->assertTrue($paymentAdapter->canUseCheckout());
        $this->assertTrue($paymentAdapter->canVoid());
        $this->assertTrue($paymentAdapter->canUseInternal());
        $this->assertTrue($paymentAdapter->canEdit());
        $this->assertTrue($paymentAdapter->canFetchTransactionInfo());

        /** @var Data $configReader */
        $configReader = $this->objectManager->get('Magento\Payment\Model\Config\Data');
        $value = $configReader->get('methods/authorizenet_acceptjs/allow_multiple_address');

        $this->assertSame('0', $value);
    }
}