定制 everzet/persisted-objects 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

everzet/persisted-objects

最新稳定版本:v1.0.4

Composer 安装命令:

composer require everzet/persisted-objects

包简介

Overly simplistic persistance implementations for functional testing

README 文档

README

This repository is a collection of repositories (pun intended) that somebody might find useful in training or testing exercises. They provide an easy way to create Fakes for your repositories in the test infrastructure.

Why?

As stated in the header - for testing and demo purposes. These repos are optimised for cases where you have less than 20 records in your repository and there's always only one user accessing it at a time. In these particular cases these repositories are faster. But in every other instance they're exponentially not.

Usage

Install with:

$> composer require --dev everzet/persisted-objects

Use like this:

$repo = new FileRepository(TEMP_FILE, new AccessorObjectIdentifier('getId'));
$repo->save($user);

$user === $repo->findById($user->getId());

$repo->clear();

or like this:

$repo = new InMemoryRepository(new CallbackObjectIdentifier(
    function($obj) { return $obj->getFirstname() . $obj->getLastname(); }
);
$repo->save($user);

$user === $repo->findById($user->getFirstname() . $user->getLastname());

$repo->clear();

统计信息

  • 总下载量: 70.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 131
  • 点击次数: 1
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 131
  • Watchers: 5
  • Forks: 17
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-16