Unable to instrument classes in the /vendor directory
还没有人认领这个 Issue。
评估
调研方向
从 issue 中显示的 bootstrap 配置开始,使用 PayPal\IPN\PPIPNMessage 重现测试,重点关注 includePaths、excludePaths 和 Composer autoloading。追踪 test::double 为什么没有拦截 /vendor 类的 getRawData。调用被拦截且 verifyInvoked('getRawData') 通过后,即视为完成。
由索引模型根据 Issue 内容生成。
描述
I was able to get AspectMock to instrument my own classes in my directory but I can not get it to work on classes in the composer /vendor directory....
Is this even possible?
I tried adding vendor to my includePaths but I get the issue in #112
My bootstrap looks basically like this:
require_once __DIR__.'/../vendor/autoload.php'; // composer autoload
$kernel = \AspectMock\Kernel::getInstance();
$kernel->init([
'debug' => true,
'appDir' => __DIR__.'/..',
'cacheDir' => __DIR__.'/_data/aopcache',
'includePaths' => [
__DIR__.'/../repo'
],
'excludePaths' => [
__DIR__,
]
]);
Sample of my test code:
$testDataStr = 'var=1&var=2';
$paypalIPN = test::double(new \PayPal\IPN\PPIPNMessage($testDataStr), [
'getRawData' => ['Returned test double'],
]);
$this->assertTrue($paypalIPN->class->hasMethod('getRawData'));
$testData = $paypalIPN->getRawData();
$paypalIPN->verifyInvoked('getRawData'); // fails
fails with:
Expected PayPal\IPN\PPIPNMessage->getRawData to be invoked but it never occurred. Got:
Versions
php 5.6.30
codeception/aspect-mock:2.0.1 @b7f5c50da89419824102400bb4c71988ec33044f
goaop/framework:2.1.2 @6e2a0fe13c1943db02a67588cfd27692bddaffa5
goaop/parser-reflection:1.4.0 @adfc38fee63014880932ebcc4810871b8e33edc9
- 主要语言
- 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 半天 新手友好度 68/100
components-web-app/docs#244 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
nhrrob/nhrrob-secure#22 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
PrestaShopCorp/ps_eventbus#501 · 2 个 reaction ·
-
category::task maintenance priority::normal
难度 2/5 1-3 小时 新手友好度 62/100
e0ipso/schema-forms-php#58 ·
-
难度 2/5 1-3 小时 新手友好度 66/100
Automattic/blocks-engine#2866 ·
维护者通常 1 天内回复