Exemplo n.º 1
0
 /**
  * @test
  */
 public function deleteDelegates()
 {
     $resource = Resource::create();
     $this->adapter->expects($this->once())->method('delete')->with($resource)->will($this->returnValue('lus'));
     $this->adapter->expects($this->once())->method('exists')->with($resource)->will($this->returnValue(true));
     $this->cache->expects($this->once())->method('delete')->with($resource);
     $this->assertEquals('lus', $this->storage->delete($resource));
 }
Exemplo n.º 2
0
 /**
  * Deletes a resource
  *
  * @param Resource $resource
  */
 public function delete(Resource $resource)
 {
     $event = new ResourceEvent($resource);
     $this->eventDispatcher->dispatch(Events::RESOURCE_BEFORE_DELETE, $event);
     $this->backend->deleteResource($resource);
     $this->storage->delete($resource);
     $event = new ResourceEvent($resource);
     $this->eventDispatcher->dispatch(Events::RESOURCE_AFTER_DELETE, $event);
     return $resource;
 }