PendingBatchFake.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Illuminate\Support\Testing\Fakes;
  3. use Illuminate\Bus\PendingBatch;
  4. use Illuminate\Support\Collection;
  5. class PendingBatchFake extends PendingBatch
  6. {
  7. /**
  8. * The fake bus instance.
  9. *
  10. * @var \Illuminate\Support\Testing\Fakes\BusFake
  11. */
  12. protected $bus;
  13. /**
  14. * Create a new pending batch instance.
  15. *
  16. * @param \Illuminate\Support\Testing\Fakes\BusFake $bus
  17. * @param \Illuminate\Support\Collection $jobs
  18. * @return void
  19. */
  20. public function __construct(BusFake $bus, Collection $jobs)
  21. {
  22. $this->bus = $bus;
  23. $this->jobs = $jobs;
  24. }
  25. /**
  26. * Dispatch the batch.
  27. *
  28. * @return \Illuminate\Bus\Batch
  29. */
  30. public function dispatch()
  31. {
  32. return $this->bus->recordPendingBatch($this);
  33. }
  34. /**
  35. * Dispatch the batch after the response is sent to the browser.
  36. *
  37. * @return \Illuminate\Bus\Batch
  38. */
  39. public function dispatchAfterResponse()
  40. {
  41. return $this->bus->recordPendingBatch($this);
  42. }
  43. }