/** * @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)); }
/** * @param LifecycleEventArgs $eventArgs */ public function postFlush(PostFlushEventArgs $eventArgs) { foreach ($this->delete as $image) { $this->manager->delete($image); } }