1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace spec\Odiseo\SyliusReportPlugin\Form\Type\DataFetcher; |
4
|
|
|
|
5
|
|
|
use Odiseo\SyliusReportPlugin\Form\Builder\QueryFilterFormBuilder; |
6
|
|
|
use Odiseo\SyliusReportPlugin\Form\Type\DataFetcher\NumberOfOrdersType; |
7
|
|
|
use PhpSpec\ObjectBehavior; |
8
|
|
|
use Prophecy\Argument; |
9
|
|
|
use Symfony\Component\Form\AbstractType; |
10
|
|
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
11
|
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
12
|
|
|
use Symfony\Component\Form\Extension\Core\Type\DateType; |
13
|
|
|
use Symfony\Component\Form\FormBuilder; |
14
|
|
|
|
15
|
|
|
class NumberOfOrdersTypeSpec extends ObjectBehavior |
16
|
|
|
{ |
17
|
|
|
function let(QueryFilterFormBuilder $queryFilterFormBuilder) |
|
|
|
|
18
|
|
|
{ |
19
|
|
|
$this->beConstructedWith($queryFilterFormBuilder); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
function it_is_initializable() |
|
|
|
|
23
|
|
|
{ |
24
|
|
|
$this->shouldHaveType(NumberOfOrdersType::class); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
function it_should_be_abstract_type_object() |
28
|
|
|
{ |
29
|
|
|
$this->shouldHaveType(AbstractType::class); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
function it_has_block_prefix() |
33
|
|
|
{ |
34
|
|
|
$this->getBlockPrefix()->shouldReturn('odiseo_sylius_report_data_fetcher_number_of_orders'); |
|
|
|
|
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
function it_builds_the_form(FormBuilder $builder) |
38
|
|
|
{ |
39
|
|
|
$builder->add('start', DateType::class, Argument::any())->willReturn($builder); |
|
|
|
|
40
|
|
|
$builder->add('end', DateType::class, Argument::any())->willReturn($builder); |
41
|
|
|
$builder->add('period', ChoiceType::class, Argument::any())->willReturn($builder); |
42
|
|
|
$builder->add('empty_records', CheckboxType::class, Argument::any())->willReturn($builder); |
43
|
|
|
|
44
|
|
|
$this->buildForm($builder, []); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.