phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 241 forks source link

imp: willYield handle Generator::getReturn() #507

Closed camilledejoye closed 3 years ago

camilledejoye commented 3 years ago

The current implementation of MethodProphecy::willYield() does not allow to specify a return value for the mocked generator.

The proposal here is to add an optional parameter allowing to define the return value:

$prophecy->createGenerator()->willYield(['foo', 'bar'], 'return value');
ciaranmcnulty commented 3 years ago

Looks good, thank you!