Codeception / Codeception/AspectMock

How to return values from mocked method using test::spec

Aperta
#147 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
PHP
Stelle
784
Fork
132
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.