Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Unable to instrument classes in the /vendor directory

未关闭
#139 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

从 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Codeception/AspectMock 的其他 Issue

查看 Codeception/AspectMock 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

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