title: How to send an array of test-cases to PHPUnit willReturnOnConsecutiveCalls
body: <p>I am trying to send a pre-calculated array of test cases into a mock to be returned on consecutive calls - similar to the map function. However it takes a list of arguments, not an array.</p>
  
  <p>My array is already generated by a fixture-generator and may be of variable length. </p>
  
  <p>What I want to do is something like this, but of course this causes it to return the entire array on the first call.</p>
  
  <pre><code>// In a test case:
  $processorMock
      -&gt;method('process')
      -&gt;willReturnOnConsecutiveCalls(
          $fixtureLoader-&gt;getProcessorScenarios() // how to explode this?
      );
  
  // class FixtureLoader pseudocode:
  function getProcessorScenarios(){
      return [ 
         [ $param1, $param2, $param3 ], // case 1
         [ $param1, $param2, $param3 ], // case 2
         ...
         [ $param1, $param2, $param3 ], // case N
      ];
  }
  </code></pre>
  
  <p>I want to destructure the returned array from the fixture loader, using list() or some var-args exploding language construct like "..." in other languages, but couldn't find anything native that worked.</p>
  
  <p>I do have what feels like a hacky method, which I will post as an initial answer Q&amp;A style.  I want to know if it's the best method.</p>