/**
  * @throws \Twig_Error_Loader
  */
 protected function setUp()
 {
     // Setup factory for tabs
     $this->tabFactory = Forms::createFormFactory();
     parent::setUp();
     $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig', 'fields.html.twig'));
     if (interface_exists('Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface')) {
         $csrfProviderInterface = 'Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface';
     } else {
         $csrfProviderInterface = 'Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\CsrfProviderInterface';
     }
     $renderer = new TwigRenderer($rendererEngine, $this->getMock($csrfProviderInterface));
     $this->extension = new FormExtension($renderer);
     $reflection = new \ReflectionClass($renderer);
     $bridgeDirectory = dirname($reflection->getFileName()) . '/../Resources/views/Form';
     $loader = new \Twig_Loader_Filesystem(array($bridgeDirectory, __DIR__ . '/../../Resources/views/Form'));
     $loader->addPath(__DIR__ . '/../../Resources/views', 'MopaBootstrap');
     $environment = new Twig_Environment($loader, array('strict_variables' => true));
     $environment->addExtension(new TranslationExtension(new StubTranslator()));
     $environment->addExtension(new IconExtension('fontawesome'));
     $environment->addExtension(new FormExtension2());
     $environment->addGlobal('global', '');
     $environment->addExtension($this->extension);
     $this->extension->initRuntime($environment);
 }
 public function setUp()
 {
     parent::setUp();
     $this->tokenStorage = $this->getMockForAbstractClass('Symfony\\Component\\Security\\Core\\TokenStorageInterface');
     $this->token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface')->disableOriginalConstructor()->getMock();
     $this->subscriber = new ChangePasswordSubscriber($this->factory, $this->tokenStorage);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->formType = new AccountGroupType();
     $this->formType->setDataClass(self::DATA_CLASS);
     $this->formType->setAccountClass(self::ACCOUNT_CLASS);
 }
 protected function setUp()
 {
     $this->configProvider = $this->getMockBuilder('\\Oro\\Bundle\\ChartBundle\\Model\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $this->configProvider->expects($this->once())->method('getChartConfigs')->will($this->returnValue(['line_chart' => ['data_schema' => [['label' => 'label', 'name' => 'name', 'required' => false]]]]));
     $this->type = new ReportChartSchemaCollectionType($this->configProvider);
     parent::setUp();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->type = new FrontendLineItemType();
     $this->type->setDataClass(self::DATA_CLASS);
     $this->type->setLineItemSubscriber($this->getLineItemSubscriber());
 }
 protected function setUp()
 {
     parent::setUp();
     $this->registry = $this->getMockBuilder('OroB2B\\Bundle\\AttributeBundle\\AttributeType\\AttributeTypeRegistry')->getMock();
     $this->registry->expects($this->any())->method('getTypeByName')->will($this->returnValueMap([[Integer::NAME, new Integer()], [Float::NAME, new Float()], [String::NAME, new String()], [Boolean::NAME, new Boolean()], [Text::NAME, new Text()], [Date::NAME, new Date()], [DateTime::NAME, new DateTime()]]));
     $this->formType = new AttributeTypeConstraintType($this->registry);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->formType = new CustomerGroupType();
     $this->formType->setDataClass(self::DATA_CLASS);
     $this->formType->setCustomerClass(self::CUSTOMER_CLASS);
 }
 protected function setUp()
 {
     parent::setUp();
     $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $configManager->expects($this->any())->method('get')->will($this->returnValue(['#FFFFFF', '#000000']));
     $this->formType = new OroSimpleColorChoiceType($configManager);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $translator = $this->createTranslatorMock();
     $this->formType = new AccountTypedAddressWithDefaultType($translator);
     $this->formType->setRegistry($this->registry);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->formType = new CustomerTypedAddressType();
     $this->formType->setAddressTypeDataClass('Oro\\Bundle\\AddressBundle\\Entity\\AddressType');
     $this->formType->setDataClass('OroB2B\\Bundle\\CustomerBundle\\Entity\\CustomerAddress');
 }
 protected function setUp()
 {
     parent::setUp();
     $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $translatorInterface = $this->getMockBuilder('Symfony\\Component\\Translation\\TranslatorInterface')->disableOriginalConstructor()->getMock();
     $this->formType = new OroSimpleColorPickerType($configManager, $translatorInterface);
 }
Ejemplo n.º 12
0
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->roundingService = $this->getMockBuilder('OroB2B\\Bundle\\ProductBundle\\Rounding\\RoundingService')->disableOriginalConstructor()->getMock();
     $this->type = new ProductType($this->roundingService);
     $this->type->setDataClass(self::DATA_CLASS);
     parent::setUp();
 }
Ejemplo n.º 13
0
 protected function tearDown()
 {
     parent::tearDown();
     \Locale::setDefault($this->locale);
     unset($this->locale);
     unset($this->formType);
 }
 protected function setUp()
 {
     parent::setUp();
     $registry = $this->getMockBuilder('OroB2B\\Bundle\\AttributeBundle\\AttributeType\\AttributeTypeRegistry')->getMock();
     $registry->expects($this->any())->method('getTypes')->will($this->returnValue([Integer::NAME => new Integer(), Float::NAME => new Float(), String::NAME => new String(), Boolean::NAME => new Boolean(), Text::NAME => new Text(), Date::NAME => new Date(), DateTime::NAME => new DateTime()]));
     /** @var \OroB2B\Bundle\AttributeBundle\AttributeType\AttributeTypeRegistry $registry */
     $this->formType = new AttributeTypeType($registry);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->formType = new AccountUserType($this->securityFacade);
     $this->formType->setDataClass(self::DATA_CLASS);
     $this->formType->setAddressClass(self::ADDRESS_CLASS);
 }
 protected function setUp()
 {
     parent::setUp();
     /** @var TranslatorInterface $translator */
     $this->translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
     $this->translator->expects($this->any())->method('trans')->with('orob2b.fallback.type.parent_locale')->willReturn('Parent Locale');
     $this->formType = new FallbackPropertyType($this->translator);
 }
Ejemplo n.º 17
0
 public function setUp()
 {
     $this->settingsProvider = $this->getMockBuilder('OroCRM\\Bundle\\ChannelBundle\\Provider\\SettingsProvider')->disableOriginalConstructor()->getMock();
     $this->settingsProvider->expects($this->any())->method('getEntitiesByChannelType')->will($this->returnValue(['OroCRM\\Bundle\\AcmeBundle\\Entity\\Test1', 'OroCRM\\Bundle\\AcmeBundle\\Entity\\Test2']));
     $this->settingsProvider->expects($this->any())->method('getCustomerIdentityFromConfig')->with(self::TEST_CHANNEL_TYPE)->will($this->returnValue(self::TEST_CUSTOMER_IDENTITY));
     $this->subscriber = new ChannelTypeSubscriber($this->settingsProvider);
     parent::setUp();
 }
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->setMethods(['get'])->disableOriginalConstructor()->getMock();
     $this->localeSettings = $this->getMockBuilder('Oro\\Bundle\\LocaleBundle\\Model\\LocaleSettings')->setMethods(['getCurrency', 'getLocale'])->disableOriginalConstructor()->getMock();
     $this->localeSettings->expects($this->any())->method('getLocale')->willReturn(\Locale::getDefault());
     $this->formType = new CurrencySelectionType($this->configManager, $this->localeSettings);
 }
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->newPaymentTerm = new PaymentTerm();
     $this->formType = new PaymentTermType(get_class($this->newPaymentTerm));
     $this->formType->setAccountClass(self::ACCOUNT_CLASS);
     $this->formType->setAccountGroupClass(self::ACCOUNT_GROUP_CLASS);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->roundingService = $this->getMockBuilder('OroB2B\\Bundle\\ProductBundle\\Rounding\\RoundingService')->disableOriginalConstructor()->getMock();
     $this->formType = new PriceListProductPriceType($this->getRegistry(), $this->roundingService);
     $this->formType->setDataClass('OroB2B\\Bundle\\PricingBundle\\Entity\\ProductPrice');
     $this->formType->setProductClass('OroB2B\\Bundle\\ProductBundle\\Entity\\Product');
     parent::setUp();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $this->userManager = $this->getMockBuilder('Oro\\Bundle\\UserBundle\\Entity\\UserManager')->disableOriginalConstructor()->getMock();
     $this->formType = new FrontendAccountUserRegistrationType($this->configManager, $this->userManager);
     $this->formType->setDataClass('OroB2B\\Bundle\\AccountBundle\\Entity\\AccountUser');
 }
Ejemplo n.º 22
0
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->type = new PriceListType();
     $this->type->setDataClass(self::DATA_CLASS);
     $this->type->setAccountClass(self::ACCOUNT_CLASS);
     $this->type->setAccountGroupClass(self::ACCOUNT_GROUP_CLASS);
     $this->type->setWebsiteClass(self::WEBSITE_CLASS);
 }
Ejemplo n.º 23
0
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->type = new PriceListType();
     $this->type->setDataClass(self::DATA_CLASS);
     $this->type->setCustomerClass(self::CUSTOMER_CLASS);
     $this->type->setCustomerGroupClass(self::CUSTOMER_GROUP_CLASS);
     $this->type->setWebsiteClass(self::WEBSITE_CLASS);
 }
Ejemplo n.º 24
0
 protected function setUp()
 {
     $this->configProvider = $this->getMockBuilder('Oro\\Bundle\\ChartBundle\\Model\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $mock = $this->getMockBuilder('Oro\\Bundle\\ChartBundle\\Form\\EventListener\\ChartTypeEventListener')->getMock();
     $eventListener = new MutableFormEventSubscriber($mock);
     $this->type = new ChartType($this->configProvider);
     $this->type->setEventListener($eventListener);
     parent::setUp();
 }
Ejemplo n.º 25
0
 protected function tearDown()
 {
     parent::tearDown();
     if ($this->defaultLocale) {
         \Locale::setDefault($this->oldLocale);
     }
     if ($this->defaultTimezone) {
         date_default_timezone_set($this->oldTimezone);
     }
 }
 protected function setUp()
 {
     parent::setUp();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $provider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $configManager->expects($this->any())->method('getProvider')->will($this->returnValue($provider));
     $this->config = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface');
     $provider->expects($this->any())->method('getConfig')->will($this->returnValue($this->config));
     $this->formType = new OroEntitySelectOrCreateInlineType($this->securityFacade, $configManager);
 }
Ejemplo n.º 27
0
 protected function setUp()
 {
     parent::setUp();
     /** @var \PHPUnit_Framework_MockObject_MockObject|RoundingService $roundingService */
     $roundingService = $this->getMockBuilder('OroB2B\\Bundle\\ProductBundle\\Rounding\\RoundingService')->disableOriginalConstructor()->getMock();
     $roundingService->expects($this->any())->method('round')->willReturnCallback(function ($value, $precision) {
         return round($value, $precision);
     });
     $this->type = new LineItemType($this->getRegistry(), $roundingService);
     $this->type->setDataClass(self::DATA_CLASS);
     $this->type->setProductClass(self::PRODUCT_CLASS);
 }
 public function setUp()
 {
     parent::setUp();
     $loader = new StubFilesystemLoader(array(__DIR__ . '/../../../../vendor/symfony/twig-bridge/Symfony/Bridge/Twig/Resources/views', __DIR__ . '/../../../../Resources/views/Form', __DIR__ . '/../../../Resources/views'));
     $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig', 'Form/form_div_layout.html.twig'));
     $renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\CsrfProviderInterface'));
     $twig = new \Twig_Environment($loader, array('strict_variables' => true));
     $twig->addGlobal('global', '');
     $twig->addExtension(new TranslationExtension(new StubTranslator()));
     $twig->addExtension(new FormExtension($renderer));
     $twig->addExtension(new Assets(new FSiFilePathResolver('/adapter/path', 'uploaded')));
     $twig->addExtension(new FileTwigExtension());
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $container->expects($this->any())->method('get')->with('templating.helper.assets')->will($this->returnValue(new UrlPackage()));
     $twig->addExtension(new AssetsExtension($container));
     $this->twig = $twig;
 }
 protected function setUp()
 {
     $account = $this->createAccount(1, 'account');
     $user = new AccountUser();
     $user->setAccount($account);
     $this->qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->getMock();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->securityFacade->expects($this->any())->method('getLoggedUser')->willReturn($user);
     $this->registry = $this->getMockBuilder('Doctrine\\Bundle\\DoctrineBundle\\Registry')->disableOriginalConstructor()->getMock();
     /** @var $repo AccountUserRoleRepository|\PHPUnit_Framework_MockObject_MockObject */
     $repo = $this->getMockBuilder('OroB2B\\Bundle\\AccountBundle\\Entity\\Repository\\AccountUserRoleRepository')->disableOriginalConstructor()->getMock();
     $repo->expects($this->any())->method('getAvailableRolesByAccountUserQueryBuilder')->with($user)->willReturn($this->qb);
     /** @var $em ObjectManager|\PHPUnit_Framework_MockObject_MockObject */
     $em = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
     $em->expects($this->any())->method('getRepository')->with('OroB2B\\Bundle\\AccountBundle\\Entity\\AccountUserRole')->willReturn($repo);
     $this->registry->expects($this->any())->method('getManagerForClass')->willReturn($em);
     $this->formType = new FrontendAccountUserRoleSelectType($this->securityFacade, $this->registry);
     $this->formType->setRoleClass('OroB2B\\Bundle\\AccountBundle\\Entity\\AccountUserRole');
     parent::setUp();
 }
 protected function setUp()
 {
     $this->metadata = $this->getMockBuilder('\\Doctrine\\ORM\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock();
     $this->metadata->expects($this->any())->method('getSingleIdentifierFieldName')->will($this->returnValue('id'));
     $this->metadata->expects($this->any())->method('getName')->will($this->returnValue(self::TEST_ENTITY));
     $this->repository = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $this->repository->expects($this->any())->method('find')->will($this->returnCallback(function ($id) {
         return new TestEntity($id);
     }));
     $this->entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $this->entityManager->expects($this->any())->method('getClassMetadata')->with(self::TEST_ENTITY)->will($this->returnValue($this->metadata));
     $this->entityManager->expects($this->any())->method('getRepository')->with(self::TEST_ENTITY)->will($this->returnValue($this->repository));
     $this->managerRegistry = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->getMockForAbstractClass();
     $this->managerRegistry->expects($this->any())->method('getManagerForClass')->with(self::TEST_ENTITY)->will($this->returnValue($this->entityManager));
     $this->managerRegistry->expects($this->any())->method('getRepository')->with(self::TEST_ENTITY)->will($this->returnValue($this->repository));
     parent::setUp();
     $this->doctrineHelper = $this->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\DoctrineHelper')->disableOriginalConstructor()->getMock();
     $this->doctrineHelper->expects($this->any())->method('getSingleEntityIdentifier')->with($this->isInstanceOf(self::TEST_ENTITY))->will($this->returnCallback(function (TestEntity $entity) {
         return $entity->getId();
     }));
     $this->formType = new OroEntityCreateOrSelectType($this->doctrineHelper);
 }