Completed
Push — master ( 4c7b9c...e919dc )
by Kamil
21:11
created

SuiteLoaderSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 34
rs 10
c 4
b 0
f 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_implements_suite_loader_interface() 0 4 1
A it_loads_suite_fixtures() 0 16 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
namespace spec\Sylius\Bundle\FixturesBundle\Loader;
13
14
use PhpSpec\ObjectBehavior;
15
use Prophecy\Argument;
16
use Sylius\Bundle\FixturesBundle\Fixture\FixtureInterface;
17
use Sylius\Bundle\FixturesBundle\Loader\FixtureLoaderInterface;
18
use Sylius\Bundle\FixturesBundle\Loader\SuiteLoader;
19
use Sylius\Bundle\FixturesBundle\Loader\SuiteLoaderInterface;
20
use Sylius\Bundle\FixturesBundle\Suite\SuiteInterface;
21
22
/**
23
 * @mixin SuiteLoader
24
 *
25
 * @author Kamil Kokot <[email protected]>
26
 */
27
final class SuiteLoaderSpec extends ObjectBehavior
28
{
29
    function let(FixtureLoaderInterface $fixtureLoader)
30
    {
31
        $this->beConstructedWith($fixtureLoader);
32
    }
33
34
    function it_is_initializable()
35
    {
36
        $this->shouldHaveType('Sylius\Bundle\FixturesBundle\Loader\SuiteLoader');
37
    }
38
39
    function it_implements_suite_loader_interface()
40
    {
41
        $this->shouldImplement(SuiteLoaderInterface::class);
42
    }
43
44
    function it_loads_suite_fixtures(
45
        FixtureLoaderInterface $fixtureLoader,
46
        SuiteInterface $suite,
47
        FixtureInterface $firstFixture,
48
        FixtureInterface $secondFixture
49
    ) {
50
        $suite->getFixtures()->will(function () use ($firstFixture, $secondFixture) {
51
            yield $firstFixture->getWrappedObject() => ['options 1'];
52
            yield $secondFixture->getWrappedObject() => ['options 2'];
53
        });
54
55
        $fixtureLoader->load($suite, $firstFixture, ['options 1'])->shouldBeCalled();
56
        $fixtureLoader->load($suite, $secondFixture, ['options 2'])->shouldBeCalled();
57
58
        $this->load($suite);
59
    }
60
}
61