Codeception / Codeception/AspectMock
How to return values from mocked method using test::spec
- Dominant language
- PHP
- Stars
- 784
- Forks
- 132
- PR merge metrics
- No merged PRs in 30d
Description
Is it possible to return fake values from mocked methods using an object created with `test::spec` ? I've tried this and it never seems to call my fake method:
```
$fakeValue = '1';
$mock = test::spec('FakeClass', [
'fakeMethod' => function () {
return $fakeValue;
}
])->construct();
```
Then when I call $mock->fakeMethod() it's not returning my fakeValue;
Is this just supported or am I doing something wrong?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the test::spec snippet in the issue and inspect how mocked methods are invoked. Determine whether returning fake values from the shown object is supported or whether the example is invalid; done means the supported behavior and correct usage are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100