Patched Mage.php to make Magento testable with MockObjects
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Mage_1.4.1.1.php
Mage_1.4.2.0.php
Mage_1.5.0.1.php
Mage_1.5.1.0.php
Mage_1.6.0.0.php
Mage_1.7.0.2.php
README

README

Nutwerk_MageTestable
====================

DESCRIPTION:

This project aims to make Magento testable with PHPUnit by providing patches
to the Mage.php class. Those patches will allow to insert values, objects and
MockObjects into several static/singleton Mage functions.


FEATURES:

 - Mage::setStoreConfig($path, $value, $store = null)
 - Mage::setModel($modelClass, $model)
 - Mage::setResourceModel($modelClass, $model)
 - Mage::setResourceSingleton($modelClass, $model)
 - Mage::setHelper($name, $helper)

Mage::setModel() and Mage::setResourceModel are implemented as FIFO registry
arrays. All the other methods use simple registries.


INSTALLATION:

This project provides patched Mage.php files for different Magento versions.
The version is appended to the filename.

Simply copy the Mage_<version>.php for your current Magento version to your 
"tests" folder and include it in your test setup script.

The only thing that has to be changed is the value of the "BP" constant at the
beginning of the file to match your Magento root directory.

That's it :)