/** * {@inheritdooc}. */ protected function setUp() { parent::setUp(); $params = self::$kernel->getContainer()->get('service_container')->getParameter('fm_tinymce'); $this->tinyMCEtype = new TinyMCEType($params); $this->factory = Forms::createFormFactoryBuilder()->addType($this->tinyMCEtype)->getFormFactory(); }
protected function setUp() { parent::setUp(); $this->typeHelper = $this->getMockBuilder('Oro\\Bundle\\EntityExtendBundle\\Form\\Util\\EnumTypeHelper')->disableOriginalConstructor()->setMethods(['hasEnumCode'])->getMock(); $this->nameGenerator = new ExtendDbIdentifierNameGenerator(); $this->type = new EnumNameType($this->typeHelper, $this->nameGenerator); }
protected function setUp() { if (!class_exists('Symfony\\Component\\Form\\Form')) { $this->markTestSkipped('The "Form" component is not available'); } if (!class_exists('Doctrine\\DBAL\\Platforms\\MySqlPlatform')) { $this->markTestSkipped('Doctrine DBAL is not available.'); } if (!class_exists('Doctrine\\Common\\Version')) { $this->markTestSkipped('Doctrine Common is not available.'); } if (!class_exists('Doctrine\\ORM\\EntityManager')) { $this->markTestSkipped('Doctrine ORM is not available.'); } $this->em = DoctrineTestHelper::createTestEntityManager(); $this->emRegistry = $this->createRegistryMock('default', $this->em); parent::setUp(); $schemaTool = new SchemaTool($this->em); $classes = array($this->em->getClassMetadata(self::ITEM_GROUP_CLASS), $this->em->getClassMetadata(self::SINGLE_IDENT_CLASS), $this->em->getClassMetadata(self::SINGLE_STRING_IDENT_CLASS), $this->em->getClassMetadata(self::COMPOSITE_IDENT_CLASS), $this->em->getClassMetadata(self::COMPOSITE_STRING_IDENT_CLASS)); try { $schemaTool->dropSchema($classes); } catch (\Exception $e) { } try { $schemaTool->createSchema($classes); } catch (\Exception $e) { } }
/** * {@inheritdooc}. */ public function setUp() { parent::setUp(); $ckeditorType = new CkeditorType($this->get('service_container')); $this->factory = Forms::createFormFactoryBuilder()->addType($ckeditorType)->getFormFactory(); $this->formType = method_exists('Symfony\\Component\\Form\\AbstractType', 'getBlockPrefix') ? 'Trsteel\\CkeditorBundle\\Form\\Type\\CkeditorType' : 'ckeditor'; }
protected function setUp() { $this->organizacjaRepository = M::mock(OrganizacjaRepository::class); $this->tokenStorage = M::mock(TokenStorage::class); $this->token = M::mock(UsernamePasswordToken::class); parent::setUp(); }
/** * {@inheritdoc} */ protected function setUp() { $this->entityConfigMock = $this->getMockBuilder(EntityConfigHelper::class)->disableOriginalConstructor()->getMock(); $this->extendTypeGuesser = $this->getMockBuilder(FormTypeGuesserInterface::class)->disableOriginalConstructor()->getMock(); $this->regularTypeGuesser = $this->getMock(FormTypeGuesserInterface::class); parent::setUp(); }
protected function setUp() { $this->validator = $this->getMock('Symfony\\Component\\Validator\\Validator\\ValidatorInterface'); $metadata = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock(); $this->validator->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata)); parent::setUp(); }
protected function setUp() { parent::setUp(); $this->translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface'); $this->doctrine = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->disableOriginalConstructor()->getMock(); $this->type = new EnumFilterType($this->translator, $this->doctrine); }
protected function setUp() { parent::setUp(); $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new DateTimeJqueryTypeExtension())->addTypeExtension(new DateJqueryTypeExtension())->addTypeExtension(new BirthdayJqueryTypeExtension())->getFormFactory(); $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); }
protected function setUp() { $this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock(); $this->translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock(); parent::setUp(); }
public function setUp() { $this->typeFQCN = method_exists(AbstractType::class, 'getBlockPrefix'); $this->dm = TestCase::createTestDocumentManager([__DIR__ . '/../../Fixtures/Form/Document']); $this->dmRegistry = $this->createRegistryMock('default', $this->dm); parent::setUp(); }
protected function setUp() { parent::setUp(); $validator = $this->getMock('\\Symfony\\Component\\Validator\\Validator\\ValidatorInterface'); $validator->method('validate')->will($this->returnValue(new ConstraintViolationList())); $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new FormTypeValidatorExtension($validator))->addTypeExtension(new WidgetFormTypeExtension(array('checkbox_label' => 'label')))->getFormFactory(); }
protected function setUp() { // we test against different locales, so we need the full // implementation IntlTestHelper::requireFullIntl($this); parent::setUp(); }
protected function setUp() { parent::setUp(); $this->translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface'); $this->provider = $this->getMockBuilder('Oro\\Bundle\\EntityExtendBundle\\Provider\\EnumValueProvider')->disableOriginalConstructor()->getMock(); $this->type = new EnumFilterType($this->translator, $this->provider); }
public function setUp() { parent::setUp(); $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock(); $this->relatedEmailsProvider = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Provider\\RelatedEmailsProvider')->disableOriginalConstructor()->getMock(); $this->mailboxManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Manager\\MailboxManager')->disableOriginalConstructor()->getMock(); }
protected function setUp() { parent::setUp(); // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this); \Locale::setDefault('de_DE'); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); if (!in_array($this->type, array('form', 'filter'))) { throw new \Exception('Please override $this->type in your test class specifying template to use (either form or filter)'); } $rendererEngine = new TwigRendererEngine(array($this->type . '_admin_fields.html.twig')); $csrfManagerClass = interface_exists('Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface') ? 'Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface' : 'Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\CsrfProviderInterface'; $renderer = new TwigRenderer($rendererEngine, $this->getMock($csrfManagerClass)); $this->extension = new FormExtension($renderer); $twigPaths = array(__DIR__ . '/../../../Resources/views/Form'); //this is ugly workaround for different build strategies and, possibly, //different TwigBridge installation directories if (is_dir(__DIR__ . '/../../../vendor/symfony/twig-bridge/Resources/views/Form')) { $twigPaths[] = __DIR__ . '/../../../vendor/symfony/twig-bridge/Resources/views/Form'; } elseif (is_dir(__DIR__ . '/../../../vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form')) { $twigPaths[] = __DIR__ . '/../../../vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form'; } else { $twigPaths[] = __DIR__ . '/../../../../../symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form'; } $loader = new StubFilesystemLoader($twigPaths); $this->environment = new \Twig_Environment($loader, array('strict_variables' => true)); $this->environment->addGlobal('sonata_admin', $this->getSonataAdmin()); $this->environment->addExtension(new TranslationExtension(new StubTranslator())); $this->environment->addExtension($this->extension); $this->extension->initRuntime($this->environment); }
protected function setUp() { $this->pracownikRepository = M::mock(PracownikRepository::class); $this->tokenStorage = M::mock(TokenStorage::class); $this->token = M::mock(UsernamePasswordToken::class); parent::setUp(); }
public function setUp() { $this->typeFQCN = method_exists('\\Symfony\\Component\\Form\\AbstractType', 'getBlockPrefix'); $this->dm = TestCase::createTestDocumentManager(array(__DIR__ . '/../../Fixtures/Form/Guesser')); $this->dmRegistry = $this->createRegistryMock('default', $this->dm); parent::setUp(); }
public function setUp() { parent::setUp(); $this->repo = $this->getMockBuilder('Acts\\CamdramBundle\\Entity\\SocietyRepository')->disableOriginalConstructor()->setMethods(array('findOneByName', 'findOneBy'))->getMock(); $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $this->em->expects($this->any())->method('getRepository')->will($this->returnValue($this->repo)); }
protected function setUp() { parent::setUp(); $validator = new Validator(new ClassMetadataFactory(new LoaderChain([])), new ConstraintValidatorFactory(), new DefaultTranslator()); $this->factory = Forms::createFormFactoryBuilder()->addTypeExtension(new DataBlockExtension())->addTypeExtension(new FormTypeValidatorExtension($validator))->getFormFactory(); $this->type = new EntityType(new ExtendDbIdentifierNameGenerator()); }
/** * Set up test. */ public function setUp() { if (!interface_exists('\\Metadata\\MetadataFactoryInterface') or !interface_exists('\\Doctrine\\ORM\\EntityManagerInterface')) { $this->markTestSkipped('Serializer and Doctrine has to be loaded to run this test'); } parent::setUp(); $this->class = 'Sonata\\CoreBundle\\Tests\\Form\\Type\\FakeMetadataClass'; }
protected function setUp() { $this->enumRegistry = $this->prophesize('EnumBundle\\Registry\\EnumRegistryInterface'); $this->enumRegistry->has('state')->willReturn(false); $this->enumRegistry->has('gender')->willReturn(true); $this->enumRegistry->get('gender')->willReturn(new GenderEnum()); parent::setUp(); }
protected function setUp() { parent::setUp(); $this->securityContext = $this->getMock('Symfony\\Component\\Security\\Core\\SecurityContextInterface'); $this->emailRenderer = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Provider\\EmailRenderer')->disableOriginalConstructor()->getMock(); $this->emailModelBuilderHelper = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Builder\\Helper\\EmailModelBuilderHelper')->disableOriginalConstructor()->getMock(); $this->htmlTagProvider = $this->getMock('Oro\\Bundle\\FormBundle\\Provider\\HtmlTagProvider'); }
protected function setUp() { parent::setUp(); // we test against "de_AT", so we need the full implementation IntlTestHelper::requireFullIntl($this); \Locale::setDefault('de_AT'); $this->defaultTimezone = date_default_timezone_get(); }
protected function setUp() { $classMetadataFactory = $this->getMockBuilder('DMS\\Filter\\Mapping\\ClassMetadataFactory')->disableOriginalConstructor()->getMock(); $filterLoader = $this->getMock('DMS\\Filter\\Filters\\Loader\\FilterLoaderInterface'); $filterExecutor = new \DMS\Filter\Filter($classMetadataFactory, $filterLoader); $this->filter = $this->getMockBuilder('DMS\\Bundle\\FilterBundle\\Service\\Filter')->setConstructorArgs(array($filterExecutor))->getMock(); parent::setUp(); }
protected function setUp() { parent::setUp(); $this->provider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock(); $validator = new Validator(new ClassMetadataFactory(new LoaderChain([])), new ConstraintValidatorFactory(), new DefaultTranslator()); $this->factory = Forms::createFormFactoryBuilder()->addTypeExtension(new DataBlockExtension())->addTypeExtension(new FormTypeValidatorExtension($validator))->getFormFactory(); $this->type = new UniqueKeyCollectionType($this->provider); }
public function setUp() { parent::setUp(); $this->app = new \Eccube\Application(array('env' => 'test')); $this->app->initialize(); $this->app->boot(); // CSRF tokenを無効にしてFormを作成 $this->form = $this->app['form.factory']->createBuilder('form', null, array('csrf_protection' => false))->add('tel', 'tel')->getForm(); }
public function setUp() { parent::setUp(); $validator = $this->getMock('Symfony\\Component\\Validator\\ValidatorInterface'); $validator->method('validate')->will($this->returnValue(new ConstraintViolationList())); $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new FormTypeValidatorExtension($validator))->addTypeGuesser($this->getMockBuilder('Symfony\\Component\\Form\\Extension\\Validator\\ValidatorTypeGuesser')->disableOriginalConstructor()->getMock())->getFormFactory(); $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); }
public function setUp() { parent::setUp(); $this->app = new \Eccube\Application(); $this->app->initialize(); $this->app['session.test'] = true; $this->app['exception_handler']->disable(); $this->app->boot(); }