Skip to content
πŸ„β€β™‚οΈ Allows mocking final classes in PHP.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Create FUNDING.yml Jun 6, 2019
docs Update doc.png Jun 6, 2019
src First Jun 5, 2019
tests First Jun 5, 2019
.editorconfig First Jun 5, 2019
.gitattributes First Jun 5, 2019
.gitignore First Jun 5, 2019
.travis.yml Update .travis.yml Jun 5, 2019
CHANGELOG.md First Jun 5, 2019
CONTRIBUTING.md First Jun 5, 2019
LICENSE.md First Jun 5, 2019
README.md Update README.md Jun 5, 2019
autoload.php First Jun 5, 2019
composer.json Update composer.json Jun 5, 2019
phpstan.neon.dist First Jun 5, 2019
phpunit.xml.dist

README.md

Mock final classes example

Build Status Total Downloads Latest Version License

Created by, and is maintained by Nuno Maduro, and once installed it automatically allows mocking of final methods and classes.

πŸ’‘ Installation & Usage

Requires PHP 7.1+

First, install the package using Composer:

composer require --dev nunomaduro/mock-final-classes

That's it! You can now mock final methods and classes. πŸ„β€β™‚οΈ

🀯 How it works?

  1. First, we run the file autoload.php using Composer Autoload.
  2. Then, if you are running the command PHPUnit, we use the library dg/bypass-finals to remove final keywords from source code on-the-fly: https://github.com/nunomaduro/mock-final-classes/src/Runner.php#L31.

πŸ‘πŸ» Credits

Most of the work is done by the library dg/bypass-finals, so make sure you support the maintainer here: Donate. Thank you!


Mock Final Classes is an open-sourced software licensed under the MIT license.

You can’t perform that action at this time.