Exemplo n.º 1
0
 public function testHydrate()
 {
     $data = ['id' => 1, 'description' => 'some description'];
     $dataToMerge = ['qty' => 2];
     $this->dataObjectMock->expects($this->once())->method('getData')->willReturn($data);
     $this->dataObjectMock->expects($this->once())->method('setData')->with(array_merge($data, $dataToMerge));
     $this->assertEquals($this->dataObjectMock, $this->entityHydrator->hydrate($this->dataObjectMock, $dataToMerge));
 }
 public function testSaveCreate()
 {
     $this->hydrator->expects($this->once())->method('extract')->with($this->abstractEntity)->willReturn(['test_field_1' => 'test_value_1', 'test_filed_2' => 'test_field_2']);
     $this->metadata->expects($this->never())->method('checkIsEntityExists');
     $this->orchestratorPool->expects($this->once())->method('getWriteOperation')->with('Test\\Entity\\Type', 'create')->willReturn($this->writeOperation);
     $this->writeOperation->expects($this->once())->method('execute')->with('Test\\Entity\\Type', $this->abstractEntity)->willReturn($this->abstractEntity);
     $result = $this->subject->save('Test\\Entity\\Type', $this->abstractEntity);
     $this->assertEquals($this->abstractEntity, $result);
 }