Ejemplo n.º 1
0
 public function testIsSingleQueryWhenSeveralConnectionsExist()
 {
     $queryData['checkout'] = false;
     $this->cacheMock->expects($this->once())->method('load')->with('connection_config_cache')->willReturn(false);
     $this->configMock->expects($this->once())->method('getConnectionName')->with('checkout_setup')->willReturn('checkout');
     $this->cacheMock->expects($this->once())->method('save')->with(serialize($queryData), 'connection_config_cache', []);
     $this->assertFalse($this->quoteResolver->isSingleQuery());
 }
Ejemplo n.º 2
0
 /**
  * @return \Magento\Backend\Block\Widget\Grid
  */
 protected function _prepareCollection()
 {
     $collection = $this->_quotesFactory->create();
     if ($this->queryResolver->isSingleQuery()) {
         $collection->prepareForProductsInCarts();
         $collection->setSelectCountSqlType(\Magento\Reports\Model\Resource\Quote\Collection::SELECT_COUNT_SQL_TYPE_CART);
     } else {
         $collection->prepareActiveCartItems();
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }