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