Skip to content

Commit

Permalink
Merge pull request #162 from loic425/features/improve-infection
Browse files Browse the repository at this point in the history
improve infection
  • Loading branch information
loic425 committed Mar 20, 2019
2 parents 877e5ce + 2b003ed commit 7f41115
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
5 changes: 4 additions & 1 deletion infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
"Behat",
"Command",
"DependencyInjection",
"Formatter",
"Menu",
"Migrations",
"Fixture",
"Form/Type"
"Form/Type",
"Kernel.php"
]
},
"logs": {
Expand Down
30 changes: 30 additions & 0 deletions spec/App/Form/Extension/CustomerTypeExtensionSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace spec\App\Form\Extension;

use App\Form\EventSubscriber\AddUserFormSubscriber;
use App\Form\Type\User\AppUserType;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\CustomerBundle\Form\Type\CustomerType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;

class CustomerTypeExtensionSpec extends ObjectBehavior
{
function it_extends_an_abstract_type_extension()
{
$this->shouldHaveType(AbstractTypeExtension::class);
}

function it_extends_customer_type()
{
$this::getExtendedTypes()->shouldReturn([CustomerType::class]);
}

function it_adds_user_form_subscriber(FormBuilderInterface $builder)
{
$builder->addEventSubscriber(new AddUserFormSubscriber(AppUserType::class))->shouldBeCalled();

$this->buildForm($builder, []);
}
}
29 changes: 29 additions & 0 deletions spec/App/Form/Extension/DateTypeExtensionSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace spec\App\Form\Extension;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DateTypeExtensionSpec extends ObjectBehavior
{
function it_extends_an_abstract_type_extension()
{
$this->shouldHaveType(AbstractTypeExtension::class);
}

function it_extends_date_type()
{
$this::getExtendedTypes()->shouldReturn([DateType::class]);
}

function it_configures_options(OptionsResolver $resolver)
{
$resolver->setDefaults(Argument::type('array'))->shouldBeCalled();

$this->configureOptions($resolver);
}
}

0 comments on commit 7f41115

Please sign in to comment.