|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace spec\Xabbuh\XApi\Model\Interaction; |
|
4
|
|
|
|
|
5
|
|
|
use Xabbuh\XApi\Model\Interaction\InteractionComponent; |
|
6
|
|
|
use Xabbuh\XApi\Model\Interaction\SequencingInteractionDefinition; |
|
7
|
|
|
|
|
8
|
|
|
class SequencingInteractionDefinitionSpec extends InteractionDefinitionSpec |
|
9
|
|
|
{ |
|
10
|
|
|
function it_is_not_equal_if_only_other_interaction_has_choices() |
|
11
|
|
|
{ |
|
12
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
13
|
|
|
$interaction = $interaction->withChoices(array(new InteractionComponent('test'))); |
|
14
|
|
|
|
|
15
|
|
|
$this->equals($interaction)->shouldReturn(false); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
function it_is_not_equal_if_only_this_interaction_has_choices() |
|
19
|
|
|
{ |
|
20
|
|
|
$this->beConstructedWith(null, null, null, null, null, array(new InteractionComponent('test'))); |
|
21
|
|
|
|
|
22
|
|
|
$this->equals($this->createEmptyInteraction())->shouldReturn(false); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
function it_is_not_equal_if_number_of_choices_differs() |
|
26
|
|
|
{ |
|
27
|
|
|
$this->beConstructedWith(null, null, null, null, null, array(new InteractionComponent('test'))); |
|
28
|
|
|
|
|
29
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
30
|
|
|
$interaction = $interaction->withChoices(array(new InteractionComponent('test'), new InteractionComponent('foo'))); |
|
31
|
|
|
|
|
32
|
|
|
$this->equals($interaction)->shouldReturn(false); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
function it_is_not_equal_if_choices_differ() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->beConstructedWith(null, null, null, null, null, array(new InteractionComponent('foo'))); |
|
38
|
|
|
|
|
39
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
40
|
|
|
$interaction = $interaction->withChoices(array(new InteractionComponent('bar'))); |
|
41
|
|
|
|
|
42
|
|
|
$this->equals($interaction)->shouldReturn(false); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function it_is_equal_if_choices_are_equal() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->beConstructedWith(null, null, null, null, null, array(new InteractionComponent('test'))); |
|
48
|
|
|
|
|
49
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
50
|
|
|
$interaction = $interaction->withChoices(array(new InteractionComponent('test'))); |
|
51
|
|
|
|
|
52
|
|
|
$this->equals($interaction)->shouldReturn(true); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
protected function createEmptyInteraction() |
|
56
|
|
|
{ |
|
57
|
|
|
return new SequencingInteractionDefinition(); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|