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

InverseFunctionalIdentifierSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 55
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_can_be_built_with_an_mbox() 0 12 1
A it_can_be_built_with_an_mbox_sha1_sum() 0 12 1
A it_can_be_built_with_an_openid() 0 12 1
A it_can_be_built_with_an_account() 0 13 1
1
<?php
2
3
namespace spec\Xabbuh\XApi\Model;
4
5
use PhpSpec\ObjectBehavior;
6
use Xabbuh\XApi\Model\Account;
7
8
class InverseFunctionalIdentifierSpec extends ObjectBehavior
9
{
10
    function it_can_be_built_with_an_mbox()
11
    {
12
        $this->beConstructedThrough(
13
            array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withMbox'),
14
            array('mailto:[email protected]')
15
        );
16
17
        $this->getMbox()->shouldReturn('mailto:[email protected]');
18
        $this->getMboxSha1Sum()->shouldReturn(null);
19
        $this->getOpenId()->shouldReturn(null);
20
        $this->getAccount()->shouldReturn(null);
21
    }
22
23
    function it_can_be_built_with_an_mbox_sha1_sum()
24
    {
25
        $this->beConstructedThrough(
26
            array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withMboxSha1Sum'),
27
            array('db77b9104b531ecbb0b967f6942549d0ba80fda1')
28
        );
29
30
        $this->getMbox()->shouldReturn(null);
31
        $this->getMboxSha1Sum()->shouldReturn('db77b9104b531ecbb0b967f6942549d0ba80fda1');
32
        $this->getOpenId()->shouldReturn(null);
33
        $this->getAccount()->shouldReturn(null);
34
    }
35
36
    function it_can_be_built_with_an_openid()
37
    {
38
        $this->beConstructedThrough(
39
            array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withOpenId'),
40
            array('http://openid.tincanapi.com')
41
        );
42
43
        $this->getMbox()->shouldReturn(null);
44
        $this->getMboxSha1Sum()->shouldReturn(null);
45
        $this->getOpenId()->shouldReturn('http://openid.tincanapi.com');
46
        $this->getAccount()->shouldReturn(null);
47
    }
48
49
    function it_can_be_built_with_an_account()
50
    {
51
        $account = new Account('test', 'https://tincanapi.com');
52
        $this->beConstructedThrough(
53
            array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withAccount'),
54
            array($account)
55
        );
56
57
        $this->getMbox()->shouldReturn(null);
58
        $this->getMboxSha1Sum()->shouldReturn(null);
59
        $this->getOpenId()->shouldReturn(null);
60
        $this->getAccount()->shouldReturn($account);
61
    }
62
}
63