|
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\Definition; |
|
16
|
|
|
use Xabbuh\XApi\Model\LanguageMap; |
|
17
|
|
|
|
|
18
|
|
|
class DefinitionSpec extends ObjectBehavior |
|
19
|
|
|
{ |
|
20
|
|
|
function its_properties_can_be_read() |
|
21
|
|
|
{ |
|
22
|
|
|
$name = LanguageMap::create(array('en-US' => 'test')); |
|
23
|
|
|
$description = LanguageMap::create(array('en-US' => 'test')); |
|
24
|
|
|
$this->beConstructedWith( |
|
25
|
|
|
$name, |
|
26
|
|
|
$description, |
|
27
|
|
|
'http://id.tincanapi.com/activitytype/unit-test', |
|
28
|
|
|
'https://github.com/adlnet/xAPI_LRS_Test' |
|
29
|
|
|
); |
|
30
|
|
|
|
|
31
|
|
|
$this->getName()->shouldReturn($name); |
|
32
|
|
|
$this->getDescription()->shouldReturn($description); |
|
33
|
|
|
$this->getType()->shouldReturn('http://id.tincanapi.com/activitytype/unit-test'); |
|
34
|
|
|
$this->getMoreInfo()->shouldReturn('https://github.com/adlnet/xAPI_LRS_Test'); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
function it_can_be_empty() |
|
38
|
|
|
{ |
|
39
|
|
|
$this->getName()->shouldReturn(null); |
|
40
|
|
|
$this->getDescription()->shouldReturn(null); |
|
41
|
|
|
$this->getType()->shouldReturn(null); |
|
42
|
|
|
$this->getMoreInfo()->shouldReturn(null); |
|
43
|
|
|
|
|
44
|
|
|
$this->equals(new Definition())->shouldReturn(true); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
function it_is_different_when_names_are_omitted_and_other_definition_contains_an_empty_list_of_names() |
|
48
|
|
|
{ |
|
49
|
|
|
$this->equals(new Definition(new LanguageMap()))->shouldReturn(false); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
function it_is_different_when_descriptions_are_omitted_and_other_definition_contains_an_empty_list_of_descriptions() |
|
53
|
|
|
{ |
|
54
|
|
|
$this->equals(new Definition(null, new LanguageMap()))->shouldReturn(false); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|