|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace spec\Xabbuh\XApi\Model\Interaction; |
|
4
|
|
|
|
|
5
|
|
|
use PhpSpec\ObjectBehavior; |
|
6
|
|
|
use Xabbuh\XApi\Model\Interaction\Interaction; |
|
7
|
|
|
|
|
8
|
|
|
abstract class InteractionSpec extends ObjectBehavior |
|
9
|
|
|
{ |
|
10
|
|
|
function it_is_a_definition() |
|
11
|
|
|
{ |
|
12
|
|
|
$this->shouldHaveType('Xabbuh\XApi\Model\Definition'); |
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
function it_is_an_interaction() |
|
16
|
|
|
{ |
|
17
|
|
|
$this->shouldHaveType('Xabbuh\XApi\Model\Interaction\Interaction'); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
function it_is_not_equal_if_only_other_interaction_has_correct_responses_pattern() |
|
21
|
|
|
{ |
|
22
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
23
|
|
|
$interaction = $interaction->withCorrectResponsesPattern(array('test')); |
|
24
|
|
|
|
|
25
|
|
|
$this->equals($interaction)->shouldReturn(false); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
function it_is_not_equal_if_only_this_interaction_has_correct_responses_pattern() |
|
29
|
|
|
{ |
|
30
|
|
|
$this->beConstructedWith(null, null, null, null, array('test')); |
|
31
|
|
|
|
|
32
|
|
|
$this->equals($this->createEmptyInteraction())->shouldReturn(false); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
function it_is_not_equal_if_number_of_correct_responses_pattern_differs() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->beConstructedWith(null, null, null, null, array('test')); |
|
38
|
|
|
|
|
39
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
40
|
|
|
$interaction = $interaction->withCorrectResponsesPattern(array('test', 'foo')); |
|
41
|
|
|
|
|
42
|
|
|
$this->equals($interaction)->shouldReturn(false); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function it_is_not_equal_if_correct_responses_pattern_values_differ() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->beConstructedWith(null, null, null, null, array('foo')); |
|
48
|
|
|
|
|
49
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
50
|
|
|
$interaction = $interaction->withCorrectResponsesPattern(array('bar')); |
|
51
|
|
|
|
|
52
|
|
|
$this->equals($interaction)->shouldReturn(false); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
function it_is_equal_if_correct_responses_pattern_values_are_equal() |
|
56
|
|
|
{ |
|
57
|
|
|
$this->beConstructedWith(null, null, null, null, array('test')); |
|
58
|
|
|
|
|
59
|
|
|
$interaction = $this->createEmptyInteraction(); |
|
60
|
|
|
$interaction = $interaction->withCorrectResponsesPattern(array('test')); |
|
61
|
|
|
|
|
62
|
|
|
$this->equals($interaction)->shouldReturn(true); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return Interaction |
|
67
|
|
|
*/ |
|
68
|
|
|
abstract protected function createEmptyInteraction(); |
|
69
|
|
|
} |
|
70
|
|
|
|