-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathActivityProfileDocumentSpec.php
More file actions
61 lines (53 loc) · 1.78 KB
/
ActivityProfileDocumentSpec.php
File metadata and controls
61 lines (53 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Xabbuh\XApi\Model;
use PhpSpec\ObjectBehavior;
use Xabbuh\XApi\Model\Activity;
use Xabbuh\XApi\Model\ActivityProfile;
use Xabbuh\XApi\Model\Document;
use Xabbuh\XApi\Model\DocumentData;
use Xabbuh\XApi\Model\IRI;
class ActivityProfileDocumentSpec extends ObjectBehavior
{
public function let()
{
$this->beConstructedWith(new ActivityProfile('id',
new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'))),
new DocumentData(array(
'x' => 'foo',
'y' => 'bar',
)
)
);
}
function it_is_a_document()
{
$this->shouldHaveType(Document::class);
}
function its_data_can_be_read()
{
//$this->offsetExists('x')->shouldReturn(true);
$this->shouldHaveKey('x');
$this->offsetGet('x')->shouldReturn('foo');
//$this->offsetExists('y')->shouldReturn(true);
$this->shouldHaveKey('y');
$this->offsetGet('y')->shouldReturn('bar');
//$this->offsetExists('z')->shouldReturn(false);
}
function it_throws_exception_when_not_existing_data_is_being_read()
{
$this->shouldThrow('\InvalidArgumentException')->duringOffsetGet('z');
}
function its_data_cannot_be_manipulated()
{
$this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetSet('z', 'baz');
$this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetUnset('x');
}
}