![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-paypal/Test/Unit/Block/Express/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Paypal\Test\Unit\Block\Express; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Paypal\Block\Express\Shortcut; use Magento\Paypal\Model\Config; use Magento\Paypal\Model\ConfigFactory; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ShortcutTest extends TestCase { private const STUB_ALIAS = 'alias'; /** * @var ConfigFactory|MockObject */ protected $_paypalConfigFactory; public function testGetAlias() { $paypalConfigFactoryMock = $this->getMockBuilder(ConfigFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $configMock = $this->getMockBuilder(Config::class) ->disableOriginalConstructor() ->getMock(); $paypalConfigFactoryMock->expects(self::once()) ->method('create') ->willReturn($configMock); $configMock->expects(self::once()) ->method('setMethod') ->with('test-method'); $helper = new ObjectManager($this); $model = $helper->getObject( Shortcut::class, [ 'alias' => self::STUB_ALIAS, 'paymentMethodCode' => 'test-method', 'paypalConfigFactory' => $paypalConfigFactoryMock ] ); $this->assertEquals(self::STUB_ALIAS, $model->getAlias()); } }