2017 © Pedro Peláez
 

library unfinalizer

Plugs in composer autolader and removes final keyword from autoloaded classes on fly.

image

jasir/unfinalizer

Plugs in composer autolader and removes final keyword from autoloaded classes on fly.

  • Thursday, April 11, 2013
  • by jasir
  • Repository
  • 1 Watchers
  • 3 Stars
  • 6 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Unfinalizer

Plugs in the composer autolader and removes the final keywords from autoloaded classes on the fly., (*1)

This allows you to mock the final classes and methods in your unit tests., (*2)

Usage

Add the Unfinalizer to your project:, (*3)

composer require --dev jasir/unfinalizer:dev-master
````

In your tests bootstrap file, load Unfinalizer before your composer loading:

include DIR . '/vendor/jasir/unfinalizer/init.php' //add this line include DIR . '/vendor/autoload.php';, (*4)


That's all. Now all the files loaded by the composer autoloading process are without the final methods and classes. Adding own files or files with their own loader ----------------------------------------------- Some frameworks, like Nette, uses their own loader. You can solve this by adding own files to loader:

include DIR . '/vendor/jasir/unfinalizer/init.php' //add this line $loader = include DIR . '/vendor/autoload.php';, (*5)

$loader->add('Nette', DIR . '/vendor/nette/nette');, (*6)

```, (*7)

Now you can mock those finals! Happy testing., (*8)

TODO

Please note this project is in a very alpha stage, so the code is very minimalistic., (*9)

I would like to add (maybe):, (*10)

  • not evaluate changed files, but saving them in cache for easier debugging
  • ... ?

The Versions

11/04 2013

dev-master

9999999-dev

Plugs in composer autolader and removes final keyword from autoloaded classes on fly.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0