Completed
Pull Request — master (#3)
by Christian
03:16
created

ActivityProfileDocumentSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 25
ccs 0
cts 20
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 7 1
A its_data_can_be_read() 0 8 1
A its_data_cannot_be_manipulated() 0 5 1
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 its_data_can_be_read()
21
    {
22
        $this->offsetExists('x')->shouldReturn(true);
23
        $this->offsetGet('x')->shouldReturn('foo');
24
        $this->offsetExists('y')->shouldReturn(true);
25
        $this->offsetGet('y')->shouldReturn('bar');
26
        $this->offsetExists('z')->shouldReturn(false);
27
    }
28
29
    function its_data_cannot_be_manipulated()
30
    {
31
        $this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetSet('z', 'baz');
32
        $this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetUnset('x');
33
    }
34
}
35