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

AgentProfileDocumentSpec::it_is_a_document()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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