function it_normalizes_media(FileInterface $file) { $file->getKey()->willReturn('key/of/the/file.pdf'); $file->getOriginalFilename()->willReturn('myfile.pdf'); $file->getId()->willReturn(152); $this->normalize($file, 'mongodb_json', [])->shouldReturn(['id' => 152, 'key' => 'key/of/the/file.pdf', 'originalFilename' => 'myfile.pdf']); }
function it_validates_empty_extension_and_size($context, File $constraint, FileInterface $file) { $constraint->allowedExtensions = []; $file->getId()->willReturn(12); $file->getUploadedFile()->willReturn(null); $file->getExtension()->willReturn('jpg'); $file->getSize()->willReturn(100); $context->buildViolation(Argument::any())->shouldNotBeCalled(); $this->validate($file, $constraint); }