PHPackages                             metaclass-nl/fit-shelf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. metaclass-nl/fit-shelf

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

metaclass-nl/fit-shelf
======================

reimplementation in PHP5 of the functionality of Fit Library as described in the book 'Fit for developing Software' of Rick Mugridge and Ward Cunningham

v0.5(12y ago)07GPLPHPPHP &gt;=5.3.2

Since Aug 30Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/metaclass-nl/fit-shelf)[ Packagist](https://packagist.org/packages/metaclass-nl/fit-shelf)[ Docs](http://www.metaclass.nl/site/index_php/Menu/224)[ RSS](/packages/metaclass-nl-fit-shelf/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

This repository is no longer maintained.

Fit Shelf for PHPFIT
====================

[](#fit-shelf-for-phpfit)

INTRODUCTION
------------

[](#introduction)

Fit Shelf is a reimplementation in PHP of the functionality of Fit Library as described in the book "Fit for developing Software" of Rick Mugridge and Ward Cunningham, mostly chapters 10 and 28. For usage documentation i refer to these chapters of this excellent book and .

Fit shelf is not a port of Fit Library. The reason to reimplement was that the porting of the 1175 KB java source files of Fit Library (not including Fit and examples) would have taken too much work. With only 53.2 KB in PHP source files\[1\] Fit Shelf is much simpeler. As its name suggest is does not pretend to be a complete library, but rather a small shelf. But easyer to understand, use and port. And written in PHP!

SECURITY
--------

[](#security)

Do not install in a production environment.

WARNING: Fit Shelf allows tests to access arbitrary properties and methods on the object under test. It has no notion of authorization. Allowing end users to run self-modified tests may expose sensitive data, cause fatal errors and leave the system in an undefined state.

INSTALLATION AND CONFIGURATION
------------------------------

[](#installation-and-configuration)

- *With Composer*

    See Readme.md of the [fit-skeleton package](https://github.com/metaclass-nl/fit-skeleton).
    Requires PHP &gt;= 5.3.2.
- *Manually*

    See the [instructions for manual configuration](doc/ConfigManually.md)
    Requires PHP &gt;= 5.3.2.

SPECIAL FEATURES
----------------

[](#special-features)

1. Mixed data typing

    In order to support the mixed data typing of PHP, a special adapter is included: PHPFIT\_TypeAdapter\_PhpTolerant.php. Because adapter is meant to work with any type, it is used as a fallback whenever type information is missing. In practice this means that you can in most case simply run any tests and forget about data typing.

    However, if you DO supply type information, this adapter will delegate to the corresponding PhpFit data type adapter.
2. Support for not-yet-defined properties and \_\_get, \_\_set and \_\_call magic methods

    Fit Library supports the direct usage of properties and methods of the system under test from tests. With DoFixture if a method or property does not exist, a fixture is loaded. But in PHP5, if the right magic methods are implemented you may get or set a property or call a method that does not exist. And you may also set a property that is not defined at all.

    In order to allow you to get, set and call unconditionally, Shelf's DoFixture supports the fixture methods 'get', 'set' and 'call' that do not default to fixure loading.
3. Adaptation to application meta models

    In Java an single meta model is prescibed by the Java Beans standard: properties have getters, setters and maybe a field, meta data can be obtained through Bean Descriptors and reflection.

    In PHP there is not such a strict standard. The documentation and the \_\_get and \_\_set magic methods suggest the meaning of properties, but specific applications and frameworks may well follow a different meta model. This will for example be the case with a one to one port of the examples of of the book: they follow the Java Beans standard, which is different from the way suggested by the documentation of PHP.

    In order to support that, Shelf uses two layers of adapters, one for the meta model, and a second for the actual typing. Currently two MetaModel adapters are available:

    - PHPFIT\_TypeAdapter\_PhpTolerant for ordinary PHP objects using member variables for properties. This is the default adapter used by Shelf fixtures
    - PHPFIT\_TypeAdapter\_BeanTolerant for Beans-like objects using getter and setter methods for accessing properties.

    You may activate an adapter from your fixture class by adding the following method:

    ```
     protected function interpretTablesInit() {
     	parent::interpretTablesInit();
     	fitshelf\ClassHelper::adapterType('BeanTolerant');
     }

    ```

    Usually your tests will start with activating some subclass of fitshelf\\DoFixture and that fixture will run this method. From then on the other shelf fixtures that your tests use will also use this adapter. Fixtures directly extending those from PHPFIT need to add another method:

    ```
     static function getType($classOrObject, $name, $property) {
     	return fitshelf\ClassHelper::adapterType();
     }

    ```

    Fit Shelf provides subclasses for serveral PHPFIT fixtures that already have this method.

    If the meta model of your own application (or framework) is different you may implement your own type adapter using the adapters that come with shelf as examples. If you use Composer you may autoload them using the ClassLoader of Composer or the one from Fit Shelf.
    Warning: The adapers will be refactored in order to support strict typing for the php metamodel.

RELEASE NOTES
-------------

[](#release-notes)

This beta has been adapted to PSR-0 name spacing and class loading. If you have Fixtures running on a previous version of Fit Shelf you will have to adapt them.

This beta does not include CalculateFixture and SetupFixture.

This beta does not include all examples ported from the tests described in the book "Fit for developing Software". Please help by porting more tests that are meant to run on Fit Library.

The Adapters should be refactored in order to support strict typing, see PHPFIT\_TypeAdapter\_PhpTolerant.php.

Some smaller refactorings may be made with respect to reoccurring code.

Also see the [ChangeLog](doc/ChangeLog.md) in the doc folder.

SUPPORT (Dutch)
---------------

[](#support-dutch)

MetaClass biedt hulp en ondersteuning binnen Nederland bij onderhoud en ontwikkeling van software, tests en fixtures. Voor meer informatie kijk op

COPYRIGHT AND LICENCE
---------------------

[](#copyright-and-licence)

Courtesy to Rick Mugridge for the functional specification of Fit Library () and the ideas behind it to which MetaClass claims no rights.

This implementation (Fit Shelf) is Copyright (c) 2010-2012 H. Verhoeven Beheer BV, holding of MetaClass Groningen Nederland. All rights reserved.

Licensed under the GNU General Public License version 3 or later.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

\[1\]: not including CalculateFixture and SetupFixture.
Fit Shelf is not tested with Fitnesse. Is not inteded to work the same as Fit Library, only to work like descibed in the book, but with the special features as described here.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance43

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Total

3

Last Release

4560d ago

PHP version history (2 changes)v0.3PHP &gt;=5.1.6

v0.4PHP &gt;=5.3.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3db8cedf943b1bdd890100a310c8fb2593e0666390c4939e5a150153a746b91e?d=identicon)[metaclass-nl](/maintainers/metaclass-nl)

---

Top Contributors

[![metaclass-nl](https://avatars.githubusercontent.com/u/3610075?v=4)](https://github.com/metaclass-nl "metaclass-nl (27 commits)")

---

Tags

testingDSLtableFitacceptance

### Embed Badge

![Health badge](/badges/metaclass-nl-fit-shelf/health.svg)

```
[![Health](https://phpackages.com/badges/metaclass-nl-fit-shelf/health.svg)](https://phpackages.com/packages/metaclass-nl-fit-shelf)
```

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k910.7M134.8k](/packages/phpunit-phpunit)[phpunit/php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

8.9k892.4M1.5k](/packages/phpunit-php-code-coverage)[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[symfony/phpunit-bridge

Provides utilities for PHPUnit, especially user deprecation notices management

2.5k201.2M4.2k](/packages/symfony-phpunit-bridge)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
