|
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
|
|
|
|