Codeception / Codeception/AspectMock

Aspect Mock broken by comments

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

描述

Method declaration such as `function myMethod( ) /* {{{ */ {` cannot be mocked with Aspect Mock.

On line 98 current code gets the first open bracket { amd inserts the injection code after it
`$pos = strpos($dataArray[$i], '{');`

https://github.com/Codeception/AspectMock/blob/master/src/AspectMock/Intercept/BeforeMockTransformer.php#L98

This turns the method declaration to
`function myMethod( ) /* { if (($__am_res = __amock_before($this, __CLASS__, __FUNCTION__, array(), false)) !== __AM_CON
TINUE__) return $__am_res; {{ */ {
`

Which basically commented all Aspect Mock injection code.

贡献指南

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

调研方向

Start in src/AspectMock/Intercept/BeforeMockTransformer.php at line 98 and inspect how the first opening brace is located in a method declaration. Reproduce the issue with a declaration containing a comment before the brace; done means the generated comment no longer comments out the Aspect Mock injection code.

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

评估

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

把新 issue 发到你的邮箱

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