ImageSpec   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 8 1
A it_is_initializable() 0 5 1
A it_cannot_create_a_file_that_does_not_be_an_image() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Spec\Kreta\IdentityAccess\Domain\Model\User;
16
17
use BenGorFile\File\Domain\Model\File;
18
use BenGorFile\File\Domain\Model\FileId;
19
use BenGorFile\File\Domain\Model\FileMimeType;
20
use BenGorFile\File\Domain\Model\FileMimeTypeDoesNotSupportException;
21
use BenGorFile\File\Domain\Model\FileName;
22
use Kreta\IdentityAccess\Domain\Model\User\Image;
23
use PhpSpec\ObjectBehavior;
24
25
class ImageSpec extends ObjectBehavior
26
{
27
    function let()
28
    {
29
        $this->beConstructedWith(
30
            new FileId('image-id'),
31
            new FileName('image-name.png'),
32
            new FileMimeType('image/png')
33
        );
34
    }
35
36
    function it_is_initializable()
37
    {
38
        $this->shouldHaveType(Image::class);
39
        $this->shouldHaveType(File::class);
40
    }
41
42
    function it_cannot_create_a_file_that_does_not_be_an_image()
43
    {
44
        $this->beConstructedWith(
45
            new FileId('file-id'),
46
            new FileName('file.pdf'),
47
            new FileMimeType('application/pdf')
48
        );
49
50
        $this->shouldThrow(FileMimeTypeDoesNotSupportException::class)->duringInstantiation();
51
    }
52
}
53