Codeception / Codeception/AspectMock

How can i past a double to a class contructor?

Open
#182 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
784
Forks
132
PR merge metrics
No merged PRs in 30d

Description

the following doesnt' work
```
$ck = test::double(CacheKey::class, [ 'track' => null,])->make();

$cityConfigProvider = new CityConfigProvider($cityConfigBuilder, $ck); // failed for $ck is not an instance of CacheKey
$ck->verifyInvoked('track');

$value = $cityConfigProvider->get($cityId, 'wechat_app_Id');
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the shown test::double(CacheKey::class, ...) setup and the CityConfigProvider constructor call. Inspect how the mocking framework creates doubles for class types; done means the injected $ck is accepted as a CacheKey instance and verifyInvoked('track') works.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.