Completed
Push — master ( 6f962e...549eec )
by Kamil
21:17
created

it_uses_callback_to_build_form()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 10
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 5
nc 1
nop 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\SettingsBundle\Schema;
13
14
use PhpSpec\ObjectBehavior;
15
use Prophecy\Argument;
16
use Sylius\Bundle\SettingsBundle\Schema\CallbackSchema;
17
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
18
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
19
use Symfony\Component\Form\FormBuilderInterface;
20
21
/**
22
 * @mixin CallbackSchema
23
 *
24
 * @author Kamil Kokot <[email protected]>
25
 */
26
final class CallbackSchemaSpec extends ObjectBehavior
27
{
28
    function let()
29
    {
30
        $this->beConstructedWith(function (){}, function (){});
31
    }
32
33
    function it_is_initializable()
34
    {
35
        $this->shouldHaveType('Sylius\Bundle\SettingsBundle\Schema\CallbackSchema');
36
    }
37
38
    function it_implements_schema_interface()
39
    {
40
        $this->shouldImplement(SchemaInterface::class);
41
    }
42
43
    function it_uses_callback_to_build_settings(SettingsBuilderInterface $settingsBuilder)
44
    {
45
        $this->beConstructedWith(function (SettingsBuilderInterface $settingsBuilder) {
46
            $settingsBuilder->setDefaults(['foo' => 'bar']);
47
        }, function (){});
48
49
        $settingsBuilder->setDefaults(['foo' => 'bar'])->shouldBeCalled();
50
51
        $this->buildSettings($settingsBuilder);
52
    }
53
54
    function it_uses_callback_to_build_form(FormBuilderInterface $formBuilder)
55
    {
56
        $this->beConstructedWith(function (){}, function (FormBuilderInterface $formBuilder) {
57
            $formBuilder->add('bono', 'u2');
58
        });
59
60
        $formBuilder->add('bono', 'u2')->shouldBeCalled();
61
62
        $this->buildForm($formBuilder);
63
    }
64
}
65