Completed
Pull Request — master (#15)
by Christian
02:51
created

its_properties_are_empty_by_default()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
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
8
class ContextActivitiesSpec extends ObjectBehavior
9
{
10
    public function its_properties_are_empty_by_default()
11
    {
12
        $this->getParentActivity()->shouldBeNull();
13
        $this->getGroupingActivity()->shouldBeNull();
14
        $this->getCategoryActivity()->shouldBeNull();
15
        $this->getOtherActivity()->shouldBeNull();
16
    }
17
18
    public function it_returns_a_new_instance_with_parent_activity()
19
    {
20
        $activity = new Activity('http://tincanapi.com/conformancetest/activityid');
21
        $contextActivities = $this->withParentActivity($activity);
22
23
        $this->getParentActivity()->shouldBeNull();
24
25
        $contextActivities->shouldNotBe($this);
26
        $contextActivities->shouldBeAnInstanceOf('\Xabbuh\XApi\Model\ContextActivities');
27
        $contextActivities->getParentActivity()->shouldReturn($activity);
28
    }
29
30
    public function it_returns_a_new_instance_with_grouping_activity()
31
    {
32
        $activity = new Activity('http://tincanapi.com/conformancetest/activityid');
33
        $contextActivities = $this->withGroupingActivity($activity);
34
35
        $this->getGroupingActivity()->shouldBeNull();
36
37
        $contextActivities->shouldNotBe($this);
38
        $contextActivities->shouldBeAnInstanceOf('\Xabbuh\XApi\Model\ContextActivities');
39
        $contextActivities->getGroupingActivity()->shouldReturn($activity);
40
    }
41
42
    public function it_returns_a_new_instance_with_category_activity()
43
    {
44
        $activity = new Activity('http://tincanapi.com/conformancetest/activityid');
45
        $contextActivities = $this->withCategoryActivity($activity);
46
47
        $this->getCategoryActivity()->shouldBeNull();
48
49
        $contextActivities->shouldNotBe($this);
50
        $contextActivities->shouldBeAnInstanceOf('\Xabbuh\XApi\Model\ContextActivities');
51
        $contextActivities->getCategoryActivity()->shouldReturn($activity);
52
    }
53
54
    public function it_returns_a_new_instance_with_other_activity()
55
    {
56
        $activity = new Activity('http://tincanapi.com/conformancetest/activityid');
57
        $contextActivities = $this->withOtherActivity($activity);
58
59
        $this->getOtherActivity()->shouldBeNull();
60
61
        $contextActivities->shouldNotBe($this);
62
        $contextActivities->shouldBeAnInstanceOf('\Xabbuh\XApi\Model\ContextActivities');
63
        $contextActivities->getOtherActivity()->shouldReturn($activity);
64
    }
65
}
66