Exemplo n.º 1
0
 /**
  * @expectedException \Webmozart\Json\Conversion\ConversionFailedException
  */
 public function testConvertValidationErrorsToConversionException()
 {
     $options = array('option' => 'value');
     $jsonData = (object) array('foo' => 'bar');
     $this->innerConverter->expects($this->once())->method('toJson')->with('DATA', $options)->willReturn($jsonData);
     $this->jsonValidator->expects($this->once())->method('validate')->willReturn(array('First error', 'Second error'));
     $this->converter->toJson('DATA', $options);
 }
Exemplo n.º 2
0
 /**
  * @expectedException \Webmozart\Json\Conversion\ConversionFailedException
  */
 public function testFromJsonFailsIfVersionIsMissing()
 {
     $this->migrationManager->expects($this->never())->method('migrate');
     $this->innerConverter->expects($this->never())->method('fromJson');
     $this->converter->fromJson((object) array());
 }