Completed
Branch master (3247f7)
by Christian
02:24
created

ActivityProfileDocumentSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace spec\Xabbuh\XApi\Model;
4
5
use PhpSpec\ObjectBehavior;
6
use Xabbuh\XApi\Model\Activity;
7
use Xabbuh\XApi\Model\ActivityProfile;
8
use Xabbuh\XApi\Model\DocumentData;
9
10
class ActivityProfileDocumentSpec extends ObjectBehavior
11
{
12
    function let()
13
    {
14
        $this->beConstructedWith(new ActivityProfile('id', new Activity('http://tincanapi.com/conformancetest/activityid')), new DocumentData(array(
15
            'x' => 'foo',
16
            'y' => 'bar',
17
        )));
18
    }
19
20
    function it_is_a_document()
21
    {
22
        $this->shouldHaveType('Xabbuh\XApi\Model\Document');
23
    }
24
25
    function its_data_can_be_read()
26
    {
27
        $this->offsetExists('x')->shouldReturn(true);
28
        $this->offsetGet('x')->shouldReturn('foo');
29
        $this->offsetExists('y')->shouldReturn(true);
30
        $this->offsetGet('y')->shouldReturn('bar');
31
        $this->offsetExists('z')->shouldReturn(false);
32
    }
33
34
    function its_data_cannot_be_manipulated()
35
    {
36
        $this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetSet('z', 'baz');
37
        $this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetUnset('x');
38
    }
39
}
40