/** * @return Response * @throws Controller\NotFoundException */ public function DELETE() { try { $this->storage->delete($this->request->id); } catch (Storage\NotFoundException $e) { throw new Controller\NotFoundException(); } return self::response(ContentType::json(), '{}'); }
public function testPOSTReturnsDocumentInformationAtSavingToStorage() { $storage = $this->getMock('Barberry\\Storage\\StorageInterface'); $storage->expects($this->once())->method('save')->will($this->returnValue('12345xz')); $this->assertEquals(new Response(ContentType::json(), json_encode(array('id' => '12345xz', 'contentType' => 'text/plain', 'ext' => 'txt', 'length' => 10, 'filename' => 'File.txt')), 201), $this->c(self::binaryRequest(), $storage)->POST()); }