public function testCanFormatAnErrorModel()
{
$formattedDate = 'Wed, 30 Jan 2013 10:53:11 GMT';
$date = new DateTime($formattedDate);
$model = $this->getMock('Imbo\\Model\\Error');
$model->expects($this->once())->method('getHttpCode')->will($this->returnValue(404));
$model->expects($this->once())->method('getErrorMessage')->will($this->returnValue('Public key not found'));
$model->expects($this->once())->method('getDate')->will($this->returnValue($date));
$model->expects($this->once())->method('getImboErrorCode')->will($this->returnValue(100));
$model->expects($this->once())->method('getImageIdentifier')->will($this->returnValue('identifier'));
$this->dateFormatter->expects($this->once())->method('formatDate')->with($date)->will($this->returnValue($formattedDate));
$json = $this->formatter->format($model);
$data = json_decode($json, true);
$this->assertSame($formattedDate, $data['error']['date']);
$this->assertSame('Public key not found', $data['error']['message']);
$this->assertSame(404, $data['error']['code']);
$this->assertSame(100, $data['error']['imboErrorCode']);
$this->assertSame('identifier', $data['imageIdentifier']);
}