예제 #1
0
 /**
  * @magentoDataFixture Magento/Review/_files/customer_review_with_rating.php
  */
 public function testAggregate()
 {
     $rating = $this->reviewCollection->getFirstItem();
     $this->reviewResource->aggregate($rating);
     $select = $this->adapter->select()->from($this->resource->getTableName('review_entity_summary'));
     $result = $this->adapter->fetchRow($select);
     $this->assertEquals(1, $result['reviews_count']);
     $this->assertEquals(40, $result['rating_summary']);
 }
예제 #2
0
 /**
  * Set order
  *
  * @param string $attribute
  * @param string $dir
  * @return $this
  */
 public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
 {
     if (in_array($attribute, ['nickname', 'title', 'detail', 'created_at'])) {
         $this->_select->order($attribute . ' ' . $dir);
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
예제 #3
0
 public function testAddReviewsTotalCount()
 {
     $this->selectMock->expects($this->once())->method('joinLeft')->with(['r' => 'review'], 'main_table.entity_pk_value = r.entity_pk_value', ['total_reviews' => new \Zend_Db_Expr('COUNT(r.review_id)')])->willReturnSelf();
     $this->selectMock->expects($this->once())->method('group');
     $this->model->addReviewsTotalCount();
 }
예제 #4
0
 /**
  * Init Select
  *
  * @return $this
  */
 protected function _initSelect()
 {
     parent::_initSelect();
     $this->_joinCustomers();
     return $this;
 }