/**
  * @param mixed $id
  * @param mixed $data
  * @return ImageInterface
  */
 public function update($id, $data)
 {
     $blob = $this->searchBlob($data);
     if ($blob instanceof ApiProblem) {
         return $blob;
     }
     $this->imageManager->grab($blob, $id);
     $image = $this->imageManager->get($id);
     $entity = $this->getApigilityResponse($image, $id);
     $this->getEvent()->setParam('image', $entity);
     return $entity;
 }
Exemplo n.º 2
0
 public function testServiceGet()
 {
     $image = $this->getMockForAbstractClass('ImgMan\\Image\\Image');
     $storage = $this->getMock('ImgMan\\Storage\\Adapter\\Mongo\\MongoAdapter');
     $storage->expects($this->any())->method('getImage')->will($this->returnValue($image));
     $adapter = $this->getMock('ImgMan\\Core\\Adapter\\ImagickAdapter');
     $adapter->expects($this->any())->method('getMimeType')->will($this->returnValue('image/png'));
     $pluginManager = $this->getMock('ImgMan\\Operation\\HelperPluginManager');
     /** @var $storage MongoAdapter */
     /** @var $pluginManager HelperPluginManager */
     /** @var $adapter ImagickAdapter */
     $service = new ImageService($storage, $pluginManager, $adapter);
     $this->assertSame($image, $service->get('test/test/', 'thumb'));
 }