Codeception / Codeception/AspectMock
test::double doesn't work
- Dominant language
- PHP
- Stars
- 784
- Forks
- 132
- PR merge metrics
- No merged PRs in 30d
Description
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 )
Contributor guide
No contributing guide indexed for this repository
Research direction
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".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100