Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
QuoteSetupTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;
11 
17 class QuoteSetupTest extends \PHPUnit\Framework\TestCase
18 {
22  private $model;
23 
27  private $objectManagerHelper;
28 
32  private $moduleDataSetupMock;
33 
37  private $contextMock;
38 
42  private $cacheMock;
43 
47  private $collectionFactoryMock;
48 
52  private $scopeConfigMock;
53 
54  protected function setUp()
55  {
56  $this->moduleDataSetupMock = $this->getMockBuilder(\Magento\Framework\Setup\ModuleDataSetupInterface::class)
57  ->getMockForAbstractClass();
58  $this->contextMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Setup\Context::class)
59  ->disableOriginalConstructor()
60  ->getMock();
61  $this->cacheMock = $this->getMockBuilder(\Magento\Framework\App\CacheInterface::class)
62  ->getMockForAbstractClass();
63  $this->collectionFactoryMock = $this->getMockBuilder(CollectionFactory::class)
64  ->disableOriginalConstructor()
65  ->getMock();
66  $this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
67  ->getMockForAbstractClass();
68 
69  $this->objectManagerHelper = new ObjectManagerHelper($this);
70  $this->model = $this->objectManagerHelper->getObject(
71  \Magento\Quote\Setup\QuoteSetup::class,
72  [
73  'setup' => $this->moduleDataSetupMock,
74  'context' => $this->contextMock,
75  'cache' => $this->cacheMock,
76  'attrGroupCollectionFactory' => $this->collectionFactoryMock,
77  'config' => $this->scopeConfigMock
78  ]
79  );
80  }
81 
82  public function testGetConnection()
83  {
84  $this->moduleDataSetupMock->expects($this->once())
85  ->method('getConnection')
86  ->with('checkout');
87  $this->model->getConnection();
88  }
89 }