Codeception / Codeception/AspectMock

Non-existent functions can't be mocked since 2.1.0

未关闭
#158 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
784
派生
132
PR 合并指标
30 天内没有已合并 PR

描述

The problem was introduced here:
https://github.com/Codeception/AspectMock/pull/133/files#diff-50b2697c4aa86740dcae323b3d7ebe44R44

The `placeOptionalAndReferenceFunction` method uses `ReflectionFunction` which throws an exception if a non-existent function name is passed:

> [ReflectionException] Function somefunc() does not exist

Before that change it worked fine when trying to mock a non-existent function. This is a valid use case for a plugin architecture where you may not have desired functions in a test environment.

Can it be like this, for example:
```php
if (function_exists($function)) {
$this->placeOptionalAndReferenceFunction($namespace, $function);
}
```

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 placeOptionalAndReferenceFunction 方法和所引用的 pull request diff 开始,重点关注其对 ReflectionFunction 的调用。确认对于不存在的函数的行为,然后验证对这样的函数进行 mocking 不再引发 ReflectionException。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
testing
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。