dustin10 / VichUploaderBundle

A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
MIT License
1.85k stars 519 forks source link

Final classes not mockable by phpunit #1342

Closed GCth closed 1 year ago

GCth commented 1 year ago

BC Break Report

Q A
BC Break yes
Version 2.0.1

Summary

Marking many classes as final caused the phpunit to be unable to mock them - which makes some of our tests to fail.

Previous behavior

With 1.x bundle version, it was possible to mock UploadHandler

Current behavior

PHPUnit\Framework\MockObject\ClassIsFinalException: Class "Vich\UploaderBundle\Handler\UploadHandler" is declared "final" and cannot be doubled

How to reproduce

$uh = $this->createMock(UploadHandler::class);

It doesn't matter what mappings I use.

garak commented 1 year ago

You can use https://packagist.org/packages/dg/bypass-finals