Completed
Pull Request — 3.1 (#348)
by Piotr
07:35
created

BooleanSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_ignore_empty_values() 0 6 1
A it_decorate_value() 0 5 1
1
<?php
2
3
namespace spec\FSi\Bundle\AdminBundle\Display\Property\Formatter;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
8
class BooleanSpec extends ObjectBehavior
9
{
10
    function let()
11
    {
12
        $this->beConstructedWith('yes', 'no');
13
    }
14
15
    function it_ignore_empty_values()
16
    {
17
        $this->format(0)->shouldReturn(0);
18
        $this->format(null)->shouldReturn(null);
19
        $this->format([])->shouldReturn([]);
20
    }
21
22
    function it_decorate_value()
23
    {
24
        $this->format(true)->shouldReturn('yes');
25
        $this->format(false)->shouldReturn('no');
26
    }
27
}
28