Codeception / Codeception/AspectMock

test::double doesn't work

オープン
#168 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
784
フォーク
132
PR マージ指標
30日以内にマージされた PR はありません

説明

I created this simple test:
`
require_once __DIR__.'/vendor/autoload.php';

$kernel = \AspectMock\Kernel::getInstance();
$kernel->init([
'debug' => true,
'appDir'=>__DIR__."/vendor/codeception/aspect-mock/src/",
'cacheDir' => "/tmp/amock"
]);

class User {
public function getName() {
return "test";
}
};

$user = AspectMock\Test::double(User::class, ['getName' => 'davert']);
$u = new User;
print $u->getName()."\n";
`
It always print "test" instead "davert".
Here is my composer.json file:
"require": {
"php": ">=7.0.0",
"goaop/framework": "^2.2.0",
"symfony/finder": "~2.4|~3.0|~4.0"
},
"require-dev": {
"codeception/base": "^2.4",
"codeception/verify": "~0.2",
"codeception/specify": "~0.3",
"codeception/aspect-mock": "*",
"phpunit/phpunit": "^6.5"
}

PHP 7.0.33-0ubuntu0.16.04.1 (cli) ( NTS )

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Reproduce the report using the shown PHP snippet, composer.json dependencies, Kernel::init, and AspectMock\Test::double(User::class, ...). Start by tracing how the initialized kernel handles the User class and how Test::double applies method behavior. Done means the example produces "davert" instead of "test".

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。