Merge pull request #3736 from bendavies/class-constant

replace FQCNs with class constants
This commit is contained in:
Paweł Jędrzejewski 2015-12-21 09:30:51 +01:00
commit 0b5866d277
554 changed files with 1530 additions and 924 deletions

View file

@ -13,6 +13,11 @@ namespace Sylius\Bundle\AddressingBundle;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Addressing\Model\AddressInterface;
use Sylius\Component\Addressing\Model\CountryInterface;
use Sylius\Component\Addressing\Model\ProvinceInterface;
use Sylius\Component\Addressing\Model\ZoneInterface;
use Sylius\Component\Addressing\Model\ZoneMemberInterface;
/**
* Sylius addressing and zones management bundle.
@ -38,11 +43,11 @@ class SyliusAddressingBundle extends AbstractResourceBundle
protected function getModelInterfaces()
{
return array(
'Sylius\Component\Addressing\Model\AddressInterface' => 'sylius.model.address.class',
'Sylius\Component\Addressing\Model\CountryInterface' => 'sylius.model.country.class',
'Sylius\Component\Addressing\Model\ProvinceInterface' => 'sylius.model.province.class',
'Sylius\Component\Addressing\Model\ZoneInterface' => 'sylius.model.zone.class',
'Sylius\Component\Addressing\Model\ZoneMemberInterface' => 'sylius.model.zone_member.class',
AddressInterface::class => 'sylius.model.address.class',
CountryInterface::class => 'sylius.model.country.class',
ProvinceInterface::class => 'sylius.model.province.class',
ZoneInterface::class => 'sylius.model.zone.class',
ZoneMemberInterface::class => 'sylius.model.zone_member.class',
);
}

View file

@ -17,6 +17,7 @@ use Prophecy\Argument;
use Sylius\Component\Addressing\Model\AddressInterface;
use Sylius\Component\Addressing\Model\CountryInterface;
use Sylius\Component\Addressing\Model\ProvinceInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormFactoryInterface;
@ -39,7 +40,7 @@ class BuildAddressFormSubscriberSpec extends ObjectBehavior
function it_is_a_subscriber()
{
$this->shouldImplement('Symfony\Component\EventDispatcher\EventSubscriberInterface');
$this->shouldImplement(EventSubscriberInterface::class);
}
function it_subsribesto_event()

View file

@ -13,6 +13,7 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\EventListener;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
use Symfony\Component\Form\FormConfigInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
@ -44,6 +45,6 @@ class ResizeZoneMemberCollectionListenerSpec extends ObjectBehavior
function it_is_resize_form_listener()
{
$this->shouldHaveType('Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener');
$this->shouldHaveType(ResizeFormListener::class);
}
}

View file

@ -15,6 +15,7 @@ use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
/**
* @author Julien Janvier <j.janvier@gmail.com>
@ -33,7 +34,7 @@ class AddressTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_has_a_valid_name()
@ -43,7 +44,7 @@ class AddressTypeSpec extends ObjectBehavior
function it_builds_form_with_proper_fields(FormBuilder $builder)
{
$builder->addEventSubscriber(Argument::type('Symfony\Component\EventDispatcher\EventSubscriberInterface'))
$builder->addEventSubscriber(Argument::type(EventSubscriberInterface::class))
->shouldBeCalled()
->willReturn($builder);

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -34,7 +35,7 @@ class CountryTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_has_a_valid_name()

View file

@ -13,6 +13,7 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\FormTypeInterface;
/**
* @author Julien Janvier <j.janvier@gmail.com>
@ -31,7 +32,7 @@ class ProvinceChoiceTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_has_a_valid_name()

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,7 +34,7 @@ class ProvinceTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_has_a_valid_name()

View file

@ -13,6 +13,7 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -27,7 +28,7 @@ class ZoneMemberCollectionTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_has_a_valid_name()

View file

@ -13,7 +13,9 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\AddressingBundle\Form\Type\ZoneMemberType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,12 +35,12 @@ class ZoneMemberCountryTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_is_a_Sylius_zone_member_type()
{
$this->shouldHaveType('Sylius\Bundle\AddressingBundle\Form\Type\ZoneMemberType');
$this->shouldHaveType(ZoneMemberType::class);
}
function it_has_a_valid_name()

View file

@ -13,7 +13,9 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\AddressingBundle\Form\Type\ZoneMemberType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,12 +35,12 @@ class ZoneMemberProvinceTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_is_a_Sylius_zone_member_type()
{
$this->shouldHaveType('Sylius\Bundle\AddressingBundle\Form\Type\ZoneMemberType');
$this->shouldHaveType(ZoneMemberType::class);
}
function it_has_a_valid_name()

View file

@ -13,7 +13,9 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\AddressingBundle\Form\Type\ZoneMemberType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,12 +35,12 @@ class ZoneMemberZoneTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_is_a_Sylius_zone_member_type()
{
$this->shouldHaveType('Sylius\Bundle\AddressingBundle\Form\Type\ZoneMemberType');
$this->shouldHaveType(ZoneMemberType::class);
}
function it_has_a_valid_name()

View file

@ -12,6 +12,7 @@
namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Form\FormTypeInterface;
class ZoneTypeChoiceTypeSpec extends ObjectBehavior
{
@ -27,7 +28,7 @@ class ZoneTypeChoiceTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_has_a_valid_name()

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\AddressingBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -34,7 +35,7 @@ class ZoneTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_has_a_valid_name()

View file

@ -32,7 +32,7 @@ class ProvinceAddressConstraintValidatorSpec extends ObjectBehavior
function it_throws_exception_if_the_value_is_not_an_address(Constraint $constraint)
{
$this->shouldThrow('\InvalidArgumentException')->during('validate', array(
$this->shouldThrow(\InvalidArgumentException::class)->during('validate', array(
'',
$constraint
));

View file

@ -31,7 +31,7 @@ class ShippableAddressConstraintValidatorSpec extends ObjectBehavior
function it_throws_exception_if_the_value_is_not_an_address(Constraint $constraint)
{
$this->shouldThrow('\InvalidArgumentException')->during('validate', array(
$this->shouldThrow(\InvalidArgumentException::class)->during('validate', array(
'',
$constraint
));

View file

@ -11,6 +11,11 @@
namespace Sylius\Bundle\ApiBundle;
use Sylius\Bundle\ApiBundle\Model\AccessTokenInterface;
use Sylius\Bundle\ApiBundle\Model\AuthCodeInterface;
use Sylius\Bundle\ApiBundle\Model\ClientInterface;
use Sylius\Bundle\ApiBundle\Model\RefreshTokenInterface;
use Sylius\Bundle\ApiBundle\Model\UserInterface;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
@ -37,11 +42,11 @@ class SyliusApiBundle extends AbstractResourceBundle
protected function getModelInterfaces()
{
return array(
'Sylius\Bundle\ApiBundle\Model\UserInterface' => 'sylius.model.api_user.class',
'Sylius\Bundle\ApiBundle\Model\ClientInterface' => 'sylius.model.api_client.class',
'Sylius\Bundle\ApiBundle\Model\AccessTokenInterface' => 'sylius.model.api_access_token.class',
'Sylius\Bundle\ApiBundle\Model\RefreshTokenInterface' => 'sylius.model.api_refresh_token.class',
'Sylius\Bundle\ApiBundle\Model\AuthCodeInterface' => 'sylius.model.api_auth_code.class',
UserInterface::class => 'sylius.model.api_user.class',
ClientInterface::class => 'sylius.model.api_client.class',
AccessTokenInterface::class => 'sylius.model.api_access_token.class',
RefreshTokenInterface::class => 'sylius.model.api_refresh_token.class',
AuthCodeInterface::class => 'sylius.model.api_auth_code.class',
);
}

View file

@ -6,6 +6,7 @@ use FOS\OAuthServerBundle\Model\ClientManager;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ApiBundle\Model\Client;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -19,7 +20,7 @@ class CreateClientCommandSpec extends ObjectBehavior
public function it_is_a_container_aware_command()
{
$this->shouldHaveType('Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand');
$this->shouldHaveType(ContainerAwareCommand::class);
}
public function it_has_a_name()

View file

@ -4,6 +4,7 @@ namespace spec\Sylius\Bundle\ApiBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\FormBuilderInterface;
class ClientTypeSpec extends ObjectBehavior
@ -20,7 +21,7 @@ class ClientTypeSpec extends ObjectBehavior
function it_is_a_form()
{
$this->shouldHaveType('Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType');
$this->shouldHaveType(AbstractResourceType::class);
}
function it_builds_form(FormBuilderInterface $builder)

View file

@ -2,6 +2,7 @@
namespace spec\Sylius\Bundle\ApiBundle\Model;
use FOS\OAuthServerBundle\Entity\AccessToken;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@ -14,6 +15,6 @@ class AccessTokenSpec extends ObjectBehavior
function it_is_a_access_token()
{
$this->shouldHaveType('FOS\OAuthServerBundle\Entity\AccessToken');
$this->shouldHaveType(AccessToken::class);
}
}

View file

@ -2,6 +2,7 @@
namespace spec\Sylius\Bundle\ApiBundle\Model;
use FOS\OAuthServerBundle\Entity\AuthCode;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@ -14,6 +15,6 @@ class AuthCodeSpec extends ObjectBehavior
function it_is_a_auth_code()
{
$this->shouldHaveType('FOS\OAuthServerBundle\Entity\AuthCode');
$this->shouldHaveType(AuthCode::class);
}
}

View file

@ -4,7 +4,9 @@ namespace spec\Sylius\Bundle\ApiBundle\Model;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use FOS\OAuthServerBundle\Entity\ClientManager;
use FOS\OAuthServerBundle\Model\ClientInterface;
use FOS\OAuthServerBundle\Model\ClientManagerInterface;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@ -23,12 +25,12 @@ class ClientManagerSpec extends ObjectBehavior
function it_extends_fos_oauth_server_client_manager()
{
$this->shouldHaveType('FOS\OAuthServerBundle\Entity\ClientManager');
$this->shouldHaveType(ClientManager::class);
}
function it_implements_fos_oauth_server_client_manager_interface()
{
$this->shouldImplement('FOS\OAuthServerBundle\Model\ClientManagerInterface');
$this->shouldImplement(ClientManagerInterface::class);
}
function it_finds_client_by_public_id(ClientInterface $client, $repository)

View file

@ -2,6 +2,8 @@
namespace spec\Sylius\Bundle\ApiBundle\Model;
use FOS\OAuthServerBundle\Entity\Client;
use FOS\OAuthServerBundle\Model\ClientInterface;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@ -14,12 +16,12 @@ class ClientSpec extends ObjectBehavior
function it_extends_fos_oauth_server_client_manager()
{
$this->shouldHaveType('FOS\OAuthServerBundle\Entity\Client');
$this->shouldHaveType(Client::class);
}
function it_implements_fos_oauth_server_client_manager_interface()
{
$this->shouldImplement('FOS\OAuthServerBundle\Model\ClientInterface');
$this->shouldImplement(ClientInterface::class);
}
function it_returns_random_id_as_public_id()

View file

@ -2,6 +2,7 @@
namespace spec\Sylius\Bundle\ApiBundle\Model;
use FOS\OAuthServerBundle\Entity\RefreshToken;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@ -14,6 +15,6 @@ class RefreshTokenSpec extends ObjectBehavior
function it_is_a_refresh_token()
{
$this->shouldHaveType('FOS\OAuthServerBundle\Entity\RefreshToken');
$this->shouldHaveType(RefreshToken::class);
}
}

View file

@ -12,6 +12,7 @@
namespace Sylius\Bundle\ArchetypeBundle\DependencyInjection;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Sylius\Component\Archetype\Builder\ArchetypeBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@ -102,7 +103,7 @@ class SyliusArchetypeExtension extends AbstractResourceExtension
*/
private function createPrototypeBuilder(ContainerBuilder $container, $subjectName)
{
$builderDefintion = new Definition('Sylius\Component\Archetype\Builder\ArchetypeBuilder');
$builderDefintion = new Definition(ArchetypeBuilder::class);
$builderDefintion
->setArguments(array(new Reference(sprintf('sylius.factory.%s_attribute_value', $subjectName))))
;

View file

@ -11,6 +11,7 @@
namespace spec\Sylius\Bundle\ArchetypeBundle\EventListener;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use PhpSpec\ObjectBehavior;
@ -44,7 +45,7 @@ class LoadMetadataSubscriberSpec extends ObjectBehavior
function it_is_a_Doctrine_event_subscriber()
{
$this->shouldImplement('Doctrine\Common\EventSubscriber');
$this->shouldImplement(EventSubscriber::class);
}
function it_subscribes_to_loadClassMetadata_events_dispatched_by_Doctrine()

View file

@ -16,6 +16,7 @@ use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Component\Archetype\Model\ArchetypeInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;
@ -39,7 +40,7 @@ class ParentArchetypeListenerSpec extends ObjectBehavior
function it_implements_event_subscriber_interface()
{
$this->shouldImplement('Symfony\Component\EventDispatcher\EventSubscriberInterface');
$this->shouldImplement(EventSubscriberInterface::class);
}
function it_is_subscribed_to_pre_set_data_form_event()
@ -50,7 +51,7 @@ class ParentArchetypeListenerSpec extends ObjectBehavior
function it_throws_exception_if_add_event_subscriber_parameter_is_not_an_instance_of_archetype_interface(FormEvent $event)
{
$event->getData()->willReturn('badObject');
$this->shouldThrow(new UnexpectedTypeException('badObject', 'Sylius\Component\Archetype\Model\ArchetypeInterface'))
$this->shouldThrow(new UnexpectedTypeException('badObject', ArchetypeInterface::class))
->during('preSetData', array($event))
;
}

View file

@ -4,6 +4,7 @@ namespace spec\Sylius\Bundle\ArchetypeBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\FormBuilderInterface;
class ArchetypeTranslationTypeSpec extends ObjectBehavior
@ -20,7 +21,7 @@ class ArchetypeTranslationTypeSpec extends ObjectBehavior
function it_is_a_form()
{
$this->shouldHaveType('Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType');
$this->shouldHaveType(AbstractResourceType::class);
}
function it_buils_a_form(FormBuilderInterface $builder)

View file

@ -16,8 +16,9 @@ use Prophecy\Argument;
use Sylius\Bundle\ArchetypeBundle\Form\EventListener\ParentArchetypeListener;
use Sylius\Bundle\ResourceBundle\Form\EventSubscriber\AddCodeFormSubscriber;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
@ -37,7 +38,7 @@ class ArchetypeTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_form_with_proper_fields(FormBuilder $builder)

View file

@ -11,6 +11,7 @@
namespace spec\Sylius\Bundle\AttributeBundle\EventListener;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
@ -49,7 +50,7 @@ class LoadMetadataSubscriberSpec extends ObjectBehavior
function it_is_a_Doctrine_event_subscriber()
{
$this->shouldImplement('Doctrine\Common\EventSubscriber');
$this->shouldImplement(EventSubscriber::class);
}
function it_subscribes_to_loadClassMetadata_events_dispatched_by_Doctrine()

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\AttributeBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,7 +34,7 @@ class AttributeTranslationTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_form_with_proper_fields(FormBuilder $builder)

View file

@ -13,9 +13,11 @@ namespace spec\Sylius\Bundle\AttributeBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\AttributeBundle\Form\EventListener\BuildAttributeFormChoicesListener;
use Sylius\Component\Attribute\Model\AttributeTypes;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -39,13 +41,13 @@ class AttributeTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_form_with_proper_fields(FormBuilder $builder)
{
$builder
->addEventSubscriber(Argument::type('Sylius\Bundle\AttributeBundle\Form\EventListener\BuildAttributeFormChoicesListener'))
->addEventSubscriber(Argument::type(BuildAttributeFormChoicesListener::class))
->shouldBeCalled()
->willReturn($builder)
;

View file

@ -17,6 +17,7 @@ use Sylius\Component\Attribute\Model\AttributeInterface;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -36,7 +37,7 @@ class AttributeValueTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_attribute_types_prototype_and_passes_it_as_argument(

View file

@ -13,6 +13,8 @@ namespace Sylius\Bundle\CartBundle;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Cart\Model\CartInterface;
use Sylius\Component\Cart\Model\CartItemInterface;
/**
* Flexible shopping cart system for Symfony2 ecommerce applications.
@ -45,8 +47,8 @@ class SyliusCartBundle extends AbstractResourceBundle
protected function getModelInterfaces()
{
return array(
'Sylius\Component\Cart\Model\CartInterface' => 'sylius.model.cart.class',
'Sylius\Component\Cart\Model\CartItemInterface' => 'sylius.model.cart_item.class',
CartInterface::class => 'sylius.model.cart.class',
CartItemInterface::class => 'sylius.model.cart_item.class',
);
}

View file

@ -5,6 +5,7 @@ namespace spec\Sylius\Bundle\CartBundle\Command;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Component\Cart\Purger\PurgerInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -18,7 +19,7 @@ class PurgeCartsCommandSpec extends ObjectBehavior
public function it_is_a_command()
{
$this->shouldHaveType('Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand');
$this->shouldHaveType(ContainerAwareCommand::class);
}
public function it_has_a_name()

View file

@ -43,7 +43,7 @@ class CartRepositorySpec extends ObjectBehavior
$builder->addSelect('item')->shouldBeCalled()->willReturn($builder);
$builder->andWhere(Argument::any())->shouldBeCalled()->willReturn($builder);
$builder->andWhere(Argument::any())->shouldBeCalled()->willReturn($builder);
$builder->setParameter('now', Argument::type('\DateTime'))->shouldBeCalled()->willReturn($builder);
$builder->setParameter('now', Argument::type(\DateTime::class))->shouldBeCalled()->willReturn($builder);
$builder->setParameter('state', OrderInterface::STATE_CART)->shouldBeCalled()->willReturn($builder);
$builder->getQuery()->shouldBeCalled()->willReturn($query);

View file

@ -27,6 +27,6 @@ class RefreshCartListenerSpec extends ObjectBehavior
$event->getSubject()->shouldBeCalled()->willReturn(null);
$cart->calculateTotal()->shouldNotBeCalled();
$this->shouldThrow('\InvalidArgumentException')->during('refreshCart', array($event));
$this->shouldThrow(\InvalidArgumentException::class)->during('refreshCart', array($event));
}
}

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\CartBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,7 +34,7 @@ class CartItemTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_form_with_quantity_field(FormBuilder $builder)

View file

@ -13,6 +13,7 @@ namespace spec\Sylius\Bundle\CartBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -32,7 +33,7 @@ class CartTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_form_with_items_collection(FormBuilder $builder)

View file

@ -19,6 +19,7 @@ use Sylius\Component\Resource\Factory\FactoryInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Templating\Helper\Helper;
class CartHelperSpec extends ObjectBehavior
{
@ -37,7 +38,7 @@ class CartHelperSpec extends ObjectBehavior
function it_is_a_twig_extension()
{
$this->shouldHaveType('Symfony\Component\Templating\Helper\Helper');
$this->shouldHaveType(Helper::class);
}
function its_getCurrentCart_returns_current_cart_via_provider($cartProvider, CartInterface $cart)

View file

@ -13,6 +13,7 @@ namespace Sylius\Bundle\ChannelBundle;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Channel\Model\ChannelInterface;
/**
* Channels bundle.
@ -37,7 +38,7 @@ class SyliusChannelBundle extends AbstractResourceBundle
protected function getModelInterfaces()
{
return array(
'Sylius\Component\Channel\Model\ChannelInterface' => 'sylius.model.channel.class',
ChannelInterface::class => 'sylius.model.channel.class',
);
}

View file

@ -19,6 +19,8 @@ use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
/**
* @author Arnaud Langlade <arn0d.dev@gmail.com>
@ -37,8 +39,8 @@ class ChannelRepositorySpec extends ObjectBehavior
function it_is_arepository()
{
$this->shouldHaveType('Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository');
$this->shouldImplement('Sylius\Component\Channel\Repository\ChannelRepositoryInterface');
$this->shouldHaveType(EntityRepository::class);
$this->shouldImplement(ChannelRepositoryInterface::class);
}
function it_finds_by_host_name($em, QueryBuilder $builder, AbstractQuery $query, Expr $expr)

View file

@ -15,6 +15,7 @@ use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ResourceBundle\Form\EventSubscriber\AddCodeFormSubscriber;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -34,7 +35,7 @@ class ChannelTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_should_build_form_with_proper_fields(FormBuilder $builder)

View file

@ -13,6 +13,9 @@ namespace Sylius\Bundle\ContactBundle;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Contact\Model\RequestInterface;
use Sylius\Component\Contact\Model\TopicInterface;
use Sylius\Component\Contact\Model\TopicTranslationInterface;
/**
* Contact bundle.
@ -38,9 +41,9 @@ class SyliusContactBundle extends AbstractResourceBundle
protected function getModelInterfaces()
{
return array(
'Sylius\Component\Contact\Model\RequestInterface' => 'sylius.model.contact_request.class',
'Sylius\Component\Contact\Model\TopicInterface' => 'sylius.model.contact_topic.class',
'Sylius\Component\Contact\Model\TopicTranslationInterface' => 'sylius.model.contact_topic_translation.class',
RequestInterface::class => 'sylius.model.contact_request.class',
TopicInterface::class => 'sylius.model.contact_topic.class',
TopicTranslationInterface::class => 'sylius.model.contact_topic_translation.class',
);
}

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\ContactBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,7 +34,7 @@ class RequestTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_should_build_form_with_proper_fields(FormBuilder $builder)

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\ContactBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -33,7 +34,7 @@ class TopicTranslationTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_form_with_proper_fields(FormBuilder $builder)

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\ContactBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -34,7 +35,7 @@ class TopicTypeSpec extends ObjectBehavior
function it_is_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_should_build_form_with_proper_fields(FormBuilder $builder)

View file

@ -16,6 +16,7 @@ use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
use Doctrine\ODM\PHPCR\UnitOfWork;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\DocumentRepository;
class StaticContentRepositorySpec extends ObjectBehavior
{
@ -33,7 +34,7 @@ class StaticContentRepositorySpec extends ObjectBehavior
function it_is_a_document_repository()
{
$this->shouldHaveType('Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\DocumentRepository');
$this->shouldHaveType(DocumentRepository::class);
}
function it_find_by_id($dm)

View file

@ -35,7 +35,7 @@ class RestrictedZoneChecker implements RestrictedZoneCheckerInterface
public function isRestricted($subject, AddressInterface $address = null)
{
if (!$subject instanceof ProductInterface) {
throw new UnexpectedTypeException($subject, 'Sylius\Component\Core\Model\ProductInterface');
throw new UnexpectedTypeException($subject, ProductInterface::class);
}
if (null === $customer = $this->customerContext->getCustomer()) {

View file

@ -11,6 +11,7 @@
namespace Sylius\Bundle\CoreBundle\Controller;
use Gedmo\Loggable\Entity\LogEntry;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Order\OrderTransitions;
@ -92,7 +93,7 @@ class OrderController extends ResourceController
/** @var $order OrderInterface */
$order = $this->findOr404($request);
$repository = $this->get('doctrine')->getManager()->getRepository('Gedmo\Loggable\Entity\LogEntry');
$repository = $this->get('doctrine')->getManager()->getRepository(LogEntry::class);
$items = array();
foreach ($order->getItems() as $item) {

View file

@ -11,6 +11,7 @@
namespace Sylius\Bundle\CoreBundle\Controller;
use Gedmo\Loggable\Entity\LogEntry;
use Sylius\Bundle\PaymentBundle\Controller\PaymentController as BasePaymentController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -37,7 +38,7 @@ class PaymentController extends BasePaymentController
$logRepository = $this
->getDoctrine()
->getManager()
->getRepository('Gedmo\Loggable\Entity\LogEntry')
->getRepository(LogEntry::class)
;
$view = $this

View file

@ -11,6 +11,7 @@
namespace Sylius\Bundle\CoreBundle\Controller;
use Gedmo\Loggable\Entity\LogEntry;
use Pagerfanta\Pagerfanta;
use Sylius\Bundle\ProductBundle\Controller\ProductController as BaseProductController;
use Sylius\Bundle\SearchBundle\Query\TaxonQuery;
@ -160,7 +161,7 @@ class ProductController extends BaseProductController
/** @var $product ProductInterface */
$product = $this->findOr404($request);
$repository = $this->get('doctrine')->getManager()->getRepository('Gedmo\Loggable\Entity\LogEntry');
$repository = $this->get('doctrine')->getManager()->getRepository(LogEntry::class);
$variants = array();
foreach ($product->getVariants() as $variant) {

View file

@ -55,7 +55,7 @@ class CartBlamerListener
$cart = $this->cartProvider->getCart();
if (!$cart instanceof OrderInterface) {
throw new UnexpectedTypeException($cart, 'Sylius\Component\Core\Model\OrderInterface');
throw new UnexpectedTypeException($cart, OrderInterface::class);
}
$customer = $userEvent->getUser()->getCustomer();
@ -77,7 +77,7 @@ class CartBlamerListener
$cart = $this->cartProvider->getCart();
if (!$cart instanceof OrderInterface) {
throw new UnexpectedTypeException($cart, 'Sylius\Component\Core\Model\OrderInterface');
throw new UnexpectedTypeException($cart, OrderInterface::class);
}
$user = $interactiveLoginEvent->getAuthenticationToken()->getUser();

View file

@ -48,7 +48,7 @@ class ChannelDeletionListener
if (!$channel instanceof ChannelInterface) {
throw new UnexpectedTypeException(
$channel,
'Sylius\Component\Channel\Model\ChannelInterface'
ChannelInterface::class
);
}

View file

@ -30,7 +30,7 @@ class CheckoutAddressingListener
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException(
$order,
'Sylius\Component\Core\Model\OrderInterface'
OrderInterface::class
);
}
/** @var CustomerInterface $customer */

View file

@ -58,7 +58,7 @@ class ImageUploadListener
if (!$subject instanceof TaxonInterface) {
throw new UnexpectedTypeException(
$subject,
'Sylius\Component\Taxonomy\Model\TaxonInterface'
TaxonInterface::class
);
}

View file

@ -50,7 +50,7 @@ class MailerListener
if (!$customer instanceof CustomerInterface) {
throw new UnexpectedTypeException(
$customer,
'Sylius\Component\Core\Model\CustomerInterface'
CustomerInterface::class
);
}

View file

@ -46,7 +46,7 @@ class OrderChannelListener
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException(
$order,
'Sylius\Component\Core\Model\OrderInterface'
OrderInterface::class
);
}

View file

@ -13,8 +13,8 @@ namespace Sylius\Bundle\CoreBundle\EventListener;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Currency\Context\CurrencyContextInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Sylius\Component\Resource\Exception\UnexpectedTypeException;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Sets currently selected currency on order object.
@ -44,7 +44,7 @@ class OrderCurrencyListener
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException(
$order,
'Sylius\Component\Core\Model\OrderInterface'
OrderInterface::class
);
}

View file

@ -103,7 +103,7 @@ class OrderInventoryListener
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException(
$order,
'Sylius\Component\Core\Model\OrderInterface'
OrderInterface::class
);
}

View file

@ -125,7 +125,7 @@ class OrderPaymentListener
$order = $event->getSubject();
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException($order, 'Sylius\Component\Core\Model\OrderInterface');
throw new UnexpectedTypeException($order, OrderInterface::class);
}
return $order;

View file

@ -50,7 +50,7 @@ class OrderPricingListener
$order = $event->getSubject();
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException($order, 'Sylius\Component\Core\Model\OrderInterface');
throw new UnexpectedTypeException($order, OrderInterface::class);
}
$context = array();

View file

@ -75,7 +75,7 @@ class OrderPromotionListener
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException(
$order,
'Sylius\Component\Core\Model\OrderInterface'
OrderInterface::class
);
}

View file

@ -103,7 +103,7 @@ class OrderShippingListener
$order = $event->getSubject();
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException($order, 'Sylius\Component\Core\Model\OrderInterface');
throw new UnexpectedTypeException($order, OrderInterface::class);
}
return $order;

View file

@ -54,7 +54,7 @@ class OrderTaxationListener
if (!$order instanceof OrderInterface) {
throw new UnexpectedTypeException(
$order,
'Sylius\Component\Core\Model\OrderInterface'
OrderInterface::class
);
}

View file

@ -12,6 +12,7 @@
namespace Sylius\Bundle\CoreBundle\Form\Type\Api;
use Sylius\Bundle\OrderBundle\Form\Type\OrderItemType as BaseOrderItemType;
use Sylius\Component\Core\Model\ProductVariant;
use Symfony\Component\Form\FormBuilderInterface;
/**
@ -30,7 +31,7 @@ class OrderItemType extends BaseOrderItemType
$builder
->add('variant', 'entity_hidden', array(
'data_class' => 'Sylius\Component\Core\Model\ProductVariant'
'data_class' => ProductVariant::class
))
;
}

View file

@ -12,6 +12,7 @@
namespace Sylius\Bundle\CoreBundle\Form\Type\Api;
use Sylius\Bundle\CoreBundle\Form\Type\ProductType as BaseProductType;
use Sylius\Component\Core\Model\Taxon;
use Symfony\Component\Form\FormBuilderInterface;
/**
@ -29,7 +30,7 @@ class ProductType extends BaseProductType
$builder
->add('taxons', 'entity', array(
'multiple' => true,
'class' => 'Sylius\Component\Core\Model\Taxon'
'class' => Taxon::class
))
->add('price', 'sylius_money', array(
'property_path' => 'masterVariant.price'

View file

@ -12,6 +12,7 @@
namespace Sylius\Bundle\CoreBundle\Form\Type;
use Sylius\Bundle\OrderBundle\Form\Type\OrderItemType as BaseOrderItemType;
use Sylius\Component\Core\Model\ProductVariant;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
@ -51,7 +52,7 @@ class OrderItemType extends BaseOrderItemType
parent::configureOptions($resolver);
$resolver->setDefaults(array(
'variant_data_class' => 'Sylius\Component\Core\Model\ProductVariant',
'variant_data_class' => ProductVariant::class,
));
}
}

View file

@ -15,6 +15,7 @@ use Doctrine\Common\Persistence\ObjectRepository;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Sylius\Bundle\SettingsBundle\Transformer\ObjectToIdentifierTransformer;
use Sylius\Component\Addressing\Model\ZoneInterface;
use Symfony\Component\Form\FormBuilderInterface;
/**
@ -51,7 +52,7 @@ class TaxationSettingsSchema implements SchemaInterface
'default_tax_zone'
))
->setAllowedTypes(array(
'default_tax_zone' => array('null', 'Sylius\Component\Addressing\Model\ZoneInterface'),
'default_tax_zone' => array('null', ZoneInterface::class),
))
->setTransformer('default_tax_zone', new ObjectToIdentifierTransformer($this->zoneRepository))
;

View file

@ -16,6 +16,7 @@ use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\LazyCacheWarmupPass;
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\RoutingRepositoryPass;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Core\Model\ProductVariantImageInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
@ -54,7 +55,7 @@ class SyliusCoreBundle extends AbstractResourceBundle
protected function getModelInterfaces()
{
return array(
'Sylius\Component\Core\Model\ProductVariantImageInterface' => 'sylius.model.product_variant_image.class',
ProductVariantImageInterface::class => 'sylius.model.product_variant_image.class',
);
}

View file

@ -15,6 +15,8 @@ use PhpSpec\ObjectBehavior;
use Sylius\Component\Addressing\Checker\RestrictedZoneCheckerInterface;
use Sylius\Component\Cart\Model\CartItemInterface;
use Sylius\Component\Cart\Provider\CartProviderInterface;
use Sylius\Component\Cart\Resolver\ItemResolverInterface;
use Sylius\Component\Cart\Resolver\ItemResolvingException;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Inventory\Checker\AvailabilityCheckerInterface;
use Sylius\Component\Pricing\Calculator\DelegatingCalculatorInterface;
@ -54,7 +56,7 @@ class ItemResolverSpec extends ObjectBehavior
function it_implements_Sylius_cart_item_resolver_interface()
{
$this->shouldImplement('Sylius\Component\Cart\Resolver\ItemResolverInterface');
$this->shouldImplement(ItemResolverInterface::class);
}
function it_throws_exception_unless_request_method_is_POST_or_PUT(CartItemInterface $item, Request $request)
@ -63,7 +65,7 @@ class ItemResolverSpec extends ObjectBehavior
$request->isMethod('PUT')->willReturn(false);
$this
->shouldThrow('Sylius\Component\Cart\Resolver\ItemResolvingException')
->shouldThrow(ItemResolvingException::class)
->duringResolve($item, $request)
;
}
@ -74,7 +76,7 @@ class ItemResolverSpec extends ObjectBehavior
$request->get('id')->willReturn(null);
$this
->shouldThrow('Sylius\Component\Cart\Resolver\ItemResolvingException')
->shouldThrow(ItemResolvingException::class)
->duringResolve($item, $request)
;
}
@ -90,7 +92,7 @@ class ItemResolverSpec extends ObjectBehavior
$productRepository->findOneBy(array('id' => 5, 'channels' => null))->willReturn(null);
$this
->shouldThrow('Sylius\Component\Cart\Resolver\ItemResolvingException')
->shouldThrow(ItemResolvingException::class)
->duringResolve($item, $request)
;
}

View file

@ -12,6 +12,7 @@
namespace spec\Sylius\Bundle\CoreBundle\Checker;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Addressing\Checker\RestrictedZoneCheckerInterface;
use Sylius\Component\Addressing\Matcher\ZoneMatcherInterface;
use Sylius\Component\Addressing\Model\AddressInterface;
use Sylius\Component\Addressing\Model\ZoneInterface;
@ -33,7 +34,7 @@ class RestrictedZoneCheckerSpec extends ObjectBehavior
function it_implements_Sylius_cart_item_resolver_interface()
{
$this->shouldImplement('Sylius\Component\Addressing\Checker\RestrictedZoneCheckerInterface');
$this->shouldImplement(RestrictedZoneCheckerInterface::class);
}
function it_is_not_restricted_if_customer_is_not_authenticated(ProductInterface $product, $customerContext)

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\CoreBundle\Checkout;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\FlowBundle\Process\Builder\ProcessBuilderInterface;
use Sylius\Bundle\FlowBundle\Process\Scenario\ProcessScenarioInterface;
use Sylius\Component\Cart\Model\CartInterface;
use Sylius\Component\Cart\Provider\CartProviderInterface;
@ -36,7 +37,7 @@ class CheckoutProcessScenarioSpec extends ObjectBehavior
function it_implements_Sylius_process_scenario_interface()
{
$this->shouldImplement('Sylius\Bundle\FlowBundle\Process\Scenario\ProcessScenarioInterface');
$this->shouldImplement(ProcessScenarioInterface::class);
}
function it_builds_checkout_process_with_proper_steps(ProcessBuilderInterface $builder)

View file

@ -18,7 +18,11 @@ use Payum\Core\Security\HttpRequestVerifierInterface;
use Payum\Core\Security\TokenInterface;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\CoreBundle\Checkout\Step\CheckoutStep;
use Sylius\Bundle\CoreBundle\Event\PurchaseCompleteEvent;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
use Sylius\Bundle\FlowBundle\Process\Step\ActionResult;
use Sylius\Bundle\PayumBundle\Request\GetStatus;
use Sylius\Component\Cart\Provider\CartProviderInterface;
use Sylius\Component\Core\Model\Order;
use Sylius\Component\Core\Model\Payment;
@ -26,6 +30,7 @@ use Sylius\Component\Core\SyliusCheckoutEvents;
use Symfony\Bridge\Doctrine\RegistryInterface as DoctrinRegistryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Session;
@ -78,7 +83,7 @@ class PurchaseStepSpec extends ObjectBehavior
function it_extends_checkout_step()
{
$this->shouldImplement('Sylius\Bundle\CoreBundle\Checkout\Step\CheckoutStep');
$this->shouldImplement(CheckoutStep::class);
}
function it_must_dispatch_pre_and_post_payment_state_changed_if_state_changed(
@ -96,7 +101,7 @@ class PurchaseStepSpec extends ObjectBehavior
$order->addPayment($paymentModel);
$gateway
->execute(Argument::type('Sylius\Bundle\PayumBundle\Request\GetStatus'))
->execute(Argument::type(GetStatus::class))
->will(function ($args) use ($order, $paymentModel) {
$args[0]->markCaptured();
$args[0]->setModel($paymentModel);
@ -106,7 +111,7 @@ class PurchaseStepSpec extends ObjectBehavior
$eventDispatcher
->dispatch(
SyliusCheckoutEvents::PURCHASE_INITIALIZE,
Argument::type('Symfony\Component\EventDispatcher\GenericEvent')
Argument::type(GenericEvent::class)
)
->shouldBeCalled()
;
@ -114,7 +119,7 @@ class PurchaseStepSpec extends ObjectBehavior
$eventDispatcher
->dispatch(
SyliusCheckoutEvents::PURCHASE_PRE_COMPLETE,
Argument::type('Symfony\Component\EventDispatcher\GenericEvent')
Argument::type(GenericEvent::class)
)
->shouldBeCalled()
;
@ -122,12 +127,12 @@ class PurchaseStepSpec extends ObjectBehavior
$eventDispatcher
->dispatch(
SyliusCheckoutEvents::PURCHASE_COMPLETE,
Argument::type('Sylius\Bundle\CoreBundle\Event\PurchaseCompleteEvent')
Argument::type(PurchaseCompleteEvent::class)
)
->shouldBeCalled()
;
$this->forwardAction($context)->shouldReturnAnInstanceOf('Sylius\Bundle\FlowBundle\Process\Step\ActionResult');
$this->forwardAction($context)->shouldReturnAnInstanceOf(ActionResult::class);
}
function it_must_not_dispatch_pre_and_post_payment_state_changed_if_state_not_changed(
@ -145,7 +150,7 @@ class PurchaseStepSpec extends ObjectBehavior
$order->addPayment($paymentModel);
$gateway
->execute(Argument::type('Sylius\Bundle\PayumBundle\Request\GetStatus'))
->execute(Argument::type(GetStatus::class))
->will(function ($args) use ($order, $paymentModel) {
$args[0]->markCaptured();
$args[0]->setModel($paymentModel);
@ -155,7 +160,7 @@ class PurchaseStepSpec extends ObjectBehavior
$eventDispatcher
->dispatch(
SyliusCheckoutEvents::PURCHASE_INITIALIZE,
Argument::type('Symfony\Component\EventDispatcher\GenericEvent')
Argument::type(GenericEvent::class)
)
->shouldBeCalled()
;
@ -163,7 +168,7 @@ class PurchaseStepSpec extends ObjectBehavior
$eventDispatcher
->dispatch(
SyliusCheckoutEvents::PURCHASE_PRE_COMPLETE,
Argument::type('Symfony\Component\EventDispatcher\GenericEvent')
Argument::type(GenericEvent::class)
)
->shouldBeCalled()
;
@ -171,11 +176,11 @@ class PurchaseStepSpec extends ObjectBehavior
$eventDispatcher
->dispatch(
SyliusCheckoutEvents::PURCHASE_COMPLETE,
Argument::type('Sylius\Bundle\CoreBundle\Event\PurchaseCompleteEvent')
Argument::type(PurchaseCompleteEvent::class)
)
->shouldBeCalled()
;
$this->forwardAction($context)->shouldReturnAnInstanceOf('Sylius\Bundle\FlowBundle\Process\Step\ActionResult');
$this->forwardAction($context)->shouldReturnAnInstanceOf(ActionResult::class);
}
}

View file

@ -19,6 +19,7 @@ use Sylius\Bundle\SettingsBundle\Model\Settings;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Channel\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Currency\Context\CurrencyContext as SyliusCurrencyContext;
use Sylius\Component\Storage\StorageInterface;
use Sylius\Component\User\Context\CustomerContextInterface;
@ -45,7 +46,7 @@ class CurrencyContextSpec extends ObjectBehavior
function it_extends_Sylius_currency_context()
{
$this->shouldHaveType('Sylius\Component\Currency\Context\CurrencyContext');
$this->shouldHaveType(SyliusCurrencyContext::class);
}
function it_gets_default_currency()

View file

@ -13,8 +13,10 @@ namespace spec\Sylius\Bundle\CoreBundle\DataFetcher;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ReportBundle\DataFetcher\TimePeriod;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\Component\Report\DataFetcher\Data;
use Sylius\Component\Report\DataFetcher\DataFetcherInterface;
use Sylius\Component\Report\DataFetcher\DefaultDataFetchers;
/**
@ -29,12 +31,12 @@ class NumberOfOrdersDataFetcherSpec extends ObjectBehavior
public function it_extends_time_period()
{
$this->shouldHaveType('Sylius\Bundle\ReportBundle\DataFetcher\TimePeriod');
$this->shouldHaveType(TimePeriod::class);
}
public function it_implements_data_fetcher_interface()
{
$this->shouldImplement('Sylius\Component\Report\DataFetcher\DataFetcherInterface');
$this->shouldImplement(DataFetcherInterface::class);
}
public function let(OrderRepositoryInterface $orderRepository)

View file

@ -13,8 +13,10 @@ namespace spec\Sylius\Bundle\CoreBundle\DataFetcher;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ReportBundle\DataFetcher\TimePeriod;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\Component\Report\DataFetcher\Data;
use Sylius\Component\Report\DataFetcher\DataFetcherInterface;
use Sylius\Component\Report\DataFetcher\DefaultDataFetchers;
/**
@ -29,12 +31,12 @@ class SalesTotalDataFetcherSpec extends ObjectBehavior
public function it_extends_time_period()
{
$this->shouldHaveType('Sylius\Bundle\ReportBundle\DataFetcher\TimePeriod');
$this->shouldHaveType(TimePeriod::class);
}
public function it_implements_data_fetcher_interface()
{
$this->shouldImplement('Sylius\Component\Report\DataFetcher\DataFetcherInterface');
$this->shouldImplement(DataFetcherInterface::class);
}
public function let(OrderRepositoryInterface $orderRepository)

View file

@ -13,8 +13,10 @@ namespace spec\Sylius\Bundle\CoreBundle\DataFetcher;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ReportBundle\DataFetcher\TimePeriod;
use Sylius\Bundle\UserBundle\Doctrine\ORM\UserRepository;
use Sylius\Component\Report\DataFetcher\Data;
use Sylius\Component\Report\DataFetcher\DataFetcherInterface;
use Sylius\Component\Report\DataFetcher\DefaultDataFetchers;
/**
@ -29,12 +31,12 @@ class UserRegistrationDataFetcherSpec extends ObjectBehavior
public function it_extends_time_period()
{
$this->shouldHaveType('Sylius\Bundle\ReportBundle\DataFetcher\TimePeriod');
$this->shouldHaveType(TimePeriod::class);
}
public function it_implements_data_fetcher_interface()
{
$this->shouldImplement('Sylius\Component\Report\DataFetcher\DataFetcherInterface');
$this->shouldImplement(DataFetcherInterface::class);
}
public function let(UserRepository $userRepository)

View file

@ -8,8 +8,10 @@ use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\QueryBuilder;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Payment\Model\PaymentMethodInterface;
use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface;
class PaymentMethodRepositorySpec extends ObjectBehavior
{
@ -25,8 +27,8 @@ class PaymentMethodRepositorySpec extends ObjectBehavior
function it_is_a_repository()
{
$this->shouldHaveType('Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository');
$this->shouldImplement('Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface');
$this->shouldHaveType(EntityRepository::class);
$this->shouldImplement(PaymentMethodRepositoryInterface::class);
}
function it_creates_query_builder_for_the_payment_method(

View file

@ -19,6 +19,7 @@ use Sylius\Component\Cart\Provider\CartProviderInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\UserInterface;
use Sylius\Component\Resource\Exception\UnexpectedTypeException;
/*
* @author Michał Marcinkowski <michal.marcinkowski@lakion.com>
@ -43,7 +44,7 @@ class CartBlamerListenerSpec extends ObjectBehavior
$cartManager->persist($cart)->shouldNotBeCalled();
$cartManager->flush()->shouldNotBeCalled();
$this->shouldThrow('Sylius\Component\Resource\Exception\UnexpectedTypeException')->during('blame', array($userEvent));
$this->shouldThrow(UnexpectedTypeException::class)->during('blame', array($userEvent));
}
function it_blames_cart_on_user($cartManager, $cartProvider, OrderInterface $cart, UserEvent $userEvent, UserInterface $user, CustomerInterface $customer)

View file

@ -34,7 +34,7 @@ class CheckoutAddressingListenerSpec extends ObjectBehavior
$event->getSubject()->willReturn($invalidSubject);
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringSetCustomerAddressing($event)
;
}

View file

@ -66,7 +66,7 @@ class ImageUploadListenerSpec extends ObjectBehavior
$event->getSubject()->willReturn($uploader);
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringUploadProductImage($event)
;
}

View file

@ -6,6 +6,7 @@ use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Component\Inventory\Model\StockableInterface;
use Sylius\Component\Inventory\Operator\InsufficientStockException;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
@ -53,7 +54,7 @@ class InsufficientStockExceptionListenerSpec extends ObjectBehavior
$exception->getStockable()->shouldBeCalledTimes(2)->willReturn($stockable);
$event->getException()->shouldBeCalled()->willReturn($exception);
$event->setResponse(Argument::type('Symfony\Component\HttpFoundation\RedirectResponse'))->shouldBeCalled();
$event->setResponse(Argument::type(RedirectResponse::class))->shouldBeCalled();
$translator->trans(
'sylius.checkout.out_of_stock',

View file

@ -37,7 +37,7 @@ class MailerListenerSpec extends ObjectBehavior
$exception = new UnexpectedTypeException(
$customerClass,
'Sylius\Component\Core\Model\CustomerInterface'
CustomerInterface::class
);
$this->shouldThrow($exception)->duringSendUserConfirmationEmail($event);

View file

@ -30,7 +30,7 @@ class OrderChannelListenerSpec extends ObjectBehavior
$orderClass = new \stdClass();
$exception = new UnexpectedTypeException(
$orderClass,
'Sylius\Component\Core\Model\OrderInterface'
OrderInterface::class
);
$event->getSubject()->shouldBeCalled()->willReturn($orderClass);

View file

@ -36,7 +36,7 @@ class OrderCurrencyListenerSpec extends ObjectBehavior
$event->getSubject()->willReturn($invalidSubject);
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringProcessOrderCurrency($event)
;
}

View file

@ -42,12 +42,12 @@ class OrderPaymentListenerSpec extends ObjectBehavior
$event->getSubject()->willReturn($invalidSubject);
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringCreateOrderPayment($event)
;
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringUpdateOrderPayment($event)
;
}
@ -69,7 +69,7 @@ class OrderPaymentListenerSpec extends ObjectBehavior
$order->hasPayments()->willReturn(false);
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringUpdateOrderPayment($event)
;
}

View file

@ -32,7 +32,7 @@ class OrderPricingListenerSpec extends ObjectBehavior
function it_should_throw_an_exception_if_its_subjet_is_not_order_interface(GenericEvent $event)
{
$wrongOrderClass = new \stdClass();
$exception = new UnexpectedTypeException($wrongOrderClass, 'Sylius\Component\Core\Model\OrderInterface');
$exception = new UnexpectedTypeException($wrongOrderClass, OrderInterface::class);
$event->getSubject()->shouldBeCalled()->willReturn($wrongOrderClass);

View file

@ -43,7 +43,7 @@ class OrderShippingListenerSpec extends ObjectBehavior
$event->getSubject()->willReturn($invalidSubject);
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringProcessOrderShippingCharges($event)
;
}

View file

@ -36,7 +36,7 @@ class OrderTaxationListenerSpec extends ObjectBehavior
$event->getSubject()->willReturn($invalidSubject);
$this
->shouldThrow('InvalidArgumentException')
->shouldThrow(\InvalidArgumentException::class)
->duringApplyTaxes($event)
;
}

View file

@ -12,6 +12,8 @@
namespace spec\Sylius\Bundle\CoreBundle\Form\DataTransformer;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
@ -30,7 +32,7 @@ class ArrayToStringTransformerSpec extends ObjectBehavior
function it_implements_form_data_transformer_interface()
{
$this->shouldImplement('Symfony\Component\Form\DataTransformerInterface');
$this->shouldImplement(DataTransformerInterface::class);
}
function it_returns_empty_string_if_array_is_empty()
@ -41,7 +43,7 @@ class ArrayToStringTransformerSpec extends ObjectBehavior
function it_throws_exception_if_not_array_transformed()
{
$this
->shouldThrow('Symfony\Component\Form\Exception\UnexpectedTypeException')
->shouldThrow(UnexpectedTypeException::class)
->duringTransform('foo')
;
}
@ -49,7 +51,7 @@ class ArrayToStringTransformerSpec extends ObjectBehavior
function it_throws_exception_if_not_string_reverse_transformed()
{
$this
->shouldThrow('Symfony\Component\Form\Exception\UnexpectedTypeException')
->shouldThrow(UnexpectedTypeException::class)
->duringTransform(false)
;
}

View file

@ -12,6 +12,7 @@
namespace spec\Sylius\Bundle\CoreBundle\Form\Type\DataFetcher;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -34,7 +35,7 @@ class DataFetcherChoiceTypeSpec extends ObjectBehavior
function it_extends_abstract_type()
{
$this->shouldHaveType('Symfony\Component\Form\AbstractType');
$this->shouldHaveType(AbstractType::class);
}
function it_has_name()

View file

@ -13,6 +13,7 @@ namespace spec\Sylius\Bundle\CoreBundle\Form\Type\DataFetcher;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
/**
@ -27,7 +28,7 @@ class NumberOfOrdersTypeSpec extends ObjectBehavior
function it_extends_abstract_type()
{
$this->shouldHaveType('Symfony\Component\Form\AbstractType');
$this->shouldHaveType(AbstractType::class);
}
function it_has_name()

View file

@ -13,6 +13,7 @@ namespace spec\Sylius\Bundle\CoreBundle\Form\Type\DataFetcher;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
/**
@ -27,7 +28,7 @@ class SalesTotalTypeSpec extends ObjectBehavior
function it_extends_abstract_type()
{
$this->shouldHaveType('Symfony\Component\Form\AbstractType');
$this->shouldHaveType(AbstractType::class);
}
function it_has_name()

View file

@ -13,6 +13,7 @@ namespace spec\Sylius\Bundle\CoreBundle\Form\Type\DataFetcher;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
/**
@ -27,7 +28,7 @@ class UserRegistrationTypeSpec extends ObjectBehavior
function it_extends_abstract_type()
{
$this->shouldHaveType('Symfony\Component\Form\AbstractType');
$this->shouldHaveType(AbstractType::class);
}
function it_has_name()

View file

@ -12,6 +12,7 @@
namespace spec\Sylius\Bundle\CoreBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Form\FormTypeInterface;
class ImageTypeSpec extends ObjectBehavior
{
@ -20,13 +21,13 @@ class ImageTypeSpec extends ObjectBehavior
$this->beConstructedWith('Image');
}
function it_should_be_initializable()
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Bundle\CoreBundle\Form\Type\ImageType');
}
function it_should_be_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
}

View file

@ -12,16 +12,17 @@
namespace spec\Sylius\Bundle\CoreBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Form\FormTypeInterface;
class ListTypeSpec extends ObjectBehavior
{
function it_should_be_initializable()
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Bundle\CoreBundle\Form\Type\ListType');
}
function it_should_be_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
}

View file

@ -12,6 +12,8 @@
namespace spec\Sylius\Bundle\CoreBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\OrderBundle\Form\Type\OrderType;
use Symfony\Component\Form\FormTypeInterface;
class OrderTypeSpec extends ObjectBehavior
{
@ -20,18 +22,18 @@ class OrderTypeSpec extends ObjectBehavior
$this->beConstructedWith('Order', array('sylius'));
}
function it_should_be_initializable()
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Bundle\CoreBundle\Form\Type\OrderType');
}
function it_should_be_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_should_extend_Sylius_order_form_type()
{
$this->shouldHaveType('Sylius\Bundle\OrderBundle\Form\Type\OrderType');
$this->shouldHaveType(OrderType::class);
}
}

View file

@ -14,6 +14,7 @@ namespace spec\Sylius\Bundle\CoreBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeInterface;
/**
* @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
@ -32,7 +33,7 @@ class ProductTranslationTypeSpec extends ObjectBehavior
function it_should_be_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_builds_form_with_proper_fields(FormBuilder $builder)

View file

@ -13,6 +13,8 @@ namespace spec\Sylius\Bundle\CoreBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ProductBundle\Form\Type\ProductType;
use Sylius\Component\Core\Model\Product;
use Sylius\Component\User\Canonicalizer\CanonicalizerInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -23,7 +25,7 @@ class ProductTypeSpec extends ObjectBehavior
{
function let(CanonicalizerInterface $canonicalizer)
{
$this->beConstructedWith('Sylius\Component\Core\Model\Product', array('sylius'), $canonicalizer);
$this->beConstructedWith(Product::class, array('sylius'), $canonicalizer);
}
function it_is_initializable()
@ -33,7 +35,7 @@ class ProductTypeSpec extends ObjectBehavior
function it_extends_product_type_from_product_bundle()
{
$this->shouldHaveType('Sylius\Bundle\ProductBundle\Form\Type\ProductType');
$this->shouldHaveType(ProductType::class);
}
function it_bulids_form(FormBuilderInterface $builder)

View file

@ -12,6 +12,8 @@
namespace spec\Sylius\Bundle\CoreBundle\Form\Type;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\VariationBundle\Form\Type\VariantType;
use Symfony\Component\Form\FormTypeInterface;
class ProductVariantTypeSpec extends ObjectBehavior
{
@ -20,18 +22,18 @@ class ProductVariantTypeSpec extends ObjectBehavior
$this->beConstructedWith('Variant', array(), 'product');
}
function it_should_be_initializable()
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Bundle\CoreBundle\Form\Type\ProductVariantType');
}
function it_should_be_a_form_type()
{
$this->shouldImplement('Symfony\Component\Form\FormTypeInterface');
$this->shouldImplement(FormTypeInterface::class);
}
function it_should_extend_Sylius_variant_form_type()
{
$this->shouldHaveType('Sylius\Bundle\VariationBundle\Form\Type\VariantType');
$this->shouldHaveType(VariantType::class);
}
}

Some files were not shown because too many files have changed in this diff Show more