2013-07-20 8 views
12
$client = Mockery::mock(); 
$client->shouldReceive('send')->andThrow($error)->andReturn(true); 

दुर्भाग्यवश यह केवल सत्य लौटाता है लेकिन पहले अपवाद फेंक नहीं देता है। मैं पहली कॉल पर अपवाद कैसे फेंक सकता हूं फिर विधि के दूसरे कॉल पर मूल्य वापस कर सकता हूं?पहले मॉकरी फेंक दें तो दूसरी कॉल

संपादित:

यह काम करता है अगर मैं मैन्युअल Mockery\Expectation.php को संपादित करने और $_throw = true निर्धारित किया है।

$client->shouldReceive('send')->twice()->andReturn($error, true); 

उत्तर

21
$client->shouldReceive('send')->once()->andThrow($error); 
$client->shouldReceive('send')->once()->andReturn(true); 
संबंधित मुद्दे