Completed
Push — 1.0 ( 92e65c...08f62c )
by Kamil
27:49
created

it_implements_suite_loader_interface()   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
cc 1
eloc 2
nc 1
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
declare(strict_types=1);
13
14
namespace spec\Sylius\Bundle\FixturesBundle\Loader;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Bundle\FixturesBundle\Fixture\FixtureInterface;
18
use Sylius\Bundle\FixturesBundle\Loader\FixtureLoaderInterface;
19
use Sylius\Bundle\FixturesBundle\Loader\SuiteLoaderInterface;
20
use Sylius\Bundle\FixturesBundle\Suite\SuiteInterface;
21
22
final class SuiteLoaderSpec extends ObjectBehavior
23
{
24
    function let(FixtureLoaderInterface $fixtureLoader): void
25
    {
26
        $this->beConstructedWith($fixtureLoader);
27
    }
28
29
    function it_implements_suite_loader_interface(): void
30
    {
31
        $this->shouldImplement(SuiteLoaderInterface::class);
32
    }
33
34
    function it_loads_suite_fixtures(
35
        FixtureLoaderInterface $fixtureLoader,
36
        SuiteInterface $suite,
37
        FixtureInterface $firstFixture,
38
        FixtureInterface $secondFixture
39
    ): void {
40
        $suite->getFixtures()->will(function () use ($firstFixture, $secondFixture) {
41
            yield $firstFixture->getWrappedObject() => ['options 1'];
42
            yield $secondFixture->getWrappedObject() => ['options 2'];
43
        });
44
45
        $fixtureLoader->load($suite, $firstFixture, ['options 1'])->shouldBeCalled();
46
        $fixtureLoader->load($suite, $secondFixture, ['options 2'])->shouldBeCalled();
47
48
        $this->load($suite);
49
    }
50
}
51