Ejemplo n.º 1
0
 public function testSetValue()
 {
     $this->structure->expects($this->any())->method('hasField')->with($this->equalTo('fieldName'))->willReturn(true);
     $this->records[0]->expects($this->any())->method('setValue')->with($this->equalTo('fieldName'), $this->equalTo('default'));
     $this->records[1]->expects($this->any())->method('setValue')->with($this->equalTo('fieldName'), $this->equalTo('default'));
     $this->records[2]->expects($this->any())->method('setValue')->with($this->equalTo('fieldName'), $this->equalTo('default'));
     $this->recordCollection->setValue('fieldName', 'default');
 }
Ejemplo n.º 2
0
 public function testIntegrityFieldFail()
 {
     $this->ratings = new Ratings($this->destination, $this->logger, $this->progress, 'integrity');
     $this->progress->expects($this->once())->method('start')->with(1);
     $this->progress->expects($this->once())->method('advance');
     $this->progress->expects($this->never())->method('finish');
     $this->destination->expects($this->once())->method('getDocumentList')->willReturn(['rating', 'rating_store']);
     $this->structure->expects($this->once())->method('getFields')->willReturn(['field' => []]);
     $this->document->expects($this->once())->method('getStructure')->willReturn($this->structure);
     $this->destination->expects($this->once())->method('getDocument')->with('rating')->willReturn($this->document);
     $this->logger->expects($this->once())->method('error')->with('Integrity check failed due to "is_active" field does not exist in "rating" document of ' . 'the destination resource');
     $this->assertFalse($this->ratings->perform());
 }
Ejemplo n.º 3
0
 /**
  * @expectedException \Migration\Exception
  * @expectedExceptionMessage Record structure does not match provided Data
  */
 public function testSetDataWithException()
 {
     $this->structure->expects($this->any())->method('getFields')->willReturn(['id', 'name']);
     $this->record->setStructure($this->structure);
     $this->record->setData(['id' => 11, 'wrongName' => 'item2']);
 }