Completed
Push — reproduce-taxon-autocompletion ( 8c649e )
by Kamil
22:05
created

ThemeScreenshotFactorySpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
nop 0
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
namespace spec\Sylius\Bundle\ThemeBundle\Factory;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Bundle\ThemeBundle\Factory\ThemeScreenshotFactory;
16
use Sylius\Bundle\ThemeBundle\Factory\ThemeScreenshotFactoryInterface;
17
use Sylius\Bundle\ThemeBundle\Model\ThemeScreenshot;
18
19
/**
20
 * @author Kamil Kokot <[email protected]>
21
 */
22
final class ThemeScreenshotFactorySpec extends ObjectBehavior
23
{
24
    function it_is_initializable()
25
    {
26
        $this->shouldHaveType(ThemeScreenshotFactory::class);
27
    }
28
29
    function it_implements_theme_screenshot_factory_interface()
30
    {
31
        $this->shouldImplement(ThemeScreenshotFactoryInterface::class);
32
    }
33
34
    function it_creates_a_screenshot_from_an_array()
35
    {
36
        $this
37
            ->createFromArray(['path' => '/screenshot/path.jpg', 'title' => 'Steamboat', 'description' => 'With steamboat into a wonderful cruise'])
38
            ->shouldBeScreenshotWithTheFollowingProperties(['path' => '/screenshot/path.jpg', 'title' => 'Steamboat', 'description' => 'With steamboat into a wonderful cruise'])
39
        ;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getMatchers()
46
    {
47
        return [
48
            'beScreenshotWithTheFollowingProperties' => function (ThemeScreenshot $subject, array $properties) {
49
                if (isset($properties['path']) && $subject->getPath() !== $properties['path']) {
50
                    return false;
51
                }
52
53
                if (isset($properties['title']) && $subject->getTitle() !== $properties['title']) {
54
                    return false;
55
                }
56
57
                if (isset($properties['description']) && $subject->getDescription() !== $properties['description']) {
0 ignored issues
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return !(isset($properti...erties['description']);.
Loading history...
58
                    return false;
59
                }
60
61
                return true;
62
            },
63
        ];
64
    }
65
}
66