Example #1
0
 /**
  * Create mocks for collection and its factory
  */
 private function initCollectionMocks()
 {
     $this->collection = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->setMethods(['addStoreFilter', 'addStatusFilter', 'addEntityFilter', 'getSize', '__wakeup'])->getMock();
     $this->collection->expects(static::any())->method('addStoreFilter')->willReturnSelf();
     $this->collection->expects(static::any())->method('addStatusFilter')->with(Review::STATUS_APPROVED)->willReturnSelf();
     $this->collection->expects(static::any())->method('addEntityFilter')->willReturnSelf();
     $this->collectionFactory = $this->getMockBuilder(CollectionFactory::class)->disableOriginalConstructor()->setMethods(['create', '__wakeup'])->getMock();
     $this->collectionFactory->expects(static::once())->method('create')->willReturn($this->collection);
 }