1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the xAPI package. |
5
|
|
|
* |
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace spec\Xabbuh\XApi\Model; |
13
|
|
|
|
14
|
|
|
use PhpSpec\ObjectBehavior; |
15
|
|
|
use Xabbuh\XApi\Model\LanguageMap; |
16
|
|
|
use Xabbuh\XApi\Model\Verb; |
17
|
|
|
|
18
|
|
|
class VerbSpec extends ObjectBehavior |
19
|
|
|
{ |
20
|
|
|
function it_detects_voiding_verbs() |
21
|
|
|
{ |
22
|
|
|
$this->beConstructedWith('http://adlnet.gov/expapi/verbs/voided'); |
23
|
|
|
$this->isVoidVerb()->shouldReturn(true); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
function its_properties_can_be_read() |
27
|
|
|
{ |
28
|
|
|
$languageMap = LanguageMap::create(array('en-US' => 'test')); |
29
|
|
|
$this->beConstructedWith('http://tincanapi.com/conformancetest/verbid', $languageMap); |
30
|
|
|
|
31
|
|
|
$this->getId()->shouldReturn('http://tincanapi.com/conformancetest/verbid'); |
32
|
|
|
$this->getDisplay()->shouldReturn($languageMap); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
function its_display_property_is_null_if_omitted() |
36
|
|
|
{ |
37
|
|
|
$this->beConstructedWith('http://tincanapi.com/conformancetest/verbid'); |
38
|
|
|
|
39
|
|
|
$this->getId()->shouldReturn('http://tincanapi.com/conformancetest/verbid'); |
40
|
|
|
$this->getDisplay()->shouldReturn(null); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
function it_creates_voiding_verb_through_factory_method() |
44
|
|
|
{ |
45
|
|
|
$this->beConstructedThrough(array('Xabbuh\XApi\Model\Verb', 'createVoidVerb')); |
46
|
|
|
|
47
|
|
|
$this->shouldHaveType('Xabbuh\XApi\Model\Verb'); |
48
|
|
|
$this->getId()->shouldReturn('http://adlnet.gov/expapi/verbs/voided'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
function it_is_different_when_displays_are_omitted_and_other_verb_contains_an_empty_list_of_displays() |
52
|
|
|
{ |
53
|
|
|
$this->beConstructedWith('http://tincanapi.com/conformancetest/verbid'); |
54
|
|
|
|
55
|
|
|
$this->equals(new Verb('http://tincanapi.com/conformancetest/verbid', new LanguageMap()))->shouldReturn(false); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
function it_is_equal_when_verb_id_is_equal_and_display_values_are_omitted() |
59
|
|
|
{ |
60
|
|
|
$this->beConstructedWith('http://tincanapi.com/conformancetest/verbid'); |
61
|
|
|
|
62
|
|
|
$this->equals(new Verb('http://tincanapi.com/conformancetest/verbid'))->shouldReturn(true); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|