Completed
Push — master ( ec5411...629401 )
by Kamil
31:49 queued 16:57
created

AvatarImageSpec   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 1
dl 0
loc 55
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A it_extends_an_image() 0 4 1
A it_does_not_have_id_by_default() 0 4 1
A it_does_not_have_file_by_default() 0 5 1
A its_file_is_mutable() 0 6 1
A its_path_is_mutable() 0 5 1
A it_does_not_have_type_by_default() 0 4 1
A its_type_is_mutable() 0 5 1
A it_does_not_have_owner_by_default() 0 4 1
A its_owner_is_mutable() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Core\Model;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Core\Model\Image;
18
19
final class AvatarImageSpec extends ObjectBehavior
20
{
21
    function it_extends_an_image(): void
22
    {
23
        $this->shouldHaveType(Image::class);
24
    }
25
26
    function it_does_not_have_id_by_default(): void
27
    {
28
        $this->getId()->shouldReturn(null);
29
    }
30
31
    function it_does_not_have_file_by_default(): void
32
    {
33
        $this->hasFile()->shouldReturn(false);
34
        $this->getFile()->shouldReturn(null);
35
    }
36
37
    function its_file_is_mutable(): void
38
    {
39
        $file = new \SplFileInfo(__FILE__);
40
        $this->setFile($file);
41
        $this->getFile()->shouldReturn($file);
42
    }
43
44
    function its_path_is_mutable(): void
45
    {
46
        $this->setPath(__FILE__);
47
        $this->getPath()->shouldReturn(__FILE__);
48
    }
49
50
    function it_does_not_have_type_by_default(): void
51
    {
52
        $this->getType()->shouldReturn(null);
53
    }
54
55
    function its_type_is_mutable(): void
56
    {
57
        $this->setType('banner');
58
        $this->getType()->shouldReturn('banner');
59
    }
60
61
    function it_does_not_have_owner_by_default(): void
62
    {
63
        $this->getOwner()->shouldReturn(null);
64
    }
65
66
    function its_owner_is_mutable(): void
67
    {
68
        $owner = new \stdClass();
69
70
        $this->setOwner($owner);
71
        $this->getOwner()->shouldReturn($owner);
72
    }
73
}
74