Exemplo n.º 1
0
 /**
  * @covers ::store
  * @covers ::delete
  * @covers ::getImagePath
  * @covers ::createDirectoryRecursively
  */
 public function testStoreAndDelete()
 {
     $id = 'someId';
     $ext = 'ext';
     $name = 'filename.' . $ext;
     $path = sprintf('d/I/%s.%s', $id, $ext);
     $resource = 'someResource';
     $image = $this->getMockBuilder(ImageEntity::class)->setMethods(['getResource'])->getMock();
     $image->setId($id);
     $image->setName($name);
     $image->method('getResource')->willReturn($resource);
     $this->manager->store($image);
     $root = vfsStreamWrapper::getRoot();
     $this->assertTrue($root->hasChild($path));
     $this->assertEquals($resource, $root->getChild($path)->getContent());
     $this->manager->delete($image);
     $this->assertFalse($root->hasChild($path));
 }
Exemplo n.º 2
0
 /**
  * @param LifecycleEventArgs $eventArgs
  */
 public function postFlush(PostFlushEventArgs $eventArgs)
 {
     foreach ($this->delete as $image) {
         $this->manager->delete($image);
     }
 }