PendingBatchFake.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. */
  19. public function __construct(BusFake $bus, Collection $jobs)
  20. {
  21. $this->bus = $bus;
  22. $this->jobs = $jobs;
  23. }
  24. /**
  25. * Dispatch the batch.
  26. *
  27. * @return \Illuminate\Bus\Batch
  28. */
  29. public function dispatch()
  30. {
  31. return $this->bus->recordPendingBatch($this);
  32. }
  33. /**
  34. * Dispatch the batch after the response is sent to the browser.
  35. *
  36. * @return \Illuminate\Bus\Batch
  37. */
  38. public function dispatchAfterResponse()
  39. {
  40. return $this->bus->recordPendingBatch($this);
  41. }
  42. }