{"id":25687174,"url":"https://github.com/holyshared/file-fixture","last_synced_at":"2026-05-13T08:35:53.701Z","repository":{"id":30418052,"uuid":"33970951","full_name":"holyshared/file-fixture","owner":"holyshared","description":"Simple file fixture loader for unittest","archived":false,"fork":false,"pushed_at":"2017-01-20T01:47:53.000Z","size":118,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T13:45:17.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holyshared.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-15T03:24:26.000Z","updated_at":"2017-01-19T10:21:37.000Z","dependencies_parsed_at":"2022-08-21T12:20:43.690Z","dependency_job_id":null,"html_url":"https://github.com/holyshared/file-fixture","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2Ffile-fixture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2Ffile-fixture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2Ffile-fixture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2Ffile-fixture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holyshared","download_url":"https://codeload.github.com/holyshared/file-fixture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240549397,"owners_count":19819139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-24T20:08:18.613Z","updated_at":"2026-05-13T08:35:48.682Z","avatar_url":"https://github.com/holyshared.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"file-fixture\n==================================\n\n[![Build Status](https://travis-ci.org/holyshared/file-fixture.svg?branch=master)](https://travis-ci.org/holyshared/file-fixture)\n[![HHVM Status](http://hhvm.h4cc.de/badge/holyshared/file-fixture.svg)](http://hhvm.h4cc.de/package/holyshared/file-fixture)\n[![Coverage Status](https://coveralls.io/repos/holyshared/file-fixture/badge.svg?branch=develop)](https://coveralls.io/r/holyshared/file-fixture?branch=develop)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/holyshared/file-fixture/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/holyshared/file-fixture/?branch=master)\n[![Dependency Status](https://www.versioneye.com/user/projects/552efada10e7149066000804/badge.svg?style=flat)](https://www.versioneye.com/user/projects/552efada10e7149066000804)\n[![Stories in Ready](https://badge.waffle.io/holyshared/file-fixture.png?label=ready\u0026title=Ready)](https://waffle.io/holyshared/file-fixture)\n\nSimple file fixture loader for unittest.  \nYou can easily load the test-based fixture.  \n\nTable of contents\n----------------------------------\n\n* [Basic usage](#basic-usage)\n* [Output fixture of terminal](#output-fixture-of-terminal)\n* [Configuration file](#configuration-file)\n\n\nBasic usage\n----------------------------------\n\nWill be able to load the fixture in four steps.\n\n1. Create a loader of container\n2. Create a fixture of container\n3. Create a FileFixture\n4. Load fixture from the container.\n\n```php\n$loaders = new LoaderContainer([\n    new TextLoader()\n]);\n\n$fixtures = new FixtureContainer([\n    'text:default:readme' =\u003e __DIR__ . '/README.md'\n]);\n\n$fixture = new FileFixture($fixtures, $loaders);\n$content = $fixture-\u003eload('text:default:readme');\n\nprint $content;\n```\n\nLoader is compatible with text data, [mustache](https://github.com/bobthecow/mustache.php) template, ASCII art.  \n\n* TextLoader - Load the text data.\n* MustacheLoader - Load the [mustache](https://github.com/bobthecow/mustache.php) template\n* ArtLoader - Load the ASCII art.\n\n\nOutput fixture of terminal\n----------------------------------\n\nWith **ArtLoader**, you can load the coloring text data.\n\n### Create a fixture file\n\nCreate a fixture file.  \nMark the text to apply the color in the tag.  \n\n```text\n\u003cgreen\u003e#######\u003c/green\u003e\n\u003cgreen\u003e#\u003c/green\u003e\n\u003cgreen\u003e#\u003c/green\u003e\n\u003cgreen\u003e#####\u003c/green\u003e\n\u003cgreen\u003e#\u003c/green\u003e\n\u003cgreen\u003e#\u003c/green\u003e\n\u003cgreen\u003e#\u003c/green\u003e\n```\n\n### Load of Output fixture\n\n```php\n$loaders = new LoaderContainer([\n    new ArtLoader(new MustacheLoader(new TextLoader()))\n]);\n\n$fixtures = new FixtureContainer([\n    'art:default:header' =\u003e __DIR__ . '/art.txt'\n]);\n\n$fixture = new FileFixture($fixtures, $loaders);\n$content = $fixture-\u003eload('art:default:header');\n\nprint $content;\n```\n\n![Result of ArtLoader](https://raw.githubusercontent.com/holyshared/file-fixture/master/art.png \"Result of ArtLoader\")\n\n\nConfiguration file\n----------------------------------\n\nUsing the configuration file, you will be able to easily load the fixture.  \nExample of the fixture to load the [mustache](https://github.com/bobthecow/mustache.php) of template.\n\n### Create a fixture template\n\n```mustache\n{{name}} task was successful.\n```\n\n### Create a configuration file of fixture\n\nThe name of the fixture, you must begin with the name of the **loader**.  \n\n```toml\n[mustache.default]\nsuccessMessage = \"template.ms\"\n```\n\nThe name of this fixture will be **mustache:default:successMessage**.\n\n### Load of fixture\n\nLoad the fixture by specifying the name.  \nWhen the load is successful, will return the results of template of [mustache](https://github.com/bobthecow/mustache.php) has been processed.  \n\n```php\n$textLoader = new TextLoader();\n$loaders = new LoaderContainer([\n    $textLoader,\n    new MustacheLoader($textLoader)\n]);\n\n$factory = new FixtureContainerFactory();\n$fixtures = $factory-\u003ecreateFromFile(__DIR__ . '/fixtures.toml');\n\n$fixture = new FileFixture($fixtures, $loaders);\n$content = $fixture-\u003eload('mustache:default:successMessage', [\n    'name' =\u003e 'build'\n]);\n\nprint $content;\n```\n\n\nContributors\n----------------------------------\n\n* Jérémy Marodon ([@Th3Mouk](https://github.com/Th3Mouk))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Ffile-fixture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholyshared%2Ffile-fixture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Ffile-fixture/lists"}