ResultSpec.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace spec\Ddeboer\DataImport;
  3. use PhpSpec\ObjectBehavior;
  4. use Prophecy\Argument;
  5. class ResultSpec extends ObjectBehavior
  6. {
  7. function let(\DateTime $startTime, \DateTime $endTime, \SplObjectStorage $exceptions, \DateInterval $elapsed)
  8. {
  9. $startTime->diff($endTime)->willReturn($elapsed);
  10. $exceptions->count()->willReturn(4);
  11. $this->beConstructedWith('name', $startTime, $endTime, 10, $exceptions);
  12. }
  13. function it_is_initializable()
  14. {
  15. $this->shouldHaveType('Ddeboer\DataImport\Result');
  16. }
  17. function it_has_a_name()
  18. {
  19. $this->getName()->shouldReturn('name');
  20. }
  21. function it_has_a_start_time(\DateTime $startTime)
  22. {
  23. $this->getStartTime()->shouldReturn($startTime);
  24. }
  25. function it_has_a_end_time(\DateTime $endTime)
  26. {
  27. $this->getEndTime()->shouldReturn($endTime);
  28. }
  29. function it_has_an_elapsed_time(\DateInterval $elapsed)
  30. {
  31. $this->getElapsed()->shouldReturn($elapsed);
  32. }
  33. function it_has_an_error_count()
  34. {
  35. $this->getErrorCount()->shouldReturn(4);
  36. }
  37. function it_has_a_success_count()
  38. {
  39. $this->getSuccessCount()->shouldReturn(6);
  40. }
  41. function it_has_a_total_processed_count()
  42. {
  43. $this->getTotalProcessedCount()->shouldReturn(10);
  44. }
  45. function it_checks_if_it_has_errors()
  46. {
  47. $this->hasErrors()->shouldReturn(true);
  48. }
  49. function it_has_exceptions(\SplObjectStorage $exceptions)
  50. {
  51. $this->getExceptions()->shouldReturn($exceptions);
  52. }
  53. }