andReturnUsing() public method

Set a closure or sequence of closures with which to generate return values. The arguments passed to the expected method are passed to the closures as parameters.
public andReturnUsing ( ) : self
return self
Exemplo n.º 1
0
 /**
  * WordPress testing function used to avoid return expectations on action hooks.
  * Throws exception for WordPress filters and generic PHP function testing.
  *
  * @param  callable             $callback
  * @return \Mockery\Expectation
  */
 public function whenHappen(callable $callback)
 {
     if (!$this->isAddedHook && !$this->isAction) {
         throw new RuntimeException('whenHappen() can only be used for WordPress actions or added filters expectations.');
     }
     return $this->expectation->andReturnUsing($callback);
 }
Exemplo n.º 2
0
 /**
  * @expectedException \Link0\Phpebble\Api\ServiceUnavailable
  * @expectedExceptionMessage Service unavailable
  */
 public function test_service_unavailable()
 {
     $this->sendMethod->andReturnUsing($this->createClientException(503));
     $this->performPush();
 }