/**
  * @param Request $inputData
  * @param Quote $expectedData
  *
  * @dataProvider processValidDataProvider
  */
 public function testProcessValidData(Request $inputData, Quote $expectedData)
 {
     $this->form->expects($this->once())->method('setData')->with($inputData);
     $this->request->setMethod('POST');
     $this->form->expects($this->once())->method('submit')->with($this->request);
     $this->form->expects($this->once())->method('isValid')->willReturn(true);
     $this->manager->expects($this->once())->method('persist')->with($expectedData);
     $this->manager->expects($this->once())->method('flush');
     $this->assertNull($this->handler->getQuote());
     $this->assertTrue($this->handler->process($inputData));
     $this->assertEquals($expectedData, $this->handler->getQuote());
 }
 public function testProcessInvalid()
 {
     $data = new Request();
     $this->form->expects($this->once())->method('setData')->with($data);
     $this->request->setMethod('POST');
     $this->form->expects($this->once())->method('submit')->with($this->request);
     $this->form->expects($this->once())->method('isValid')->willReturn(true);
     $this->manager->expects($this->once())->method('persist');
     $exception = new DBALException();
     $this->manager->expects($this->once())->method('flush')->will($this->throwException($exception));
     $this->assertFalse($this->handler->process($data));
     $this->assertSame($exception, $this->handler->getException());
 }