public function testGetSize()
 {
     $size = 42;
     $this->query->expects($this->once())->method('getSize')->willReturn($size);
     $this->assertEquals($size, $this->searchResult->getSize());
 }
 /**
  * Perform operations after collection load
  *
  * @return void
  */
 protected function afterLoad()
 {
     if ($this->getSearchCriteria()->getPart('first_store_flag')) {
         $items = $this->searchResultProcessor->getColumnValues($this->linkFieldName);
         $connection = $this->getQuery()->getConnection();
         $resource = $this->getQuery()->getResource();
         if (count($items)) {
             $select = $connection->select()->from(['cps' => $resource->getTable($this->storeTableName)])->where("cps.{$this->linkFieldName} IN (?)", $items);
             $result = $connection->fetchPairs($select);
             if ($result) {
                 foreach ($this->getItems() as $item) {
                     /** @var BlockInterface $item */
                     if (!isset($result[$item->getId()])) {
                         continue;
                     }
                     if ($result[$item->getId()] == 0) {
                         $stores = $this->storeManager->getStores(false, true);
                         $storeId = current($stores)->getId();
                         $storeCode = key($stores);
                     } else {
                         $storeId = $result[$item->getId()];
                         $storeCode = $this->storeManager->getStore($storeId)->getCode();
                     }
                     $item->setData('_first_store_id', $storeId);
                     $item->setData('store_code', $storeCode);
                     $item->setData('store_id', [$result[$item->getId()]]);
                 }
             }
         }
     }
     parent::afterLoad();
 }