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
|
|
|
|