/** * test _beforeSaveMethod via save() */ public function testSave() { $this->validatorMock->expects($this->once())->method('validate')->with($this->equalTo($this->addressMock))->will($this->returnValue([])); $this->entitySnapshotMock->expects($this->once())->method('isModified')->with($this->addressMock)->willReturn(true); $this->addressMock->expects($this->exactly(3))->method('getParentId')->will($this->returnValue(1)); $this->gridPoolMock->expects($this->once())->method('refreshByOrderId')->with($this->equalTo(1))->will($this->returnSelf()); $this->addressResource->save($this->addressMock); }
/** * test _beforeSaveMethod via save() */ public function testSave() { $this->validatorMock->expects($this->once())->method('validate')->with($this->equalTo($this->addressMock))->will($this->returnValue([])); $this->addressMock->expects($this->once())->method('hasDataChanges')->will($this->returnValue(true)); $this->addressMock->expects($this->exactly(2))->method('getOrderId')->will($this->returnValue(2)); $this->gridPoolMock->expects($this->once())->method('refreshByOrderId')->with($this->equalTo(2))->will($this->returnSelf()); $this->addressResource->save($this->addressMock); $this->assertTrue(true); }