![]() 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-quote/Test/Unit/Setup/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Quote\Test\Unit\Setup; use Magento\Eav\Model\Entity\Setup\Context; use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory; use Magento\Framework\App\CacheInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Quote\Setup\QuoteSetup; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * Test for Quote module setup model. */ class QuoteSetupTest extends TestCase { /** * @var QuoteSetup */ private $model; /** * @var ObjectManagerHelper */ private $objectManagerHelper; /** * @var ModuleDataSetupInterface|MockObject */ private $moduleDataSetupMock; /** * @var Context|MockObject */ private $contextMock; /** * @var CacheInterface|MockObject */ private $cacheMock; /** * @var CollectionFactory|MockObject */ private $collectionFactoryMock; /** * @var ScopeConfigInterface|MockObject */ private $scopeConfigMock; protected function setUp(): void { $this->moduleDataSetupMock = $this->getMockBuilder(ModuleDataSetupInterface::class) ->getMockForAbstractClass(); $this->contextMock = $this->getMockBuilder(Context::class) ->disableOriginalConstructor() ->getMock(); $this->cacheMock = $this->getMockBuilder(CacheInterface::class) ->getMockForAbstractClass(); $this->collectionFactoryMock = $this->getMockBuilder(CollectionFactory::class) ->disableOriginalConstructor() ->getMock(); $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) ->getMockForAbstractClass(); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->model = $this->objectManagerHelper->getObject( QuoteSetup::class, [ 'setup' => $this->moduleDataSetupMock, 'context' => $this->contextMock, 'cache' => $this->cacheMock, 'attrGroupCollectionFactory' => $this->collectionFactoryMock, 'config' => $this->scopeConfigMock ] ); } public function testGetConnection() { $this->moduleDataSetupMock->expects($this->once()) ->method('getConnection') ->with('checkout'); $this->model->getConnection(); } }