Non-existent functions can't be mocked since 2.1.0
评估
调研方向
从 placeOptionalAndReferenceFunction 方法和所引用的 pull request diff 开始,重点关注其对 ReflectionFunction 的调用。确认对于不存在的函数的行为,然后验证对这样的函数进行 mocking 不再引发 ReflectionException。
由索引模型根据 Issue 内容生成。
描述
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:
if (function_exists($function)) {
$this->placeOptionalAndReferenceFunction($namespace, $function);
}
- 主要语言
- PHP
- 星标
- 785
- 派生
- 132
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeception/AspectMock 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 35/100
Codeception/AspectMock#208 · 2 条评论 · 5 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 25/100
Codeception/AspectMock#206 ·
-
难度 3/5 1-2 天 新手友好度 35/100
Codeception/AspectMock#203 ·
-
难度 1/5 1 小时以内 新手友好度 35/100
Codeception/AspectMock#202 · 5 条评论 · 2 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 42/100
Codeception/AspectMock#201 · 1 条评论 ·
查看 Codeception/AspectMock 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
Awaiting Triage bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
product / databases
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
VilnaCRM-Org/user-service#525 ·
维护者通常 21 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
shukiv/jabali-panel#2029 ·
维护者通常 1 天内回复