svensp/callection

跟踪 '当前' 项目以处理堆栈闭包调用

dev-master 2020-09-22 08:20 UTC

This package is auto-updated.

Last update: 2024-09-22 17:37:08 UTC


README

嵌套可调用集合帮助你跟踪被闭包等可调用对象使用的“某个”东西。

本产品包含2个组件

  • 一个跟踪“当前”项目的堆栈
  • 一个集合,通过名称或出现顺序保存项目

安装

通过composer安装nested-callable-collection

composer require svensp/nested-callable-collection

用例

嵌套-callable-collection背后的想法是支持以下方式在单元测试中定义世界

$this->asUser(function() {
  $this->withGame(function() {

    $this->withUser(function() {
      $this->withUnit();
    });

    $this->withUser();
  });
});