Completed
Push — master ( 3247f7...ee125b )
by Christian
02:22
created

ScoreSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A its_properties_can_be_read() 0 9 1
A it_can_be_constructed_with_a_scaled_value_only() 0 9 1
A it_can_be_constructed_with_a_raw_value_only() 0 9 1
A it_can_be_constructed_with_a_min_value_only() 0 9 1
A it_can_be_constructed_with_a_max_value_only() 0 9 1
1
<?php
2
3
namespace spec\Xabbuh\XApi\Model;
4
5
use PhpSpec\ObjectBehavior;
6
7
class ScoreSpec extends ObjectBehavior
8
{
9
    function its_properties_can_be_read()
10
    {
11
        $this->beConstructedWith(1, 100, 0, 100);
12
13
        $this->getScaled()->shouldReturn(1);
14
        $this->getRaw()->shouldReturn(100);
15
        $this->getMin()->shouldReturn(0);
16
        $this->getMax()->shouldReturn(100);
17
    }
18
19
    function it_can_be_constructed_with_a_scaled_value_only()
20
    {
21
        $this->beConstructedWith(1);
22
23
        $this->getScaled()->shouldReturn(1);
24
        $this->getRaw()->shouldReturn(null);
25
        $this->getMin()->shouldReturn(null);
26
        $this->getMax()->shouldReturn(null);
27
    }
28
29
    function it_can_be_constructed_with_a_raw_value_only()
30
    {
31
        $this->beConstructedWith(null, 100);
32
33
        $this->getScaled()->shouldReturn(null);
34
        $this->getRaw()->shouldReturn(100);
35
        $this->getMin()->shouldReturn(null);
36
        $this->getMax()->shouldReturn(null);
37
    }
38
39
    function it_can_be_constructed_with_a_min_value_only()
40
    {
41
        $this->beConstructedWith(null, null, 0);
42
43
        $this->getScaled()->shouldReturn(null);
44
        $this->getRaw()->shouldReturn(null);
45
        $this->getMin()->shouldReturn(0);
46
        $this->getMax()->shouldReturn(null);
47
    }
48
49
    function it_can_be_constructed_with_a_max_value_only()
50
    {
51
        $this->beConstructedWith(null, null, null, 100);
52
53
        $this->getScaled()->shouldReturn(null);
54
        $this->getRaw()->shouldReturn(null);
55
        $this->getMin()->shouldReturn(null);
56
        $this->getMax()->shouldReturn(100);
57
    }
58
}
59