public function testWillReturn200OKIfTheShortUrlAlreadyExists()
{
$this->request->expects($this->once())->method('getContent')->will($this->returnValue('
{
"user": "user",
"imageIdentifier": "id",
"extension": null,
"query": null
}
'));
$this->request->expects($this->once())->method('getUser')->will($this->returnValue('user'));
$this->request->expects($this->once())->method('getImageIdentifier')->will($this->returnValue('id'));
$this->database->expects($this->once())->method('imageExists')->with('user', 'id')->will($this->returnValue(true));
$this->database->expects($this->once())->method('getShortUrlId')->with('user', 'id', null, [])->will($this->returnValue('aaaaaaa'));
$this->database->expects($this->never())->method('insertShortUrl');
$this->response->expects($this->once())->method('setModel')->with($this->isInstanceOf('Imbo\\Model\\ArrayModel'))->will($this->returnSelf());
$this->response->expects($this->once())->method('setStatusCode')->with(200);
$this->getNewResource()->createShortUrl($this->event);
}