承接 holyshared/file-fixture 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

holyshared/file-fixture

Composer 安装命令:

composer require holyshared/file-fixture

包简介

Simple file fixture loader for unittest

README 文档

README

Build Status HHVM Status Coverage Status Scrutinizer Code Quality Dependency Status Stories in Ready

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

Table of contents

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 template, ASCII art.

  • TextLoader - Load the text data.
  • MustacheLoader - Load the mustache template
  • ArtLoader - Load the ASCII art.

Output fixture of terminal

With ArtLoader, you can load the coloring text data.

Create a fixture file

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

<green>#######</green>
<green>#</green>
<green>#</green>
<green>#####</green>
<green>#</green>
<green>#</green>
<green>#</green>

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

Configuration file

Using the configuration file, you will be able to easily load the fixture.
Example of the fixture to load the mustache of template.

Create a fixture template

{{name}} task was successful.

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 the fixture by specifying the name.
When the load is successful, will return the results of template of mustache 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

holyshared/file-fixture 适用场景与选型建议

holyshared/file-fixture 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.39k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 holyshared/file-fixture 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 holyshared/file-fixture 我们能提供哪些服务?
定制开发 / 二次开发

基于 holyshared/file-fixture 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 38
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-15