/** @test */ public function andReturnUsing_shouldReturnACallbacksValue() { $spy = new Spy(); $spy->andReturnUsing(function ($arg) { return strtoupper($arg); }); $this->assertEquals('FOO', $spy('foo')); }
public static function returnsUsing(callable $cb) { $spy = new Spy(); $spy->andReturnUsing($cb); return $spy; }