Exemple #1
0
 public function testVolumeCheckFailed()
 {
     $this->ratings = new Ratings($this->destination, $this->logger, $this->progress, 'volume');
     $this->progress->expects($this->once())->method('start')->with(1);
     $this->progress->expects($this->once())->method('advance');
     $this->progress->expects($this->once())->method('finish');
     $this->destination->expects($this->once())->method('getAdapter')->willReturn($this->adapter);
     $this->adapter->expects($this->exactly(2))->method('getSelect')->willReturn($this->select);
     $this->select->expects($this->at(0))->method('from')->with('rating_store', ['rating_id'])->will($this->returnSelf());
     $this->select->expects($this->at(1))->method('where')->with('store_id > 0')->will($this->returnSelf());
     $this->adapter->expects($this->at(1))->method('loadDataFromSelect')->with($this->select)->willReturn([['rating_id' => 1]]);
     $this->adapter->expects($this->at(3))->method('loadDataFromSelect')->with($this->select)->willReturn([['rating_id' => 2]]);
     $this->select->expects($this->at(2))->method('from')->with('rating', ['rating_id'])->will($this->returnSelf());
     $this->select->expects($this->at(3))->method('where')->with('is_active = ?', 1)->will($this->returnSelf());
     $this->logger->expects($this->once())->method('warning')->with('Mismatch of entities in the documents: rating, rating_store');
     $this->assertFalse($this->ratings->perform());
 }