PHPackages                             holyshared/file-fixture - 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. holyshared/file-fixture

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

holyshared/file-fixture
=======================

Simple file fixture loader for unittest

2.0.2(9y ago)01.4k1[1 issues](https://github.com/holyshared/file-fixture/issues)2MITPHPPHP &gt;=5.6.0

Since Apr 16Pushed 9y agoCompare

[ Source](https://github.com/holyshared/file-fixture)[ Packagist](https://packagist.org/packages/holyshared/file-fixture)[ RSS](/packages/holyshared-file-fixture/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (12)Versions (24)Used By (2)

file-fixture
============

[](#file-fixture)

[![Build Status](https://camo.githubusercontent.com/b428a8c19b310f7fe532ea30641d98d82afa3d441f301f24f8d560070e602f16/68747470733a2f2f7472617669732d63692e6f72672f686f6c797368617265642f66696c652d666978747572652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/holyshared/file-fixture)[![HHVM Status](https://camo.githubusercontent.com/3c4594f0ea52c090d46f05d3d7d1a59f7105d6d42f76f2889986c3fe0fc4f628/687474703a2f2f6868766d2e683463632e64652f62616467652f686f6c797368617265642f66696c652d666978747572652e737667)](http://hhvm.h4cc.de/package/holyshared/file-fixture)[![Coverage Status](https://camo.githubusercontent.com/69b6515e92c5f135a75c40c30fc403a591ef5af89b30010971863b62da50bed7/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f686f6c797368617265642f66696c652d666978747572652f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/r/holyshared/file-fixture?branch=develop)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/99f79a265547bd60e5a710c11ae3eb8cfe91b14c404fd3eb1bccdaf5a97ee96c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686f6c797368617265642f66696c652d666978747572652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/holyshared/file-fixture/?branch=master)[![Dependency Status](https://camo.githubusercontent.com/268efe3a64c1c1f96013c01d1e50c0e46685f48500389a50fef073cef55995b4/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3535326566616461313065373134393036363030303830342f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/552efada10e7149066000804)[![Stories in Ready](https://camo.githubusercontent.com/963bee2eaf4e35d73aeca0b2a9de7b26ed694e18613559782926d636a4b54239/68747470733a2f2f62616467652e776166666c652e696f2f686f6c797368617265642f66696c652d666978747572652e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/holyshared/file-fixture)

Simple file fixture loader for unittest.
You can easily load the test-based fixture.

Table of contents
-----------------

[](#table-of-contents)

- [Basic usage](#basic-usage)
- [Output fixture of terminal](#output-fixture-of-terminal)
- [Configuration file](#configuration-file)

Basic usage
-----------

[](#basic-usage)

Will be able to load the fixture in four steps.

1. Create a loader of container
2. Create a fixture of container
3. Create a FileFixture
4. Load fixture from the container.

```
$loaders = new LoaderContainer([
    new TextLoader()
]);

$fixtures = new FixtureContainer([
    'text:default:readme' => __DIR__ . '/README.md'
]);

$fixture = new FileFixture($fixtures, $loaders);
$content = $fixture->load('text:default:readme');

print $content;
```

Loader is compatible with text data, [mustache](https://github.com/bobthecow/mustache.php) template, ASCII art.

- TextLoader - Load the text data.
- MustacheLoader - Load the [mustache](https://github.com/bobthecow/mustache.php) template
- ArtLoader - Load the ASCII art.

Output fixture of terminal
--------------------------

[](#output-fixture-of-terminal)

With **ArtLoader**, you can load the coloring text data.

### Create a fixture file

[](#create-a-fixture-file)

Create a fixture file.
Mark the text to apply the color in the tag.

```
#######
#
#
#####
#
#
#

```

### Load of Output fixture

[](#load-of-output-fixture)

```
$loaders = new LoaderContainer([
    new ArtLoader(new MustacheLoader(new TextLoader()))
]);

$fixtures = new FixtureContainer([
    'art:default:header' => __DIR__ . '/art.txt'
]);

$fixture = new FileFixture($fixtures, $loaders);
$content = $fixture->load('art:default:header');

print $content;
```

[![Result of ArtLoader](https://raw.githubusercontent.com/holyshared/file-fixture/master/art.png "Result of ArtLoader")](https://raw.githubusercontent.com/holyshared/file-fixture/master/art.png)

Configuration file
------------------

[](#configuration-file)

Using the configuration file, you will be able to easily load the fixture.
Example of the fixture to load the [mustache](https://github.com/bobthecow/mustache.php) of template.

### Create a fixture template

[](#create-a-fixture-template)

```
{{name}} task was successful.
```

### Create a configuration file of fixture

[](#create-a-configuration-file-of-fixture)

The name of the fixture, you must begin with the name of the **loader**.

```
[mustache.default]
successMessage = "template.ms"
```

The name of this fixture will be **mustache:default:successMessage**.

### Load of fixture

[](#load-of-fixture)

Load the fixture by specifying the name.
When the load is successful, will return the results of template of [mustache](https://github.com/bobthecow/mustache.php) has been processed.

```
$textLoader = new TextLoader();
$loaders = new LoaderContainer([
    $textLoader,
    new MustacheLoader($textLoader)
]);

$factory = new FixtureContainerFactory();
$fixtures = $factory->createFromFile(__DIR__ . '/fixtures.toml');

$fixture = new FileFixture($fixtures, $loaders);
$content = $fixture->load('mustache:default:successMessage', [
    'name' => 'build'
]);

print $content;
```

Contributors
------------

[](#contributors)

- Jérémy Marodon ([@Th3Mouk](https://github.com/Th3Mouk))

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% 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 ~29 days

Recently: every ~71 days

Total

23

Last Release

3405d ago

Major Versions

0.4.0 → 1.0.02015-04-30

1.0.7 → 2.0.02016-08-10

PHP version history (3 changes)0.1.0PHP &gt;=5.4.0

1.0.0PHP &gt;=5.5.0

2.0.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/70c299d6d6015ee714954aa05e4d0e9c7b1d31318a5d7db5e9bb4e1f70f78afc?d=identicon)[holyshared](/maintainers/holyshared)

---

Top Contributors

[![holyshared](https://avatars.githubusercontent.com/u/167190?v=4)](https://github.com/holyshared "holyshared (112 commits)")[![Th3Mouk](https://avatars.githubusercontent.com/u/5006899?v=4)](https://github.com/Th3Mouk "Th3Mouk (2 commits)")[![waffle-iron](https://avatars.githubusercontent.com/u/6912981?v=4)](https://github.com/waffle-iron "waffle-iron (1 commits)")

### Embed Badge

![Health badge](/badges/holyshared-file-fixture/health.svg)

```
[![Health](https://phpackages.com/badges/holyshared-file-fixture/health.svg)](https://phpackages.com/packages/holyshared-file-fixture)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

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

Official version of pdepend to be handled with Composer

954110.9M815](/packages/pdepend-pdepend)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[instaclick/php-webdriver

PHP WebDriver for Selenium 2

43761.8M22](/packages/instaclick-php-webdriver)[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3257.8M898](/packages/szepeviktor-phpstan-wordpress)

PHPackages © 2026

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